sharding question
Hello,
I'm having some issues getting sharding to work
I currently have the following in my default config:
module.exports = {
allScriptsTimeout: 15000,
specs: [
'../spec/**/*-e2e.js'
],
and then in my shard config i have the following:
var config = require('./default-conf.js');
config.seleniumAddress = 'http://localhost:4444/wd/hub';
config.jasmineNodeOpts.defaultTimeoutInterval = 30000;
config.multiCapabilities = [{
'browserName': 'chrome',
shardTestfiles: true,
maxInstances: 5
}
];
exports.config = config;
However only 1 browser instance is running for me. Is there something I'm doing wrong?
Protractor's own sharding conf is here: https://github.com/angular/protractor/blob/master/spec/shardingConf.js.
Does '../spec/*/-e2e.js' resolve to multiple specs?
@hankduan it does to 7 of them. I tried following the conf from the example, but it only pops one browser for me.
what version of protractor are you using?
I just updated to 1.4.0 and that didn't fix the issue, it is actually causing some of the spec files to be skipped for some reason.
Can you run this:
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub';
specs: [
// Please list 3 specs instead of using path expansion so it's easier for me to debug
],
multiCapabilities: [{
'browserName': 'chrome',
shardTestFiles: true,
maxInstances: 5
}],
};
And paste the commandline output for me?
ok so here is what I have:
default-conf.js has the following
var baseUrl = 'someUrl';
console.log('protractor baseUrl: ' + baseUrl);
module.exports = {
allScriptsTimeout: 15000,
specs: [
'../spec/**/cta-e2e.js',
'../spec/**/dashboard-e2e.js',
'../spec/**/education-e2e.js'
],
rootElement: 'body',
onPrepare: function () {
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true, true));
},
baseUrl: baseUrl,
jasmineNodeOpts: {
// onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: false,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 20000
}
};
e2e-local.js has the following:
var config = require('./default-conf.js');
config.seleniumAddress = 'http://localhost:4444/wd/hub';
config.jasmineNodeOpts.defaultTimeoutInterval = 30000;
config.multiCapabilities = [{
'browserName': 'chrome',
shardTestfiles: true,
maxInstances: 3
}];
exports.config = config;
I run the following command:
protractor test/e2e/conf/e2e-local.js
the output that I'm getting is as follows:
protractor baseUrl: http://alex-mock-babysteps.otpp.me/members/my/#/
Using the selenium server at http://localhost:4444/wd/hub
..........................
Finished in 77.42 seconds
26 tests, 21 assertions, 0 failures
also please note that once I've upgraded it started skipping anything after the 2 first tests.
Can you try with shardTestFiles instead of shardTestfiles?
that seems to have fixed the issue, Thank you. I have another issue now though that when I run a config without sharding it is skipping the rest of my specs for some reason.
My default config is :
var baseUrl = 'someUrl';
console.log('protractor baseUrl: ' + baseUrl);
module.exports = {
allScriptsTimeout: 15000,
specs: [
'../spec/**/cta-e2e.js',
'../spec/**/dashboard-e2e.js',
'../spec/**/education-e2e.js',
'../spec/**/login-e2e.js',
'../spec/**/contactUs-e2e.js',
'../spec/**/sideMenu-e2e.js'
//'../spec/**/*-e2e.js'
],
rootElement: 'body',
onPrepare: function () {
require('jasmine-reporters');
jasmine.getEnv().addReporter(
new jasmine.JUnitXmlReporter('xmloutput', true, true));
},
baseUrl: baseUrl,
jasmineNodeOpts: {
// onComplete will be called just before the driver quits.
onComplete: null,
// If true, display spec names.
isVerbose: true,
// If true, print colors to the terminal.
showColors: true,
// If true, include stack traces in failures.
includeStackTrace: true,
// Default time to wait in ms before a test fails.
defaultTimeoutInterval: 20000
}
};
my local config is as follows:
var config = require('./default-conf.js');
config.seleniumAddress = 'http://localhost:4444/wd/hub';
config.jasmineNodeOpts.defaultTimeoutInterval = 30000;
config.multiCapabilities = [{
'browserName': 'chrome'
}];
exports.config = config;
i run the following command
protractor test/e2e/conf/e2e-local.js
and this is the printout that I get:
protractor baseUrl: http://alex-mock-babysteps.otpp.me/members/my/#/
Using the selenium server at http://localhost:4444/wd/hub
CTA Dashboard tests
should display expired message - pass
should display a PA deadline message - pass
should display a 5 year expiry message - pass
should display formal or fixed no payments message - pass
should display early retirement for formal with some payments - pass
should display a complete case - pass
should display a complete message before opportunity expired - pass
should display a complete message before PA expired - pass
should display a complete message before PA approaching - pass
should display a complete message before Buyback expiry approaching - pass
should display correct cta message for formal not paid - pass
should display correct cta message for fixed not paid - pass
should display correct cta message for informal not paid - pass
should display correct cta message for paid formal - pass
should display correct cta message for paid fixed - pass
should display correct cta message for paid informal - pass
Dashboard tests
should display a formal single buyback - pass
should display a fixed single buyback no payments - pass
should display a fully paid leave - pass
should display payments for a single leave - pass
should expand PA information - pass
should expand buyback deadline information - pass
should display a member with expired pa and expired buyback information - pass
should display applied intent for single buyback - pass
should display no buyback message - pass
Education Pages Tests
should swipe between screens - pass
Login page test
should be able to login for the first time - pass
should be able to show and hide password - pass
should display login error message - pass
Contact us tests
clicking on contact us should bring up contact us page with login - pass
Side Menu test cases
should navigate through all the options in the side menu logged in - pass
should navigate through all the options in the side menu logged out - pass
Finished in 77.893 seconds
32 tests, 21 assertions, 0 failures
but it actually doesnt run any of the tests after CTA Dashboard tests.
Thank you again for the help.
Do you have an iit or ddescribe somewhere?
no none of that, the interesting thing is that if I use shard then it works fine but if I use the regular way of running it runs the first test, then skips the rest and says they passed.
This sounds very specific to what you are doing in your tests. Check again for iit, ddescribes, especially in the last test that ran and first test that got skipped. Put log lines in your "skipped" test to verify they're actually skipped. Check for logic in your tests that would skip the files (beforeEach, afterEach?). Also make sure you're using Jasmine 1.x syntax instead of jasmine 2.x.
If you run your tests together (without sharding), protractor combines all your files and runs them sequentially, whereas if you run your test with sharding, protractor starts multiple threads to run each file. That's about the only thing protractor does to your tests.
I'm closing this issue as it's a question and not a bug/feature request. Please post something on stack overflow if you cannot figure it out yourself.
Thank you for all the help @hankduan. I'll give your suggestions a go