Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Screenshots for Release Notes and Special Error #1029

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions packages/special-pages/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,29 @@ export default defineConfig({
'duckplayer.spec.js',
'duckplayer-screenshots.spec.js',
'onboarding.spec.js',
'sslerror.spec.js',
'release-notes.spec.js',
'special-error.spec.js'
'release-notes.screenshots.spec.js',
'special-error.spec.js',
'special-error.screenshots.spec.js'
],
use: {
...devices['Desktop Safari'],
injectName: 'apple',
platform: 'macos'
}
},
{
name: 'ios',
testMatch: [
'special-error.spec.js',
'special-error.screenshots.spec.js'
],
use: {
...devices['iPhone 14 Pro'],
injectName: 'apple',
platform: 'ios'
}
}
// TODO: Add iOS
],
fullyParallel: !process.env.CI,
/* Don't allow `.only` in CI */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class SpecialErrorPage {
*/
async showsAdvancedInfo () {
const { page } = this
await page.getByRole('button', { name: 'Advanced...' }).click()
await page.getByRole('button', { name: 'Advanced' }).click()
const calls = await this.mocks.waitForCallCount({ method: 'advancedInfo', count: 1 })
expect(calls).toMatchObject([
{
Expand Down
44 changes: 44 additions & 0 deletions packages/special-pages/tests/release-notes.screenshots.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { expect, test } from '@playwright/test'
import { ReleaseNotesPage } from './page-objects/release-notes.js'

test.describe('screenshots @screenshots', () => {
test('loading', async ({ page }, workerInfo) => {
const releaseNotes = ReleaseNotesPage.create(page, workerInfo)
await releaseNotes.reducedMotion()
await releaseNotes.openPage({ env: 'app' })
await releaseNotes.releaseNotesLoading()
await expect(page).toHaveScreenshot('loading.png', { maxDiffPixels: 20 })
})

test('release notes without privacy pro', async ({ page }, workerInfo) => {
const releaseNotes = ReleaseNotesPage.create(page, workerInfo)
await releaseNotes.reducedMotion()
await releaseNotes.openPage({ env: 'app' })
await releaseNotes.releaseNotesLoaded()
await expect(page).toHaveScreenshot('loaded.png', { maxDiffPixels: 20 })
})

test('release notes with privacy pro', async ({ page }, workerInfo) => {
const releaseNotes = ReleaseNotesPage.create(page, workerInfo)
await releaseNotes.reducedMotion()
await releaseNotes.openPage({ env: 'app' })
await releaseNotes.releaseNotesLoadedWithPrivacyPro()
await expect(page).toHaveScreenshot('loaded-privacy-pro.png', { maxDiffPixels: 20 })
})

test('update ready without privacy pro', async ({ page }, workerInfo) => {
const releaseNotes = ReleaseNotesPage.create(page, workerInfo)
await releaseNotes.reducedMotion()
await releaseNotes.openPage({ env: 'app' })
await releaseNotes.releaseNotesUpdateReady()
await expect(page).toHaveScreenshot('update-ready.png', { maxDiffPixels: 20 })
})

test('update ready with privacy pro', async ({ page }, workerInfo) => {
const releaseNotes = ReleaseNotesPage.create(page, workerInfo)
await releaseNotes.reducedMotion()
await releaseNotes.openPage({ env: 'app' })
await releaseNotes.releaseNotesUpdateReadyWithPrivacyPro()
await expect(page).toHaveScreenshot('update-ready-privacy-pro.png', { maxDiffPixels: 20 })
})
})
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.
59 changes: 59 additions & 0 deletions packages/special-pages/tests/special-error.screenshots.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { expect, test } from '@playwright/test'
import { SpecialErrorPage } from './page-objects/special-error'

test.describe('screenshots @screenshots', () => {
test('expired certificate', async ({ page }, workerInfo) => {
const errorId = 'ssl.expired'
const errorName = errorId.replace('.', '-')
const { platform } = /** @type {{ platform: 'macos' | 'ios' }} */(workerInfo.project.use)
const special = SpecialErrorPage.create(page, workerInfo)
await special.openPage({ errorId, platformName: platform })
await expect(page).toHaveScreenshot(`${errorName}.png`, { maxDiffPixels: 20 })
await special.showsAdvancedInfo()
await expect(page).toHaveScreenshot(`${errorName}-advanced.png`, { maxDiffPixels: 20 })
})

test('invalid certificate', async ({ page }, workerInfo) => {
const errorId = 'ssl.invalid'
const errorName = errorId.replace('.', '-')
const { platform } = /** @type {{ platform: 'macos' | 'ios' }} */(workerInfo.project.use)
const special = SpecialErrorPage.create(page, workerInfo)
await special.openPage({ errorId, platformName: platform })
await expect(page).toHaveScreenshot(`${errorName}.png`, { maxDiffPixels: 20 })
await special.showsAdvancedInfo()
await expect(page).toHaveScreenshot(`${errorName}-advanced.png`, { maxDiffPixels: 20 })
})

test('self-signed certificate', async ({ page }, workerInfo) => {
const errorId = 'ssl.selfSigned'
const errorName = errorId.replace('.', '-')
const { platform } = /** @type {{ platform: 'macos' | 'ios' }} */(workerInfo.project.use)
const special = SpecialErrorPage.create(page, workerInfo)
await special.openPage({ errorId, platformName: platform })
await expect(page).toHaveScreenshot(`${errorName}.png`, { maxDiffPixels: 20 })
await special.showsAdvancedInfo()
await expect(page).toHaveScreenshot(`${errorName}-advanced.png`, { maxDiffPixels: 20 })
})

test('wrong host', async ({ page }, workerInfo) => {
const errorId = 'ssl.wrongHost'
const errorName = errorId.replace('.', '-')
const { platform } = /** @type {{ platform: 'macos' | 'ios' }} */(workerInfo.project.use)
const special = SpecialErrorPage.create(page, workerInfo)
await special.openPage({ errorId, platformName: platform })
await expect(page).toHaveScreenshot(`${errorName}.png`, { maxDiffPixels: 20 })
await special.showsAdvancedInfo()
await expect(page).toHaveScreenshot(`${errorName}-advanced.png`, { maxDiffPixels: 20 })
})

test('phishing', async ({ page }, workerInfo) => {
const errorId = 'phishing'
const errorName = errorId.replace('.', '-')
const { platform } = /** @type {{ platform: 'macos' | 'ios' }} */(workerInfo.project.use)
const special = SpecialErrorPage.create(page, workerInfo)
await special.openPage({ errorId, platformName: platform })
await expect(page).toHaveScreenshot(`${errorName}.png`, { maxDiffPixels: 20 })
await special.showsAdvancedInfo()
await expect(page).toHaveScreenshot(`${errorName}-advanced.png`, { maxDiffPixels: 20 })
})
})
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.