How can I dynamically add urls to Protractor tags?

I am trying to use a protractor in conjunction with Jenkins. In my jenkins, I need urls to be dynamically generated.

Thus, during the execution of transport tests, for example:

describe('angularjs homepage', function() { it('should greet the named user', function() { // Load the AngularJS homepage. browser.get('http://www.angularjs.org'); element(by.model('yourName')).sendKeys('testUser'); }); }); 

In the above example, I want to dynamically pass a variable instead of http://www.angularjs.org ".

I could not find any variables that could also be specified in the reference configuration.

+4
source share
3 answers

If I understand the question correctly, you are looking for an environment variable to configure the base url. In this case, since Protractor is built on WebDriver, you must install

 webdriver.base.url="http://someurl" 

Hope this is what you are looking for.

+4
source

You can use baseUrl as a configuration parameter inside exports.config , and then use browser.get('/path') inside your test spec. So in the configuration you have, for example, baseUrl: 'http://localhost', , so browser.get('/path') will call http://localhost/path .

+7
source

It looks like calling browser.baseUrl = "https://test-url.com" does the trick in onPrepare

0
source

Source: https://habr.com/ru/post/987614/


All Articles