Despite there being similar inquiries on this topic, I am struggling to comprehend them.
Allow me to illustrate with an example, where my task is to click a button and verify the URL.
Initially, I thought it should be coded as:
element(by.id('button')).click();
expect(browser.getCurrentUrl()).toContain('asyncisconfusing');
I understand that 'expect' manages its promise, but what about the 'click'? Shouldn't it be handled like this?
element(by.id('button')).click().then(() => {
expect(browser.getCurrentUrl()).toContain('asyncisconfusing')
})
Or does protractor/webdriver handle this automatically?