A Jasmine spec timed out. Resetting the WebDriver Control Flow - when redirect to new page

后端 未结 5 1105
轻奢々
轻奢々 2021-02-20 11:23

I\'m beginner in the e2e testing and have a problem. When I do login - I make redirect from login.php to index.php page. But my test is fails with following errors:



        
5条回答
  •  失恋的感觉
    2021-02-20 11:44

    You are getting timeout because you've injected a param into it callback and never called that (read more on that here). You should remove the param, or call it when the test is over. Basically, you don't do any custom async stuff, so you don't need it.

    So the question is how I can wait when my page will reload and check url?

    I'd suggest that you waited for a specific element on index.php page:

    it('should login and redirect to overview page with CR Operators rights', function() {
        element(by.model('username')).clear().sendKeys('testuser');
        element(by.model('password')).clear().sendKeys('test');
        element(by.css('[type="submit"]')).click();
        browser.wait(protractor.until.elementLocated(by.css('Log out'));
        expect(element(by.css('body')).getText()).toContain('Hello, you are Logged In!');
    });
    

提交回复
热议问题