forked from freeCodeCamp/freeCodeCamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdonate-page-donor.spec.ts
59 lines (47 loc) · 1.92 KB
/
donate-page-donor.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
53
54
55
56
57
58
59
import { execSync } from 'child_process';
import { test, expect } from '@playwright/test';
test.describe('Donate page', () => {
test.use({ storageState: 'playwright/.auth/development-user.json' });
test.beforeEach(async ({ page }) => {
execSync('node ./tools/scripts/seed/seed-demo-user --set-true isDonating');
await page.goto('/donate');
});
test.afterAll(() => {
execSync('node ./tools/scripts/seed/seed-demo-user --certified-user');
});
test('should render the donate page correctly', async ({ page }) => {
await expect(
page.getByText('Thank You for Being a Supporter')
).toBeVisible();
await expect(
page.getByText(
'Your contribution will be crucial in creating resources that empower millions of people to learn new skills and support their families.'
)
).toBeVisible();
await expect(
page.getByText(
'If you want to support our charity further, please consider making a one-time donation, sending us a check, or learning about other ways you could support our charity.'
)
).toBeVisible();
await expect(
page.getByRole('link', { name: 'making a one-time donation' })
).toHaveAttribute(
'href',
'https://www.freecodecamp.org/news/how-to-donate-to-free-code-camp/#how-can-i-make-a-one-time-donation'
);
});
test('The menu should have a supporters link', async ({ page }) => {
const menuButton = page.getByTestId('header-menu-button');
const menu = page.getByTestId('header-menu');
await expect(menuButton).toBeVisible();
await menuButton.click();
await expect(menu).toBeVisible();
await expect(page.getByRole('link', { name: 'Supporters' })).toBeVisible();
});
test('The Avatar should have a special border for donors', async ({
page
}) => {
const container = page.locator('.avatar-container');
await expect(container).toHaveClass('avatar-container gold-border');
});
});