0

I want to alter the baseUrl to contain paramaters from a json, to open a different url to run a test for each market i have. How do i go about that? This is what i have so far. protractor - 5.1.2 typescript: 2.4.2

locales.json

{
  "markets": ["us", "uk", "ca"]
}

config.js

  params: { 
       data:require('./e2e/testdata/locales.json') ,
       baseUrl: 'https://mywebsite' + markets[i] + '.com' //should get all items from json
  },

spec.ts beforeEach(() => {

    page = new PageObject();
    browser.waitForAngularEnabled(false);  
    browser.get(baseUrl); // i want the test to run more than once, for all items in json file

  });
user6086008
  • 101
  • 3
  • 14

1 Answers1

0

So i managed to loop through my json file and alter the baseUrl each time. But the browser doesnt open each baseUrl in a different instance, it stays in the same window. My tests passes, but i dont see if it ran the 3 times i wanted it to. I only see it run on the last item that was in the loop.

beforeEach(() => {

    page = new PageObject();
    browser.waitForAngularEnabled(false);
    for (var i = 0; i < market.length; i++) {
      var marketParam = market[i];
      let baseUrl: 'https://mywebsite' + marketParam + '.com'
      browser.get(baseUrl);
    }
  });
user6086008
  • 101
  • 3
  • 14