I have the following testcase:
it('User can logout', async () => {
await helper.navClick('.header-user-action__logout');
const url = page.url();
console.log(url)
await expect(url).toContain('auth');
});
helper.navClick
is just a small wrapper:
async function navClick(selector, options) {
return await Promise.all([page.waitForNavigation(), expect(page).toClick(selector, options)]);
}
Most of the time, it succeeds without any problem, but sometimes it'll be marked as failed:
✕ User can logout (569 ms)
● Login › User can logout
console.log
https://auth.example.com/auth/realms/example/protocol/openid-connect/auth?response_type=code&client_id=example-app&redirect_uri=https%3A%2F%2Fexample.com%2Fsso%2Flogin&state=807469fd-3ee5-4d93-8354-ca47a63e69a6&login=true&scope=openid
How can this happen? The url contains "auth" multiple times, and I don't see anything else that could cause the test to fail.