forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc-sharp.spec.ts
45 lines (37 loc) · 1.35 KB
/
c-sharp.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
import { test, expect } from '@playwright/test';
import translations from '../client/i18n/locales/english/translations.json';
const checkAnswerButtonText = translations.buttons['check-answer'];
const askForHelpButtonText = translations.buttons['ask-for-help'];
const trophyButtonText = translations.buttons['verify-trophy'];
const unlinkAccountButtonText = translations.buttons['unlink-account'];
const challenge =
'/learn/foundational-c-sharp-with-microsoft/write-your-first-code-using-c-sharp/write-your-first-c-sharp-code';
const trophy =
'/learn/foundational-c-sharp-with-microsoft/write-your-first-code-using-c-sharp/trophy-write-your-first-code-using-c-sharp';
test('renders buttons on challenge page', async ({ page }) => {
await page.goto(challenge);
await expect(
page.getByRole('button', { name: checkAnswerButtonText })
).toBeVisible();
await expect(
page.getByRole('button', {
name: askForHelpButtonText
})
).toBeVisible();
});
test('renders buttons on trophy page', async ({ page }) => {
await page.goto(trophy);
await expect(
page.getByRole('button', { name: unlinkAccountButtonText })
).toBeVisible();
await expect(
page.getByRole('button', {
name: trophyButtonText
})
).toBeVisible();
await expect(
page.getByRole('button', {
name: askForHelpButtonText
})
).toBeVisible();
});