Skip to content
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

feat: Convert "Certifications" spec to Playwright #54965

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function CertButton({ username, cert }: CertButtonProps): JSX.Element {
<Link
className='btn btn-lg btn-primary btn-block'
to={`/certification/${username}/${cert.certSlug}`}
data-cy='claimed-certification'
data-playwright-test-label='claimed-certification'
>
{t('buttons.view-cert-title', {
certTitle: t(`certification.title.${cert.certSlug}`)
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/settings/username.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class UsernameSettings extends Component<UsernameProps, UsernameState> {
name='username-settings'
onChange={this.handleChange}
value={formValue}
data-cy='username-input'
data-playwright-test-label='username-input'
id='username-settings'
/>
</FormGroup>
Expand Down
42 changes: 0 additions & 42 deletions cypress/e2e/default/user/certifications.ts

This file was deleted.

46 changes: 46 additions & 0 deletions e2e/cert-username-case-navigation.spec.ts
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.getByTestId('username-input').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');
});
});
Loading