From abc1ba00a894504b0671063e12b0826d38f63538 Mon Sep 17 00:00:00 2001 From: Marcos Gurgel Date: Thu, 30 Jan 2025 19:17:22 +0000 Subject: [PATCH] Tab title fix --- .../special-error/app/components/App.jsx | 4 ++-- .../integration-tests/special-error.js | 24 +++++++++++++++++++ .../public/locales/en/special-error.json | 8 +++++++ 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/special-pages/pages/special-error/app/components/App.jsx b/special-pages/pages/special-error/app/components/App.jsx index 39d0f0119..68b19954b 100644 --- a/special-pages/pages/special-error/app/components/App.jsx +++ b/special-pages/pages/special-error/app/components/App.jsx @@ -34,10 +34,10 @@ function PageTitle() { useEffect(() => { switch (kind) { case 'malware': - document.title = t('malwarePageHeading'); + document.title = t('malwareTabTitle'); break; case 'phishing': - document.title = t('phishingPageHeading'); + document.title = t('phishingTabTitle'); break; default: document.title = t('sslPageHeading'); diff --git a/special-pages/pages/special-error/integration-tests/special-error.js b/special-pages/pages/special-error/integration-tests/special-error.js index 83b1697e9..65a352607 100644 --- a/special-pages/pages/special-error/integration-tests/special-error.js +++ b/special-pages/pages/special-error/integration-tests/special-error.js @@ -150,6 +150,10 @@ export class SpecialErrorPage { async showsExpiredPage() { const { page } = this; + + const title = await page.locator('title').textContent(); + expect(title).toBe('Warning: This site may be insecure'); + await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible(); await expect( page.getByText( @@ -174,6 +178,10 @@ export class SpecialErrorPage { async showsInvalidPage() { const { page } = this; + + const title = await page.locator('title').textContent(); + expect(title).toBe('Warning: This site may be insecure'); + await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible(); await expect( page.getByText( @@ -193,6 +201,10 @@ export class SpecialErrorPage { async showsSelfSignedPage() { const { page } = this; + + const title = await page.locator('title').textContent(); + expect(title).toBe('Warning: This site may be insecure'); + await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible(); await expect( page.getByText( @@ -212,6 +224,10 @@ export class SpecialErrorPage { async showsWrongHostPage() { const { page } = this; + + const title = await page.locator('title').textContent(); + expect(title).toBe('Warning: This site may be insecure'); + await expect(page.getByText('Warning: This site may be insecure', { exact: true })).toBeVisible(); await expect( page.getByText( @@ -231,6 +247,10 @@ export class SpecialErrorPage { async showsPhishingPage() { const { page } = this; + + const title = await page.locator('title').textContent(); + expect(title).toBe('Warning: Security Risk'); + await expect(page.getByText('Warning: This site may be a security risk', { exact: true })).toBeVisible(); await expect( page.getByText( @@ -249,6 +269,10 @@ export class SpecialErrorPage { async showsMalwarePage() { const { page } = this; + + const title = await page.locator('title').textContent(); + expect(title).toBe('Warning: Security Risk'); + await expect(page.getByText('Warning: This site may be a security risk', { exact: true })).toBeVisible(); await expect( page.getByText( diff --git a/special-pages/pages/special-error/public/locales/en/special-error.json b/special-pages/pages/special-error/public/locales/en/special-error.json index 92bbaffb1..0eb4d4e2a 100644 --- a/special-pages/pages/special-error/public/locales/en/special-error.json +++ b/special-pages/pages/special-error/public/locales/en/special-error.json @@ -29,6 +29,10 @@ "title": "Warning: This site may be a security risk", "note": "Title shown in an error page that warn users of security risks on a website due to malware distribution" }, + "malwareTabTitle": { + "title": "Warning: Security Risk", + "note": "Title shown in the browser window or tab when the current page may be a security risk due to malware" + }, "malwareWarningText": { "title": "DuckDuckGo blocked this page because it may be distributing malware designed to compromise your device or steal your personal information. Learn more", "note": "Error description shown in an error page that warns users of security risks on a website due to malware distribution." @@ -41,6 +45,10 @@ "title": "Warning: This site may be a security risk", "note": "Title shown in an error page that warn users of security risks on a website due to Phishing issues" }, + "phishingTabTitle": { + "title": "Warning: Security Risk", + "note": "Title shown in the browser window or tab when the current page may be a security risk due to phishing" + }, "phishingWarningText": { "title": "This website may be impersonating a legitimate site in order to trick you into providing personal information, such as passwords or credit card numbers. Learn more", "note": "Error description shown in an error page that warns users of security risks on a website due to Phishing issues."