Skip to content

Commit 94ec8fb

Browse files
committed
tests
1 parent cab3682 commit 94ec8fb

1 file changed

Lines changed: 32 additions & 24 deletions

File tree

e2e/about.test.ts

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,42 @@
1-
import { expect, test } from '@playwright/test';
1+
import { test } from '@playwright/test';
2+
import { expectH1AndTitle, expectSections, expectLinks } from './lib/lib';
23

34
test.beforeEach(async ({ page }) => {
45
await page.goto('/about-us');
56
});
67

7-
test.describe('About Page', () => {
8-
test('about page has expected content', async ({ page }) => {
9-
const locators = [
10-
'data-test=about-us-lcl',
11-
'data-test=about-us-mission',
12-
'data-test=about-us-vision',
13-
];
8+
test.describe('About', () => {
9+
test('has expected content', async ({ page }) => {
10+
await expectH1AndTitle({
11+
page,
12+
h1 : "Local Connectivity Lab",
13+
title: "About Us - Seattle Community Network"
14+
});
1415

15-
await expect(page.locator('main h1')).toBeVisible();
16-
await expect(page).toHaveTitle(/about/i);
17-
18-
for (const locator of locators) {
19-
await expect(page.locator(locator)).toBeVisible();
20-
}
16+
await expectSections({
17+
page,
18+
pageName: 'about-us',
19+
sections: [
20+
"lcl",
21+
'mission',
22+
'vision',
23+
'values',
24+
'social'
25+
]
26+
});
2127
});
2228

23-
test('social media links', async ({ page }) => {
24-
const locators = [
25-
'[data-test=about-social] [data-test=social-facebook]',
26-
'[data-test=about-social] [data-test=social-twitter]',
27-
'[data-test=about-social] [data-test=social-instagram]',
28-
];
29-
30-
for (const locator of locators) {
31-
await expect(page.locator(locator)).toBeVisible();
32-
}
29+
test('main CTAs link correctly', async ({ page }) => {
30+
await expectLinks({
31+
page,
32+
pageName: 'about-us',
33+
links: [
34+
{
35+
linkLocator: 'donate-cta',
36+
destLocator: 'h1',
37+
destText : "Make a Donation"
38+
}
39+
]
40+
});
3341
});
3442
});

0 commit comments

Comments
 (0)