Get the current browser name in Protractor test

后端 未结 3 1727
余生分开走
余生分开走 2020-12-03 14:58

I\'m creating users in some test. Since it is connected to the backend and create real users I need fixtures. I was thinking of using the browser name to create unique user.

3条回答
  •  再見小時候
    2020-12-03 15:06

    If you want to avoid the a browser, you may want to do this:

    it('User should see a message that he has already been added to the campaing when entering the same email twice', function () {
    
        browser.getCapabilities().then(function (capabilities) {
            browserName = capabilities.caps_.browserName;
            platform = capabilities.caps_.platform;
        }).then(function () {
            console.log('Browser:', browserName, 'on platform', platform);
            if (browserName === 'internet explorer') {
                console.log('IE Was avoided for this test.');
            } else {
                basePage.email.sendKeys('bruno@test.com');
                console.log('Mande el mail');
                basePage.subscribe.click().then(function () {
                    basePage.confirmMessage('Contact already added to target campaign');
                });
            }
        });
    
    }); 
    

提交回复
热议问题