E2E Protractor Testing

Hello everyone!

While going through e2e testing, I’ve found myself using browser.wait many times as I wait for things to load into the DOM. Is there a better way to do this? I’ve looked into the e2e testing documentation for Aurelia, but I haven’t seen any information on this topic.

That was my approach too. The constructor for each of my page objects starts with a wait for a key DOM element on the page:

    private btnLogin = by.id('btnLogin');

    constructor() {
        browser.wait(until.elementLocated(this.btnLogin), 5000);
    }
1 Like

Not a bad idea allthough keep in mind that the way you’ve defined btnLogin it will be eagerly evaluated. Typically element props should be implemented as getters so that by the time you request them they get reevaluated. The reason is that the by locator might go stale (element dropped, changes by sut itself, …)

1 Like