Skip to content

Commit 14b297a

Browse files
committed
Update YouTube feature description for ad blocking experiment
1 parent ce153da commit 14b297a

File tree

5 files changed

+52
-4
lines changed

5 files changed

+52
-4
lines changed

special-pages/pages/onboarding/app/components/v3/ComparisonTable.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { h } from 'preact';
22
import cn from 'classnames';
33
import { comparisonTableData, tableIconPrefix } from './data-comparison-table';
44
import { useTypedTranslation } from '../../types';
5+
import { useGlobalState } from '../../global';
56

67
import styles from './ComparisonTable.module.css';
78

@@ -69,7 +70,11 @@ export function ComparisonTableRow({ icon, title, statuses }) {
6970

7071
export function ComparisonTable() {
7172
const { t } = useTypedTranslation();
72-
const tableData = comparisonTableData(t);
73+
const state = useGlobalState();
74+
75+
const systemSettingsStep = /** @type {import('../../types').SystemSettingsStep|undefined} */ (state.stepDefinitions.systemSettings);
76+
const adBlockingEnabled = systemSettingsStep?.rows?.some((row) => row === 'ad-blocking' || row === 'youtube-ad-blocking') ?? false;
77+
const tableData = comparisonTableData(t, adBlockingEnabled);
7378

7479
return (
7580
<table className={styles.table}>

special-pages/pages/onboarding/app/components/v3/data-comparison-table.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export const tableIconPrefix = 'assets/img/steps/v3/';
2020
*
2121
* Safari was removed from the latest comparison table layout. Keeping it the data just in case it comes back.
2222
*
23-
* @type {(t: ReturnType<typeof import('../../types')['useTypedTranslation']>['t']) => FeatureSupportData[]} */
24-
export const comparisonTableData = (t) => [
23+
* @type {(t: ReturnType<typeof import('../../types')['useTypedTranslation']>['t'], adBlockingEnabled?: boolean) => FeatureSupportData[]} */
24+
export const comparisonTableData = (t, adBlockingEnabled = false) => [
2525
{
2626
icon: 'search.svg',
2727
title: t('comparison_searchPrivately'),
@@ -69,7 +69,7 @@ export const comparisonTableData = (t) => [
6969
},
7070
{
7171
icon: 'video-player.svg',
72-
title: t('comparison_privateYoutube'),
72+
title: adBlockingEnabled ? t('comparison_youtubeAdFree') : t('comparison_privateYoutube'),
7373
statuses: {
7474
chrome: SupportStatus.NOT_SUPPORTED,
7575
safari: SupportStatus.NOT_SUPPORTED,

special-pages/pages/onboarding/integration-tests/onboarding.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,14 @@ export class OnboardingPage {
160160
await this.page.getByRole('button', { name: 'Skip' }).click();
161161
}
162162

163+
/**
164+
* @param {boolean} adBlockingEnabled
165+
*/
166+
async checkYouTubeText(adBlockingEnabled) {
167+
const expectedText = adBlockingEnabled ? 'Watch YouTube ad-free' : 'Play YouTube without targeted ads';
168+
await expect(this.page.getByRole('table')).toContainText(expectedText);
169+
}
170+
163171
async makeDefault() {
164172
const { page } = this;
165173
await page.getByRole('button', { name: 'Make Default' }).click();

special-pages/pages/onboarding/integration-tests/onboarding.spec.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,37 @@ test.describe('onboarding', () => {
3131
await onboarding.openPage({ env: 'app', page: 'welcome', willThrow: true });
3232
await onboarding.handlesFatalException();
3333
});
34+
test.describe('Given I am on the make default step', () => {
35+
test('Then "Watch YouTube ad-free" appears when ad blocking is enabled', async ({ page }, workerInfo) => {
36+
const onboarding = OnboardingPage.create(page, workerInfo);
37+
onboarding.withInitData({
38+
stepDefinitions: {
39+
systemSettings: {
40+
rows: ['dock', 'ad-blocking', 'import'],
41+
},
42+
},
43+
order: 'v3',
44+
});
45+
await onboarding.reducedMotion();
46+
await onboarding.openPage({ env: 'app', page: 'makeDefaultSingle' });
47+
await onboarding.checkYouTubeText(true);
48+
});
49+
50+
test('Then "Play YouTube without targeted ads" appears when ad blocking is not enabled', async ({ page }, workerInfo) => {
51+
const onboarding = OnboardingPage.create(page, workerInfo);
52+
onboarding.withInitData({
53+
stepDefinitions: {
54+
systemSettings: {
55+
rows: ['dock', 'import'],
56+
},
57+
},
58+
order: 'v3',
59+
});
60+
await onboarding.reducedMotion();
61+
await onboarding.openPage({ env: 'app', page: 'makeDefaultSingle' });
62+
await onboarding.checkYouTubeText(false);
63+
});
64+
});
3465
test.describe('Given I am on the summary step', () => {
3566
test('Then I can exit to search', async ({ page }, workerInfo) => {
3667
const onboarding = OnboardingPage.create(page, workerInfo);

special-pages/pages/onboarding/public/locales/en/onboarding.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,10 @@
401401
"title": "Play YouTube without targeted ads",
402402
"note": "The description of a browser privacy feature in the comparison table."
403403
},
404+
"comparison_youtubeAdFree": {
405+
"title": "Watch YouTube ad-free",
406+
"note": "The description of a browser privacy feature in the comparison table when ad-blocking is enabled."
407+
},
404408
"comparison_fullSupport": {
405409
"title": "Significant protection",
406410
"note": "The level of protection offered by a browser on a specific feature in the comparison table."

0 commit comments

Comments
 (0)