forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexam-survey.spec.ts
38 lines (32 loc) · 1.34 KB
/
exam-survey.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
import { execSync } from 'child_process';
import { test, expect } from '@playwright/test';
const url =
'/learn/foundational-c-sharp-with-microsoft/foundational-c-sharp-with-microsoft-certification-exam/foundational-c-sharp-with-microsoft-certification-exam';
test.describe('Exam Survey', () => {
test.beforeAll(() => {
execSync('node ./tools/scripts/seed/seed-demo-user --certified-user');
execSync('node tools/scripts/seed/seed-surveys.js delete-only');
});
test('Should show the survey alert and be able to complete the survey', async ({
page
}) => {
await page.goto(url);
await expect(page.getByTestId('c-sharp-survey-alert')).toBeVisible();
await page.getByRole('button', { name: 'Take the survey' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await expect(
page.getByRole('heading', {
name: 'Foundational C# with Microsoft Survey'
})
).toBeVisible();
await page.getByText('Student developer').click();
await expect(
page.getByRole('button', { name: 'Submit the survey' })
).toBeDisabled();
await page.getByText('Novice (no prior experience)').click();
await page.getByRole('button', { name: 'Submit the survey' }).click();
await expect(page.getByTestId('flash-message')).toContainText(
/Thank you. Your survey was submitted./
);
});
});