diff --git a/integration-tests/ios.spec-int.js b/integration-tests/ios.spec-int.js index d9b7e014..a687cde9 100644 --- a/integration-tests/ios.spec-int.js +++ b/integration-tests/ios.spec-int.js @@ -226,6 +226,7 @@ test.describe('temporary reporting flows', () => { await dash.mocks.calledForAlert('missingDescription'); }); }); + test('opens to category selection from primary screen when breakageScreen param is present', async ({ page }) => { const dash = await DashboardPage.webkit(page, { breakageScreen: 'categorySelection', platform: 'ios' }); await dash.reducedMotion(); @@ -271,6 +272,48 @@ test.describe('temporary reporting flows', () => { }); }); +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('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(); + await dash.mocks.calledForReportAsSafeLink('https://privacy-test-pages.site/security/badware/malware.html'); + }); + + 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.describe('screenshots', { tag: '@screenshots' }, () => { const states = [ { name: '01', state: testDataStates.protectionsOn }, diff --git a/integration-tests/ios.spec-int.js-snapshots/malware-warning-ios-darwin.png b/integration-tests/ios.spec-int.js-snapshots/malware-warning-ios-darwin.png new file mode 100644 index 00000000..c94a26f2 Binary files /dev/null and b/integration-tests/ios.spec-int.js-snapshots/malware-warning-ios-darwin.png differ diff --git a/integration-tests/ios.spec-int.js-snapshots/phishing-warning-ios-darwin.png b/integration-tests/ios.spec-int.js-snapshots/phishing-warning-ios-darwin.png new file mode 100644 index 00000000..4b226bd8 Binary files /dev/null and b/integration-tests/ios.spec-int.js-snapshots/phishing-warning-ios-darwin.png differ diff --git a/shared/js/browser/macos-communication.js b/shared/js/browser/macos-communication.js index fbb05a9b..2f459f44 100644 --- a/shared/js/browser/macos-communication.js +++ b/shared/js/browser/macos-communication.js @@ -89,7 +89,7 @@ const resolveInitialRender = function () { const isIsProtectedSet = typeof protections !== 'undefined'; const isTrackerBlockingDataSet = typeof trackerBlockingData === 'object'; const isLocaleSet = typeof locale === 'string'; - const isMaliciousSiteSet = isIOS() || (maliciousSiteStatus && maliciousSiteStatus.kind !== undefined); + const isMaliciousSiteSet = maliciousSiteStatus && maliciousSiteStatus.kind !== undefined; if (!isLocaleSet || !isUpgradedHttpsSet || !isIsProtectedSet || !isTrackerBlockingDataSet || !isMaliciousSiteSet) { return; } diff --git a/shared/js/browser/utils/communication-mocks.mjs b/shared/js/browser/utils/communication-mocks.mjs index 2567b697..0ce9ef81 100644 --- a/shared/js/browser/utils/communication-mocks.mjs +++ b/shared/js/browser/utils/communication-mocks.mjs @@ -50,7 +50,7 @@ export async function mockDataProvider(params) { window.onChangeLocale?.(state.localeSettings); window.onChangeRequestData(state.url, { requests: state.requests || [] }); - if (platform?.name === 'macos') { + if (platform?.name === 'macos' || platform?.name === 'ios') { window.onChangeMaliciousSiteStatus?.(state.maliciousSiteStatus); } } diff --git a/shared/js/ui/platform-features.mjs b/shared/js/ui/platform-features.mjs index f47d74b2..3300b4ee 100644 --- a/shared/js/ui/platform-features.mjs +++ b/shared/js/ui/platform-features.mjs @@ -82,7 +82,7 @@ export function createPlatformFeatures(platform) { initialScreen: screen, opener, supportsInvalidCertsImplicitly: platform.name !== 'browser' && platform.name !== 'windows', - supportsMaliciousSiteWarning: platform.name === 'macos', + supportsMaliciousSiteWarning: platform.name === 'macos' || platform.name === 'ios', includeToggleOnBreakageForm, breakageScreen, randomisedCategories, diff --git a/v2/data-provider.js b/v2/data-provider.js index 5959744e..7e368c87 100644 --- a/v2/data-provider.js +++ b/v2/data-provider.js @@ -176,7 +176,7 @@ export class DataChannel extends EventTarget { /** @type {import('../shared/js/ui/models/site.js').PublicSiteModel['httpsState']} */ const nextState = (() => { - if (this.features.supportsMaliciousSiteWarning && this.tab.maliciousSiteStatus) { + if (this.features.supportsMaliciousSiteWarning && typeof this.tab.maliciousSiteStatus === 'object') { const { kind } = this.tab.maliciousSiteStatus; if (kind === 'phishing' || kind === 'malware') { return kind;