angular / protractor

E2E test framework for Angular apps

Home Page:http://www.protractortest.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why do I always need browser.sleep, although I use await!

ueveys opened this issue · comments

I wrote the following example test with Jasmine notation:
it('login', async()=>{
await browser.logger.info("Login test");
await loginIcon.click();
await browser.sleep(1000);
await browser.switchTo().frame(1);
await browser.sleep(1000);
await pageP.mailAdresseAngeben("user-example");
await pageP.passwordEingeben("password-exampel");
await pageP.loginClick();
});

Without browser.sleep, the test fails, when I raise it again, the test is correct.

My understanding of "await":
The testing action is performed using the "AWAIT" function for the action to wait until the web element is available, which is necessary for this action.
So that the tester does not define exact time for testing options such as browser.sleep.
If I'm correct with my guess, then I should not use browser.sleep in my example.

async/await has no any relation to browser or webelements

https://javascript.info/async-await

good to know. I thought await also controls my test actions. Thanks for the answer

Where could I use async/await at protracto E2E test?

@ueveys before every command that returns Promise object. Basically that means everything except $, $$ functions