forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathedit-profile-modal.spec.ts
52 lines (47 loc) · 1.64 KB
/
edit-profile-modal.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import { test, expect } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
test.beforeEach(async ({ page }) => {
await page.goto('/certifieduser');
if (!process.env.CI) {
await page.getByRole('button', { name: 'Preview custom 404 page' }).click();
}
await page.getByRole('button', { name: 'Edit my profile' }).click();
});
test('edit profile modal should render correctly', async ({ page }) => {
// Internet Presence
await expect(
page.getByRole('heading', {
name: translations.settings.headings.internet
})
).toBeVisible();
await expect(page.getByTestId('internet-presence')).toBeVisible();
await expect(
page.getByRole('button', {
name: translations.settings.headings.internet
})
).toBeVisible();
// Personal Information
await expect(
page.getByRole('heading', {
name: translations.settings.headings['personal-info']
})
).toBeVisible();
await expect(page.getByTestId('camper-identity')).toBeVisible();
const savePersonalInfoButton = page.getByRole('button', {
name: translations.settings.headings['personal-info']
});
await expect(savePersonalInfoButton).toBeVisible();
await expect(savePersonalInfoButton).toBeDisabled();
await expect(
page.getByLabel(translations.settings.labels.name, { exact: true })
).toHaveValue('Full Stack User');
await expect(
page.getByLabel(translations.settings.labels.location)
).toHaveValue('');
await expect(
page.getByLabel(translations.settings.labels.picture)
).toHaveValue('');
await expect(page.getByLabel(translations.settings.labels.about)).toHaveValue(
''
);
});