-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupport-us.spec.ts
39 lines (35 loc) · 1.33 KB
/
support-us.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
import { expect, test } from '@playwright/test';
test.beforeEach(async ({ page }) => {
await page.goto('/support-us');
});
test('support-us page screenshot', async ({ page }) => {
await page.getByRole('contentinfo').scrollIntoViewIfNeeded();
await expect(page).toHaveScreenshot({ fullPage: true });
});
test('Expanding Fördermitglieder', async ({ page }) => {
await page.getByRole('button', { name: 'Mehr' }).click();
await expect(page.getByTestId('benefits')).toHaveScreenshot();
await page.getByRole('button', { name: 'Weniger' }).click();
});
test.describe('Donation method details', () => {
for (const method of ['Partner werden', 'Geld spenden', 'Expertise Spenden', 'Sachspenden']) {
test(`Expanding '${method}'`, async ({ isMobile, page }) => {
const element = page.getByRole(isMobile ? 'button' : 'tab', {
name: new RegExp(method),
});
await element.click();
let targetElement;
if (isMobile) {
// TODO: Find a better accessor
targetElement = page.getByTitle(method);
} else {
targetElement = page.getByRole('tabpanel');
}
// for some reason the image of Sachspenden is slightly offset on Firefox in the screenshot
await expect(targetElement).toHaveScreenshot({
maxDiffPixelRatio: 0.05,
maxDiffPixels: 15000,
});
});
}
});