-
-
Notifications
You must be signed in to change notification settings - Fork 36.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Convert "Certifications" spec to Playwright (#54965)
Co-authored-by: Huyen Nguyen <25715018+huyenltnguyen@users.noreply.github.com>
- Loading branch information
1 parent
5eb0558
commit 59102f0
Showing
4 changed files
with
47 additions
and
44 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
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
This file was deleted.
Oops, something went wrong.
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,46 @@ | ||
import { execSync } from 'child_process'; | ||
import { expect, test } from '@playwright/test'; | ||
|
||
test.describe('Public profile certifications', () => { | ||
test.use({ storageState: 'playwright/.auth/certified-user.json' }); | ||
test('Should show claimed certifications if the username has all lowercase characters', async ({ | ||
page | ||
}) => { | ||
await page.goto('/certifieduser'); | ||
|
||
// If you build the client locally, delete the button click below. | ||
if (!process.env.CI) { | ||
await page | ||
.getByRole('button', { name: 'Preview custom 404 page' }) | ||
.click(); | ||
} | ||
|
||
await expect(page.getByTestId('claimed-certification')).toHaveCount(19); | ||
}); | ||
|
||
test('Should show claimed certifications if the username includes uppercase characters', async ({ | ||
page | ||
}) => { | ||
await page.goto('/settings'); | ||
await page.getByLabel('Username').fill('CertifiedBoozer'); | ||
await page.getByRole('button', { name: 'Save' }).nth(0).click(); | ||
await expect(page.getByTestId('flash-message')).toContainText( | ||
/We have updated your username to/ | ||
); | ||
await page.goto('/certifiedboozer'); | ||
|
||
// If you build the client locally, delete the button click below. | ||
if (!process.env.CI) { | ||
await page | ||
.getByRole('button', { name: 'Preview custom 404 page' }) | ||
.click(); | ||
} | ||
|
||
await page.waitForURL('/certifiedboozer'); | ||
await expect(page.getByTestId('claimed-certification')).toHaveCount(19); | ||
}); | ||
|
||
test.afterAll(() => { | ||
execSync('node ./tools/scripts/seed/seed-demo-user certified-user'); | ||
}); | ||
}); |