Skip to content

Commit 915dd89

Browse files
committed
test(e2e): harden mobile and boot timing assertions
1 parent f40f8f8 commit 915dd89

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

tests/e2e/gameboy.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,6 @@ test.describe('GameBoy E2E', () => {
184184
await page.keyboard.press('p');
185185
await expect(consoleBody).toHaveClass(/console-booting/);
186186
await expect(bootScreen).toHaveClass(/active/);
187-
await expect(bootStatus).toBeVisible();
188187
await expect(bootStatus).toContainText('CONTROLS LOCKED');
189188

190189
await page.keyboard.press('ArrowDown');
@@ -206,6 +205,7 @@ test.describe('GameBoy E2E', () => {
206205

207206
test('Rapid power cycling does not unlock controls early', async ({ page }) => {
208207
const consoleBody = page.locator('.console');
208+
const bootScreen = page.locator('#boot-screen');
209209
const firstLink = page.locator('.social-link').first();
210210
const secondLink = page.locator('.social-link').nth(1);
211211

@@ -221,13 +221,18 @@ test.describe('GameBoy E2E', () => {
221221

222222
await page.keyboard.press('p');
223223
await expect(consoleBody).toHaveClass(/console-booting/);
224+
await expect(bootScreen).toHaveClass(/active/);
225+
226+
await page.waitForTimeout(2200);
227+
await expect(consoleBody).toHaveClass(/console-booting/);
228+
await expect(bootScreen).toHaveClass(/active/);
224229

225-
await page.waitForTimeout(2600);
226230
await page.keyboard.press('ArrowDown');
227231
await expect(firstLink).toHaveClass(/active/);
228232
await expect(secondLink).not.toHaveClass(/active/);
229233

230-
await expect(consoleBody).not.toHaveClass(/console-booting/, { timeout: 2000 });
234+
await expect(consoleBody).not.toHaveClass(/console-booting/, { timeout: 2500 });
235+
await expect(bootScreen).not.toHaveClass(/active/, { timeout: 2500 });
231236
await page.keyboard.press('ArrowDown');
232237
await expect(secondLink).toHaveClass(/active/);
233238
});

tests/e2e/mobile-ui.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ test.describe('Mobile UI regressions', () => {
6161
await expect(consoleBody).not.toHaveClass(/landscape/);
6262

6363
await tapCenter(page, turnButton);
64+
if (!(await consoleBody.evaluate((el) => el.classList.contains('landscape')))) {
65+
await page.waitForTimeout(150);
66+
await tapCenter(page, turnButton);
67+
}
68+
6469
await expect(consoleBody).toHaveClass(/landscape/);
6570
await expect(turnButton).toBeVisible();
6671
});

0 commit comments

Comments
 (0)