|
| 1 | +/* global process */ |
| 2 | +import { expect, test } from '@playwright/test'; |
| 3 | +import { SpecialErrorPage } from './special-error'; |
| 4 | + |
| 5 | +const maxDiffPixels = 20; |
| 6 | + |
| 7 | +test.describe('screenshots @screenshots', () => { |
| 8 | + test.skip(process.env.CI === 'true'); |
| 9 | + |
| 10 | + test('SSL expired cert error', async ({ page }, workerInfo) => { |
| 11 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 12 | + await special.openPage({ errorId: 'ssl.expired' }); |
| 13 | + await expect(page).toHaveScreenshot('ssl-expired-cert.png', { maxDiffPixels }); |
| 14 | + }); |
| 15 | + |
| 16 | + test('SSL expired cert error with advanced info', async ({ page }, workerInfo) => { |
| 17 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 18 | + await special.openPage({ errorId: 'ssl.expired' }); |
| 19 | + await special.showsAdvancedInfo(); |
| 20 | + await expect(page).toHaveScreenshot('ssl-expired-cert-advanced.png', { maxDiffPixels }); |
| 21 | + }); |
| 22 | + |
| 23 | + test('SSL expired cert error in Polish', async ({ page }, workerInfo) => { |
| 24 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 25 | + await special.openPage({ errorId: 'ssl.expired', locale: 'pl' }); |
| 26 | + await expect(page).toHaveScreenshot('ssl-expired-cert-pl.png', { maxDiffPixels }); |
| 27 | + }); |
| 28 | + |
| 29 | + test('SSL expired cert error with reduced motion', async ({ page }, workerInfo) => { |
| 30 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 31 | + await special.reducedMotion(); |
| 32 | + await special.openPage({ errorId: 'ssl.expired' }); |
| 33 | + await special.showsAdvancedInfo(); |
| 34 | + await expect(page).toHaveScreenshot('ssl-expired-cert-reduced-motion.png', { maxDiffPixels }); |
| 35 | + }); |
| 36 | + |
| 37 | + test('SSL invalid cert error', async ({ page }, workerInfo) => { |
| 38 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 39 | + await special.openPage({ errorId: 'ssl.invalid' }); |
| 40 | + await expect(page).toHaveScreenshot('ssl-invalid-cert.png', { maxDiffPixels }); |
| 41 | + }); |
| 42 | + |
| 43 | + test('SSL invalid cert error in Dutch', async ({ page }, workerInfo) => { |
| 44 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 45 | + await special.openPage({ errorId: 'ssl.invalid', locale: 'nl' }); |
| 46 | + await expect(page).toHaveScreenshot('ssl-invalid-cert-nl.png', { maxDiffPixels }); |
| 47 | + }); |
| 48 | + |
| 49 | + test('SSL self signed cert error', async ({ page }, workerInfo) => { |
| 50 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 51 | + await special.openPage({ errorId: 'ssl.selfSigned' }); |
| 52 | + await expect(page).toHaveScreenshot('ssl-self-signed-cert.png', { maxDiffPixels }); |
| 53 | + }); |
| 54 | + |
| 55 | + test('SSL self signed cert error in Spanish', async ({ page }, workerInfo) => { |
| 56 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 57 | + await special.openPage({ errorId: 'ssl.selfSigned', locale: 'es' }); |
| 58 | + await expect(page).toHaveScreenshot('ssl-self-signed-cert-es.png', { maxDiffPixels }); |
| 59 | + }); |
| 60 | + |
| 61 | + test('SSL wrong host error', async ({ page }, workerInfo) => { |
| 62 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 63 | + await special.openPage({ errorId: 'ssl.wrongHost' }); |
| 64 | + await expect(page).toHaveScreenshot('ssl-wrong-host.png', { maxDiffPixels }); |
| 65 | + }); |
| 66 | + |
| 67 | + test('SSL wrong host error in Romanian', async ({ page }, workerInfo) => { |
| 68 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 69 | + await special.openPage({ errorId: 'ssl.wrongHost', locale: 'ro' }); |
| 70 | + await expect(page).toHaveScreenshot('ssl-wrong-host-ro.png', { maxDiffPixels }); |
| 71 | + }); |
| 72 | + |
| 73 | + test('Phishing warning', async ({ page }, workerInfo) => { |
| 74 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 75 | + await special.openPage({ errorId: 'phishing' }); |
| 76 | + await expect(page).toHaveScreenshot('phishing-warning.png', { maxDiffPixels }); |
| 77 | + }); |
| 78 | + |
| 79 | + test('Phishing warning with advanced info', async ({ page }, workerInfo) => { |
| 80 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 81 | + await special.openPage({ errorId: 'phishing' }); |
| 82 | + await special.showsAdvancedInfo(); |
| 83 | + await expect(page).toHaveScreenshot('phishing-warning-advanced.png', { maxDiffPixels }); |
| 84 | + }); |
| 85 | + |
| 86 | + test('Phishing warning with reduced motion', async ({ page }, workerInfo) => { |
| 87 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 88 | + await special.reducedMotion(); |
| 89 | + await special.openPage({ errorId: 'phishing' }); |
| 90 | + await special.showsAdvancedInfo(); |
| 91 | + await expect(page).toHaveScreenshot('phishing-warning-advanced.png', { maxDiffPixels }); |
| 92 | + }); |
| 93 | + |
| 94 | + test('Phishing warning in Portuguese', async ({ page }, workerInfo) => { |
| 95 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 96 | + await special.openPage({ errorId: 'phishing', locale: 'pt' }); |
| 97 | + await expect(page).toHaveScreenshot('phishing-warning-pt.png', { maxDiffPixels }); |
| 98 | + }); |
| 99 | + |
| 100 | + test('Phishing warning with advanced info in Bulgarian', async ({ page }, workerInfo) => { |
| 101 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 102 | + await special.openPage({ errorId: 'phishing', locale: 'bg' }); |
| 103 | + await special.showsAdvancedInfo('Разширени'); |
| 104 | + await expect(page).toHaveScreenshot('phishing-warning-advanced-bg.png', { maxDiffPixels }); |
| 105 | + }); |
| 106 | + |
| 107 | + test('Malware warning', async ({ page }, workerInfo) => { |
| 108 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 109 | + await special.openPage({ errorId: 'malware' }); |
| 110 | + await expect(page).toHaveScreenshot('malware-warning.png', { maxDiffPixels }); |
| 111 | + }); |
| 112 | + |
| 113 | + test('Malware warning with advanced info', async ({ page }, workerInfo) => { |
| 114 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 115 | + await special.openPage({ errorId: 'malware' }); |
| 116 | + await special.showsAdvancedInfo(); |
| 117 | + await expect(page).toHaveScreenshot('malware-warning-advanced.png', { maxDiffPixels }); |
| 118 | + }); |
| 119 | + |
| 120 | + test('Malware warning in Russian', async ({ page }, workerInfo) => { |
| 121 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 122 | + await special.openPage({ errorId: 'malware', locale: 'ru' }); |
| 123 | + await expect(page).toHaveScreenshot('malware-warning-ru.png', { maxDiffPixels }); |
| 124 | + }); |
| 125 | + |
| 126 | + test('Malware warning with advanced info in German', async ({ page }, workerInfo) => { |
| 127 | + const special = SpecialErrorPage.create(page, workerInfo); |
| 128 | + await special.openPage({ errorId: 'malware', locale: 'de' }); |
| 129 | + await special.showsAdvancedInfo('Erweitert'); |
| 130 | + await expect(page).toHaveScreenshot('malware-warning-advanced-de.png', { maxDiffPixels }); |
| 131 | + }); |
| 132 | +}); |
0 commit comments