-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from dddsw/updateScreenshotTests
Update playwright tests
- Loading branch information
Showing
55 changed files
with
222 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ node_modules | |
.output | ||
.idea | ||
/test-results | ||
playwright-report |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
npx lint-staged | ||
npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const devicesToTest: [deviceName: string, deviceViewport: string][] = [ | ||
['desktop', 'Desktop Chrome'], | ||
['tablet', 'iPad Mini'], | ||
['mobile', 'iPhone SE'] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const pagesToTest: [pageName: string, path: string][] = [ | ||
['Home', '/'], | ||
['About', 'about'], | ||
['Sponsorship', 'sponsorship'], | ||
['Venue', 'venue'], | ||
['Code of conduct', 'code-of-conduct'], | ||
['Code of conduct (internal)', 'code-of-conduct/internal'], | ||
['New speakers workshop', 'new-speakers-workshop'] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,85 @@ | ||
import { test, expect, devices } from '@playwright/test'; | ||
import { Header } from './page-object/header'; | ||
|
||
test('Clicking nav button displays nav links dropdown', async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
test.describe('Navbar', () => { | ||
let header: Header; | ||
|
||
// Click nav drop down | ||
await page.locator('.main-nav-button').click(); | ||
test.beforeEach(async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
|
||
await expect(page.locator('.nav-link-container')).toBeVisible(); | ||
}); | ||
//Ensure everything has loaded to prevent flakiness | ||
await page.waitForLoadState('networkidle'); | ||
|
||
test('Clicking nav button closes nav links dropdown', async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
header = new Header(page); | ||
}); | ||
|
||
// Click nav drop down | ||
await page.locator('.main-nav-button').click(); | ||
test('Clicking nav button displays nav links dropdown', async () => { | ||
// Click nav drop down | ||
await header.navDropDownButton.click(); | ||
|
||
// Click nav drop down again | ||
await page.locator('.main-nav-button').click(); | ||
await expect(header.navDropDown).toBeVisible(); | ||
}); | ||
|
||
await expect(page.locator('.nav-link-container')).toBeHidden(); | ||
}); | ||
test('Clicking nav button closes nav links dropdown', async () => { | ||
// Click nav drop down | ||
await header.navDropDownButton.click(); | ||
|
||
test('Clicking nav link closes nav links dropdown', async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
// Click nav drop down again | ||
await header.navDropDownButton.click(); | ||
|
||
// Click nav drop down | ||
await page.locator('.main-nav-button').click(); | ||
await expect(header.navDropDown).toBeHidden(); | ||
}); | ||
|
||
// Click a nav link | ||
await page.locator('.nav-link-container a[href="/sponsorship"]').click(); | ||
test('Clicking nav link closes nav links dropdown', async () => { | ||
// Click nav drop down | ||
await header.navDropDownButton.click(); | ||
|
||
await expect(page.locator('.nav-link-container')).toBeHidden(); | ||
}); | ||
// Click a nav link | ||
await header.getNavLinkTo('sponsorship').click(); | ||
|
||
test('Clicking logo closes nav links dropdown', async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
await expect(header.navDropDown).toBeHidden(); | ||
}); | ||
|
||
// Click nav drop down | ||
await page.locator('.main-nav-button').click(); | ||
test('Clicking logo closes nav links dropdown', async () => { | ||
// Click nav drop down | ||
await header.navDropDownButton.click(); | ||
|
||
// Click logo | ||
await page.locator('img[class~="logo"]').click(); | ||
// Click logo | ||
await header.logo.click(); | ||
|
||
await expect(page.locator('.nav-link-container')).toBeHidden(); | ||
}); | ||
await expect(header.navDropDown).toBeHidden(); | ||
}); | ||
|
||
test('Clicking logo does not open nav links dropdown', async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
test('Clicking logo does not open nav links dropdown', async () => { | ||
// Click logo | ||
await header.logo.click(); | ||
|
||
// Click logo | ||
await page.locator('img[class~="logo"]').click(); | ||
await expect(header.navDropDown).toBeHidden(); | ||
}); | ||
|
||
await expect(page.locator('.nav-link-container')).toBeHidden(); | ||
}); | ||
|
||
test('Displays down arrow icon in unexpanded state', async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
test('Displays down arrow icon in unexpanded state', async () => { | ||
await expect(header.navDropDownButton).toContainText('expand_more'); | ||
}); | ||
|
||
await expect(page.locator('.main-nav-button span.icon')).toContainText('expand_more'); | ||
}); | ||
test('Displays up arrow icon in expanded state', async () => { | ||
// Click nav drop down | ||
await header.navDropDownButton.click(); | ||
|
||
test('Displays up arrow icon in expanded state', async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
await expect(header.navDropDownButton).toContainText('expand_less'); | ||
}); | ||
|
||
// Click nav drop down | ||
await page.locator('.main-nav-button').click(); | ||
|
||
await expect(page.locator('.main-nav-button span.icon')).toContainText('expand_less'); | ||
}); | ||
|
||
test('Does not show current route in nav links drop down', async ({ page }) => { | ||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
|
||
// Click nav drop down | ||
await page.locator('.main-nav-button').click(); | ||
|
||
await expect(page.locator('.nav-link-container a[href="/about"]')).toBeHidden(); | ||
}); | ||
test('Does not show current route in nav links drop down', async () => { | ||
// Click nav drop down | ||
await header.navDropDownButton.click(); | ||
|
||
test('Does not show button text in smaller screens', async ({ page }) => { | ||
await page.setViewportSize(devices['iPhone SE'].viewport); | ||
await expect(header.getNavLinkTo('about')).toBeHidden(); | ||
}); | ||
|
||
// Go to about page (to avoid carousel weirdness) | ||
await page.goto('/about'); | ||
test('Does not show button text in smaller screens', async ({ page }) => { | ||
// Set to mobile view | ||
await page.setViewportSize(devices['iPhone SE'].viewport); | ||
|
||
await expect(page.locator('.nav-button-text')).toBeHidden(); | ||
await expect(page.locator('.nav-button-text')).toBeHidden(); | ||
}); | ||
}); |
Oops, something went wrong.