|
1 | | -import { expect, test } from '@playwright/test'; |
| 1 | +import { test } from '@playwright/test'; |
| 2 | +import { expectH1AndTitle, expectSections, expectLinks } from './lib/lib'; |
2 | 3 |
|
3 | 4 | test.beforeEach(async ({ page }) => { |
4 | 5 | await page.goto('/about-us'); |
5 | 6 | }); |
6 | 7 |
|
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 | + }); |
14 | 15 |
|
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 | + }); |
21 | 27 | }); |
22 | 28 |
|
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 | + }); |
33 | 41 | }); |
34 | 42 | }); |
0 commit comments