Skip to content

Commit

Permalink
iOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
mgurgel committed Dec 4, 2024
1 parent e6f01d8 commit 474d406
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 4 deletions.
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.
41 changes: 41 additions & 0 deletions integration-tests/ios.spec-int.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,47 @@ 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();
});

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 },
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion shared/js/browser/macos-communication.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion shared/js/browser/utils/communication-mocks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion shared/js/ui/platform-features.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion v2/data-provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 474d406

Please sign in to comment.