pavel
pavel

Reputation: 2186

Unable connect to page. Browserstack

I use protractor with Browserstack.exe for e2e (UI) testing.

I have to check authorization proccess. It goes in this way:

  1. go to domain/#login
  2. redirect to auth0.com to get authorized (hosted auth0 authorization)
  3. enter credentials
  4. redirect to my angular client with finished authentification.

I read that for testing separate login page we have to use browser.ignoreSynchronization = true;

Sometimes it works, some - not. I don't understand why and what depends on this.

I have this error while run protractor: Expected 'http://localhost:8001/app/#/login' to contain 'domen.auth0.com'.

and this screen: browserstack screenshot

my code :

describe('[domain.reports]', function () {

    beforeAll(function() {
        // it makes protractor not wait for Angular promises
        // for testing separate login page.
        browser.ignoreSynchronization = true;
    });

    beforeEach(function () {
        browser.wait(browser.get('#/login'), 5000);
        expect(browser.getCurrentUrl()).toContain('domain.auth0.com');
    });

    it('should automatically redirect to /samples when location hash/fragment is empty', function () {

        var EC = protractor.ExpectedConditions;
        var el = element(by.css('.auth0-lock-submit'));
        browser.wait(EC.visibilityOf(el), 10000);
        protractor.loginHelpers.loginToPage('[email protected]', 'Qazxsw123456');
        protractor.waitHelpers.waitForUrlToBeChanged("/samples");

        //browser.wait(browser.get('#/samples'), 5000);
        expect(browser.getCurrentUrl()).toMatch("/samples");
        browser.get('#/api');
        expect(browser.getCurrentUrl()).not.toContain("/api");
    });
});

It works at another scenarious...

Thank you in advise for any thoughts!

Upvotes: 1

Views: 651

Answers (0)

Related Questions