One option would be to iterate over the test URLs:
describe('TEST ',function(){
var basePage = new BasePage();
var page1 = new Page1();
var urls = ['URL-1.html', 'URL-2.html'];
urls.map(function (url) {
describe('TEST ' + url,function(){
beforeEach(function(){
browser.get(url);
});
it('REUSE THIS TEST' , function (){
browser.wait(EC.visibilityOf(viewerWidgetPage.videoPlayer));
page1.videoControls.click();
expect(basePage.hasClass(page1.videoPlayer, 'vjs-playing')).toBeTruthy();
page1.audioControl.click();
browser.executeAsyncScript_(function(callback){
callback(window.player.muted());
}).then(function(isMuted){
expect(isMuted).toBeFalsy();
});
page1.audioControl.click();
browser.executeAsyncScript_(function(callback){
callback(window.player.muted());
}).then(function(isMuted){
expect(isMuted).toBeTruthy();
});
});
});
});
});
Another approach that is likely to scale better is to use multiCapabilitiesand add the desired specifications to each of the features that parameterize the url under test.
, :
multiCapabilities: [
{
browserName: "chrome",
url: "URL-1.html"
},
{
browserName: "chrome",
url: "URL-2.html"
}
],
getProcessedConfig() url:
beforeEach(function () {
browser.getProcessedConfig().then(function (config) {
var url = config.capabilities.url;
browser.get(url);
});
});
- .