E2E Protractor Testing


#1

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.


#2

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);
    }

#3

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, …)