-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add e2e test suite #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f5171e6
17e7b7a
846b120
90a4bbb
3577acf
2614598
16b8bf3
f369733
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -46,3 +46,4 @@ contracts/out/ | |
|
|
||
| # Sentry Config File | ||
| .env.sentry-build-plugin | ||
| .auth | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { test as setup, expect } from '@playwright/test'; | ||
| import fs from 'node:fs/promises'; | ||
| import path from 'node:path'; | ||
| import { STORAGE_STATE, type Role } from './roles.ts'; | ||
| import { resetBillingState } from './billing-reset.ts'; | ||
|
|
||
| const roles: ReadonlyArray<{ | ||
| name: Role; | ||
| email: string; | ||
| password: string; | ||
| userId: string; | ||
| }> = [ | ||
| { | ||
| name: 'paid', | ||
| email: process.env.E2E_PAID_EMAIL!, | ||
| password: process.env.E2E_PAID_PASSWORD!, | ||
| userId: process.env.E2E_PAID_USER_ID!, | ||
| }, | ||
| { | ||
| name: 'unpaid', | ||
| email: process.env.E2E_UNPAID_EMAIL!, | ||
| password: process.env.E2E_UNPAID_PASSWORD!, | ||
| userId: process.env.E2E_UNPAID_USER_ID!, | ||
| }, | ||
| { | ||
| name: 'trial', | ||
| email: process.env.E2E_TRIAL_EMAIL!, | ||
| password: process.env.E2E_TRIAL_PASSWORD!, | ||
| userId: process.env.E2E_TRIAL_USER_ID!, | ||
| }, | ||
| ]; | ||
|
|
||
| for (const role of roles) { | ||
| setup(`authenticate as ${role.name}`, async ({ page }) => { | ||
| // Re-seed the BillingTable record so dashboard tests see deterministic | ||
| // state. Trial periods elapse and `past_due` can advance to `canceled` | ||
| // between scheduled runs, so the prior run's state is not safe to reuse. | ||
| await resetBillingState(role.name, role.userId); | ||
|
|
||
| await page.goto('/'); | ||
| await page.getByRole('textbox', { name: 'Email address' }).fill(role.email); | ||
| await page.getByRole('textbox', { name: 'Password' }).fill(role.password); | ||
| await page.getByRole('button', { name: 'Continue', exact: true }).click(); | ||
|
|
||
| await expect(page).toHaveURL(/\/dashboard$/); | ||
|
|
||
| const storagePath = STORAGE_STATE[role.name]; | ||
| await fs.mkdir(path.dirname(storagePath), { recursive: true }); | ||
| await page.context().storageState({ path: storagePath }); | ||
| await page.context().storageState({ path: STORAGE_STATE[role.name] }); | ||
|
Comment on lines
+47
to
+50
|
||
| }); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence is missing a subject (reads like a fragment). Consider rewriting to a complete sentence (e.g.,
The repo includes a Playwright end-to-end test suite...) for clarity.