From 6678963b1f59d7dbaa377ccfb59bd52fb61025fb Mon Sep 17 00:00:00 2001 From: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com> Date: Tue, 7 Nov 2023 13:20:13 +0700 Subject: [PATCH] fix(e2e, playwright): stabilize page navigation in hotkeys.spec.ts (#52236) --- e2e/hotkeys.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/e2e/hotkeys.spec.ts b/e2e/hotkeys.spec.ts index 60c1d163e7a..69ae5e0d019 100644 --- a/e2e/hotkeys.spec.ts +++ b/e2e/hotkeys.spec.ts @@ -36,10 +36,18 @@ test('User can interact with the app using the keyboard', async ({ await page.keyboard.press('n'); const nextCourse = '**/declare-javascript-variables'; await page.waitForURL(nextCourse); + // Ensure that the page content is loaded before simulating user interactions. + await expect( + page.getByRole('heading', { name: 'Declare JavaScript Variables' }) + ).toBeVisible(); await page.keyboard.press('p'); const previousCourse = '**/comment-your-javascript-code'; await page.waitForURL(previousCourse); + // Ensure that the page content is loaded before simulating user interactions. + await expect( + page.getByRole('heading', { name: 'Comment Your JavaScript Code' }) + ).toBeVisible(); await page.keyboard.press('e'); await expect(page.getByLabel(editorPaneLabel)).toBeFocused();