I have a set of smokescreen tests that are all pretty much identical. I would like to put them into a loop and loop at an array of parameters. However, the tests are running asynchronously and so the loop completes before the tests are run. This results in the test being run 8 times on the 8th parameter instead of once for each parameter.
describe('Admin Console Campaigns', function() {
var ptor;
var adminUrl;
var testParams = [
{title: 'Dashboard', urlSuffix: '/communic8' },
{title: 'Campaign Report', urlSuffix: '/Reports/Campaign' },
{title: 'Partner Campaign Usage', urlSuffix: '/Reporting/PartnerCampaignUsage' },
{title: 'Campaign Template Usage', urlSuffix: '/Reporting/CampaignTemplateUsage' },
{title: 'Email Usage Report', urlSuffix: '/Reports/EmailUsage' },
{title: 'Campaign Templates', urlSuffix: '/CampaignTemplates' },
{title: 'Campaign Template Groups', urlSuffix: '/CampaignTemplateGroups' },
{title: 'New Template', urlSuffix: '/CampaignTemplates/Add' }
];
beforeEach(function() {
ptor = protractor.getInstance();
ptor.ignoreSynchronization = true;
var testParams = smokescreenTestConfig.adminCampaigns;
adminUrl = ptor.params.http + ptor.params.client + ptor.params.staging + ptor.params.sharedvue + ptor.params.admin;
});
afterEach(function(){
});
for(var i=0; i < testParams.length; i++){
var testParam = testParams[i];
it('should have a ' + testParam.title + ' tab', function() {
testUrl = adminUrl + testParam.urlSuffix;
basicTestFunctions.pageExists(testUrl, ptor, browser, testParam.title);
}, 60000);
};
});
Does anyone have an idea of how to force the loop to wait on the tests?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…