Skip to content

Commit

Permalink
fix: Start at the root page when dealing with tests with toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisblackburn committed Sep 9, 2024
1 parent a99b745 commit cf2bdf4
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions tests/e2e/onboarding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ test('completes onboarding after GitHub OAuth given valid user details', async (
}),
).toBeNull()

await page.goto('/signup')
await page.goto('/')
const navigation = await page.getByRole('navigation')
await navigation.getByRole('button', { name: /start for free/i }).click()
await page.getByRole('button', { name: /signup with github/i }).click()

await expect(page).toHaveURL(/\/onboarding\/github/)
Expand All @@ -187,9 +189,8 @@ test('completes onboarding after GitHub OAuth given valid user details', async (
await createAccountButton.click()

await expect(page).toHaveURL(/dashboard/i)
// eslint-disable-next-line no-warning-comments
// FIXME: Uncomment this when the sonner issue is fixed
// await expect(page.getByText(/thanks for signing up/i)).toBeVisible()

await expect(page.getByText(/thanks for signing up/i)).toBeVisible()

// internally, a user has been created:
await prisma.user.findUniqueOrThrow({
Expand Down Expand Up @@ -252,7 +253,9 @@ test('shows help texts on entering invalid details on onboarding page after GitH
}) => {
const ghUser = await prepareGitHubUser()

await page.goto('/signup')
await page.goto('/')
const navigation = await page.getByRole('navigation')
await navigation.getByRole('button', { name: /start for free/i }).click()
await page.getByRole('button', { name: /signup with github/i }).click()

await expect(page).toHaveURL(/\/onboarding\/github/)
Expand Down Expand Up @@ -330,9 +333,7 @@ test('shows help texts on entering invalid details on onboarding page after GitH
await expect(createAccountButton.getByText('error')).not.toBeAttached()

// ... sign up is successful!
// eslint-disable-next-line no-warning-comments
// FIXME: Uncomment this when the sonner issue is fixed
// await expect(page.getByText(/thanks for signing up/i)).toBeVisible()
await expect(page.getByText(/thanks for signing up/i)).toBeVisible()
})

test('login as existing user', async ({ page, insertNewUser }) => {
Expand Down

0 comments on commit cf2bdf4

Please sign in to comment.