-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added e2e test for pending verification
- Loading branch information
Showing
2 changed files
with
86 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
apps/jetstream-e2e/src/tests/authentication/login3.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { expect, test } from '../../fixtures/fixtures'; | ||
|
||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/'); | ||
}); | ||
|
||
test.describe.configure({ mode: 'parallel' }); | ||
|
||
// Reset storage state for this file to avoid being authenticated | ||
test.use({ storageState: { cookies: [], origins: [] } }); | ||
|
||
test.describe('Login 3', () => { | ||
test('Pending Email Verification should not allow any other activity', async ({ page, authenticationPage, apiRequestUtils }) => { | ||
const { email, password } = await test.step('Sign up without email verification', async () => { | ||
return await authenticationPage.signUpWithoutEmailVerification(); | ||
}); | ||
|
||
await test.step('Ensure clicking login shows email verification', async () => { | ||
await page.goto('/'); | ||
await expect(authenticationPage.signInFromHomePageButton).toBeVisible(); | ||
await authenticationPage.signInFromHomePageButton.click(); | ||
await expect(page.getByText('Verify your email address')).toBeVisible(); | ||
}); | ||
|
||
await test.step('Ensure clicking sign up shows email verification', async () => { | ||
await page.goto('/'); | ||
await expect(authenticationPage.signUpFromHomePageButton).toBeVisible(); | ||
await authenticationPage.signUpFromHomePageButton.click(); | ||
await expect(page.getByText('Verify your email address')).toBeVisible(); | ||
}); | ||
|
||
await test.step('Ensure clicking sign up from CTA shows email verification', async () => { | ||
await page.goto('/'); | ||
await expect(authenticationPage.signUpCtaFromHomePageButton).toBeVisible(); | ||
await authenticationPage.signUpCtaFromHomePageButton.click(); | ||
await expect(page.getByText('Verify your email address')).toBeVisible(); | ||
}); | ||
|
||
await test.step('Ensure authenticated API fails prior to email verification', async () => { | ||
const response = await apiRequestUtils.makeRequestRaw('GET', '/api/me', { Accept: 'application/json' }); | ||
await expect(response.status()).toBe(401); | ||
}); | ||
|
||
await test.step('Verify email and ensure we can make an authenticated API request', async () => { | ||
await authenticationPage.verifyEmail(email); | ||
const response = await apiRequestUtils.makeRequestRaw('GET', '/api/me', { Accept: 'application/json' }); | ||
await expect(response.status()).toBe(200); | ||
}); | ||
}); | ||
}); |