I have a case like this
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: [
'test/scenarios/user/login.js',
'test/scenarios/user/choose_user_1.js',
'test/scenarios/user/change_user.js',
'test/scenarios/user/choose_user_2.js',
'test/scenarios/user/change_user.js',
'test/scenarios/user/choose_user_3.js',
'test/scenarios/user/logout.js'
]
}
But protractor doesn't reuse change_user.js more than once.. I have to create change_user_1.js and change_user_2.js to get what I want.. Is there a way to deactivate this behavior, or I should do my tests differently?
Best Regards
As far as i know, you cannot call same script twice. We had similar issue and here's what I did to fix it - Use
jasmine-data-provider
, create separate suites instead of scripts and loop through them using data provider. Here are the steps that i would follow -jasmine-data-provider
npm package.describe
suites, one forchoose_user
and the other forchange_user
.jasmine-data-provider
.choose_user
-describe
runs, achange_user
-describe
also runs next to that.Here's a sample code -
This script should run
choose_user
andchange_user
specs 3 times and then you can continue execution with rest of the scripts in pipe.Hope it helps.