I'm currently working on transitioning my tests for a non-Angular website to utilize the async/await control flow. While some of the tests are running smoothly, I've encountered issues with others.
Specifically, I am struggling with logging in and waiting for elements to become clickable. I have attempted the standard wait construction for loading elements:
browser.wait(EC.urlIs(browser.baseUrl + url.home), 7000, 'url is not as expected');
And the same approach for an element:
browser.wait(EC.visibilityOf(dashpage.creds), 7000, 'element card holder is not visible');
However, these tests are failing with error notifications.
I also tried a different approach:
expect(await browser.getCurrentUrl()).toContain(url.home);
But unfortunately, this expectation consistently fails.
Here is a snippet of the code:
beforeAll(async function () {
browser.ignoreSynchronization = true;
await browser.get(browser.baseUrl);
});
it('Log in as a new user and buy credits from member profile', async function () {
email = hel.randomEmail();
console.log(email);
await homeact.fill_signup_form(par.male_name, email, par.password, par.canada, 0);
await homeact.signup_submit();
browser.wait(EC.urlIs(broswer.baseUrl + url.home), 7000, 'url is not as expected');
//expect(await browser.getCurrentUrl()).toContain(url.home);
await dashact.check_creds(0);
await dashact.to_cred_popup();
//check closing pop-up:
await buycract.close_popup();
If anyone has suggestions on how to implement a delay for the conditions code, your assistance would be greatly appreciated. Thank you!