From 37d46388d465b79958071c9cca629fb87bb69f65 Mon Sep 17 00:00:00 2001 From: Samuel Jensen <44519206+nichtsam@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:06:35 +0100 Subject: [PATCH 1/3] remove expects for pending state --- tests/e2e/onboarding.test.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tests/e2e/onboarding.test.ts b/tests/e2e/onboarding.test.ts index 6c4236b02..7440e5828 100644 --- a/tests/e2e/onboarding.test.ts +++ b/tests/e2e/onboarding.test.ts @@ -60,9 +60,6 @@ test('onboarding with link', async ({ page, getOnboardingData }) => { await emailTextbox.fill(onboardingData.email) await page.getByRole('button', { name: /submit/i }).click() - await expect( - page.getByRole('button', { name: /submit/i, disabled: true }), - ).toBeVisible() await expect(page.getByText(/check your email/i)).toBeVisible() const email = await readEmail(onboardingData.email) @@ -120,9 +117,6 @@ test('onboarding with a short code', async ({ page, getOnboardingData }) => { await emailTextbox.fill(onboardingData.email) await page.getByRole('button', { name: /submit/i }).click() - await expect( - page.getByRole('button', { name: /submit/i, disabled: true }), - ).toBeVisible() await expect(page.getByText(/check your email/i)).toBeVisible() const email = await readEmail(onboardingData.email) @@ -350,9 +344,6 @@ test('reset password with a link', async ({ page, insertNewUser }) => { ).toBeVisible() await page.getByRole('textbox', { name: /username/i }).fill(user.username) await page.getByRole('button', { name: /recover password/i }).click() - await expect( - page.getByRole('button', { name: /recover password/i, disabled: true }), - ).toBeVisible() await expect(page.getByText(/check your email/i)).toBeVisible() const email = await readEmail(user.email) @@ -377,9 +368,6 @@ test('reset password with a link', async ({ page, insertNewUser }) => { await page.getByLabel(/^confirm password$/i).fill(newPassword) await page.getByRole('button', { name: /reset password/i }).click() - await expect( - page.getByRole('button', { name: /reset password/i, disabled: true }), - ).toBeVisible() await expect(page).toHaveURL('/login') await page.getByRole('textbox', { name: /username/i }).fill(user.username) @@ -408,9 +396,6 @@ test('reset password with a short code', async ({ page, insertNewUser }) => { ).toBeVisible() await page.getByRole('textbox', { name: /username/i }).fill(user.username) await page.getByRole('button', { name: /recover password/i }).click() - await expect( - page.getByRole('button', { name: /recover password/i, disabled: true }), - ).toBeVisible() await expect(page.getByText(/check your email/i)).toBeVisible() const email = await readEmail(user.email) From d7820bb04a530c1c8ea9c54378ccf2d31abf4ec0 Mon Sep 17 00:00:00 2001 From: Samuel Jensen <44519206+nichtsam@users.noreply.github.com> Date: Tue, 18 Feb 2025 15:36:44 +0100 Subject: [PATCH 2/3] limit github user mocks username length --- tests/mocks/github.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/mocks/github.ts b/tests/mocks/github.ts index 96ba46f41..936aeec3a 100644 --- a/tests/mocks/github.ts +++ b/tests/mocks/github.ts @@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url' import { faker } from '@faker-js/faker' import fsExtra from 'fs-extra' import { HttpResponse, passthrough, http, type HttpHandler } from 'msw' +import { USERNAME_MAX_LENGTH } from '#app/utils/user-validation.ts' const { json } = HttpResponse @@ -54,7 +55,7 @@ function createGitHubUser(code?: string | null) { code, accessToken: `${code}_mock_access_token`, profile: { - login: faker.internet.username(), + login: faker.internet.username().slice(0, USERNAME_MAX_LENGTH), id: faker.number.int(), name: faker.person.fullName(), avatar_url: 'https://github.com/ghost.png', From a0ea160ff970a1bb480ee8d85cf08e1d23182c70 Mon Sep 17 00:00:00 2001 From: Samuel Jensen <44519206+nichtsam@users.noreply.github.com> Date: Tue, 25 Feb 2025 13:46:48 +0100 Subject: [PATCH 3/3] ensure js is loaded before testing components that depend on it radix checkbox requires js to work --- tests/e2e/onboarding.test.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/e2e/onboarding.test.ts b/tests/e2e/onboarding.test.ts index 7440e5828..f5b1223e2 100644 --- a/tests/e2e/onboarding.test.ts +++ b/tests/e2e/onboarding.test.ts @@ -89,6 +89,8 @@ test('onboarding with link', async ({ page, getOnboardingData }) => { await page.getByLabel(/^confirm password/i).fill(onboardingData.password) + await page.waitForLoadState('networkidle') // ensure js is fully loaded. + await page.getByLabel(/terms/i).check() await page.getByLabel(/remember me/i).check() @@ -167,6 +169,7 @@ test('completes onboarding after GitHub OAuth given valid user details', async ( name: /create an account/i, }) + await page.waitForLoadState('networkidle') // ensure js is fully loaded. await page .getByLabel(/do you agree to our terms of service and privacy policy/i) .check() @@ -307,6 +310,8 @@ test('shows help texts on entering invalid details on onboarding page after GitH await expect(page).toHaveURL(/\/onboarding\/github/) // we are all set up and ... + + await page.waitForLoadState('networkidle') // ensure js is fully loaded. await page .getByLabel(/do you agree to our terms of service and privacy policy/i) .check()