diff --git a/integration-tests/DashboardPage.js b/integration-tests/DashboardPage.js index 056019dd..da8b1f75 100644 --- a/integration-tests/DashboardPage.js +++ b/integration-tests/DashboardPage.js @@ -167,6 +167,16 @@ export class DashboardPage { await page.locator('[data-page="connection"]').getByText(text).waitFor(); } + async clickReportAsSafeLink() { + const { page } = this; + await expect(page.getByRole('link', { name: 'Report a site as safe' })).toBeVisible(); + } + + async clickHelpPageLink() { + const { page } = this; + await page.getByRole('link', { name: 'About our phishing and malware protection' }).click() + } + async hasPhishingIcon() { const { page } = this; await expect(page.locator('#key-insight div').nth(1)).toHaveClass(/hero-icon--phishing/); diff --git a/integration-tests/Mocks.js b/integration-tests/Mocks.js index a78b5370..96830e37 100644 --- a/integration-tests/Mocks.js +++ b/integration-tests/Mocks.js @@ -347,14 +347,24 @@ export class Mocks { } async calledForAboutLink() { + return this.calledForOpenURLInNewTab('https://help.duckduckgo.com/duckduckgo-help-pages/privacy/web-tracking-protections/'); + } + + async calledForHelpPagesLink() { + return this.calledForOpenURLInNewTab('https://dub.duckduckgo.com/pages/duckduckgo/mgurgel-help-pages/privacy/phishing-and-malware-protection/'); + } + + async calledForReportAsSafeLink(urlParam) { + return this.calledForOpenURLInNewTab(`https://use-devtesting12.duckduckgo.com/malicious-site-protection/report-error?url=${encodeURIComponent(urlParam)}`); + } + + async calledForOpenURLInNewTab(url) { if (this.platform.name === 'android') { const calls = await this.outgoing({ names: ['openInNewTab'] }); expect(calls).toMatchObject([ [ 'openInNewTab', - JSON.stringify({ - url: 'https://help.duckduckgo.com/duckduckgo-help-pages/privacy/web-tracking-protections/', - }), + JSON.stringify({ url }), ], ]); return; @@ -366,9 +376,7 @@ export class Mocks { expect(calls).toMatchObject([ [ 'privacyDashboardOpenUrlInNewTab', - { - url: 'https://help.duckduckgo.com/duckduckgo-help-pages/privacy/web-tracking-protections/', - }, + { url }, ], ]); return; diff --git a/integration-tests/macos.spec-int.js b/integration-tests/macos.spec-int.js index db74489a..9411a0bf 100644 --- a/integration-tests/macos.spec-int.js +++ b/integration-tests/macos.spec-int.js @@ -34,28 +34,45 @@ test('invalid/missing certificate', { tag: '@screenshots' }, async ({ page }) => await dash.showsInvalidCertDetail(); }); -test('phishing warning', { tag: '@screenshots' }, async ({ page }) => { - /** @type {DashboardPage} */ - const dash = await DashboardPage.webkit(page, { platform: 'macos' }); - await dash.addState([testDataStates.phishing]); - await dash.screenshot('phishing-warning.png'); - await dash.hasPhishingIcon(); - await dash.hasPhishingHeadingText(); - await dash.hasPhishingWarningText(); - await dash.hasPhishingStatusText(); - await dash.connectionLinkDoesntShow(); -}); +test.describe('phishing & malware protection', () => { + test('phishing warning', { tag: '@screenshots' }, async ({ page }) => { + /** @type {DashboardPage} */ + const dash = await DashboardPage.webkit(page, { platform: 'macos' }); + await dash.addState([testDataStates.phishing]); + await dash.screenshot('phishing-warning.png'); + await dash.hasPhishingIcon(); + await dash.hasPhishingHeadingText(); + await dash.hasPhishingWarningText(); + await dash.hasPhishingStatusText(); + await dash.connectionLinkDoesntShow(); + }); + + test('malware warning', { tag: '@screenshots' }, async ({ page }) => { + /** @type {DashboardPage} */ + const dash = await DashboardPage.webkit(page, { platform: 'macos' }); + await dash.addState([testDataStates.malware]); + await dash.screenshot('malware-warning.png'); + await dash.hasMalwareIcon(); + await dash.hasMalwareHeadingText(); + await dash.hasMalwareWarningText(); + await dash.hasMalwareStatusText(); + await dash.connectionLinkDoesntShow(); + }); -test('malware warning', { tag: '@screenshots' }, async ({ page }) => { - /** @type {DashboardPage} */ - const dash = await DashboardPage.webkit(page, { platform: 'macos' }); - await dash.addState([testDataStates.malware]); - await dash.screenshot('malware-warning.png'); - await dash.hasMalwareIcon(); - await dash.hasMalwareHeadingText(); - await dash.hasMalwareWarningText(); - await dash.hasMalwareStatusText(); - await dash.connectionLinkDoesntShow(); + test('shows report as safe link', async ({ page }) => { + /** @type {DashboardPage} */ + const dash = await DashboardPage.webkit(page, { platform: 'macos' }); + await dash.addState([testDataStates.malware]); + await dash.clickReportAsSafeLink(); + }); + + test('shows help page link', async ({ page }) => { + /** @type {DashboardPage} */ + const dash = await DashboardPage.webkit(page, { platform: 'macos' }); + await dash.addState([testDataStates.malware]); + await dash.clickHelpPageLink(); + await dash.mocks.calledForHelpPagesLink(); + }); }); test('insecure certificate', async ({ page }) => { diff --git a/integration-tests/macos.spec-int.js-snapshots/malware-warning-macos-darwin.png b/integration-tests/macos.spec-int.js-snapshots/malware-warning-macos-darwin.png index 2733858d..af00ed70 100644 Binary files a/integration-tests/macos.spec-int.js-snapshots/malware-warning-macos-darwin.png and b/integration-tests/macos.spec-int.js-snapshots/malware-warning-macos-darwin.png differ