3

How I should configure my TFS build to make it possible run protractor e2e test in browserstack, and return me some html report which test are failed? I am new in TFS. I can do it manually from my machine, but not sure have I can do it in TFS. This is how my protractor config looks like:

var project = 'testProject',
build = 'build_4',
acceptSslCerts = 'true';

var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');

var reporter = new HtmlScreenshotReporter({
dest: './html-report/',
filename: 'my-report.html',
reportOnlyFailedSpecs: false,
captureOnlyFailedSpecs: true,
showSummary: true,    
});

module.exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://hub.browserstack.com/wd/hub', /*  'http://localhost:4444/wd/hub', */
allScriptsTimeout: 40000,
specs: [    'test-spec.js'    ],
 capabilities: {
     browserName: 'chrome',
     loggingPrefs: { driver: 'ALL', server: 'ALL', browser: 'ALL' },
     'build' : 'version3',
     'project' : 'newintropage',
     'browserstack.user': 'browserstack.user',
     'browserstack.key': 'browserstack.key',        
     'browser': 'Edge',
     'browser_version': '13.0',
     'os': 'Windows',
     'os_version': '10',
     'resolution': '1024x768',

     'acceptSslCerts': acceptSslCerts
 },    
jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 40000
},
// Setup the report before any tests start
beforeLaunch: function () {
    return new Promise(function (resolve) {
        reporter.beforeLaunch(resolve);
    });
},
onPrepare: function () {       
    jasmine.getEnv().addReporter(reporter);
},
// Close the report after all tests finish
afterLaunch: function (exitCode) {
    return new Promise(function (resolve) {
        reporter.afterLaunch(resolve.bind(this, exitCode));
    });
}
};

And that's how my tfs build looks like:

enter image description here

odpro
  • 96
  • 1
  • 6

1 Answers1

2

According to the screenshot, you are using vNext build, and you have chosen a default "Visual Studio" build template.

TFS vNext build system is task based, which is flexible. I'm not familiar with protractor e2e tests, but based on the description of Protractor, at least, you'll need to use npm to install two command line tools, protractor and webdriver-manager, so the default "Visual Studio" build template won't meet your requirement.

You need to customize your own build template by specifying your build steps. For example, you need to add npm step to install protractor and webdriver-manager, and add Command Line step to run protractor conf.js command.

enter image description here

Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39