Skip to content

Commit 149e77a

Browse files
authored
chore(e2e): wait for toggle to be checked with retries (#5124)
1 parent 4dec87f commit 149e77a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

packages/compass-e2e-tests/tests/atlas-login.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,25 @@ describe('Atlas Login', function () {
165165

166166
const acceptTOSToggle = browser.$(Selectors.AcceptTOSToggle);
167167

168-
expect(await acceptTOSToggle.getAttribute('aria-checked')).to.eq('false');
168+
expect(await acceptTOSToggle.getAttribute('aria-checked')).to.eq(
169+
'false',
170+
'Expected TOS toggle to be unchecked'
171+
);
169172

170173
await browser.clickVisible(acceptTOSToggle);
171174

172175
await browser.clickVisible(Selectors.AgreeAndContinueButton);
173176

174-
expect(await acceptTOSToggle.getAttribute('aria-checked')).to.eq('true');
177+
// We are not just waiting here, this is asserting that toggle was
178+
// switched on, indicating that TOS was accepted
179+
await browser.waitUntil(
180+
async () => {
181+
return (
182+
(await acceptTOSToggle.getAttribute('aria-checked')) === 'true'
183+
);
184+
},
185+
{ timeoutMsg: 'Expected TOS toggle to be checked' }
186+
);
175187
});
176188

177189
it('should sign out user when "Disconnect" clicked', async function () {

0 commit comments

Comments
 (0)