Skip to content

Commit

Permalink
Release build 6.5.0 [ci release]
Browse files Browse the repository at this point in the history
  • Loading branch information
shakyShane authored and github-actions[bot] committed Jul 26, 2024
1 parent 097e545 commit ebeeaea
Show file tree
Hide file tree
Showing 14 changed files with 1,048 additions and 277 deletions.
277 changes: 200 additions & 77 deletions Sources/ContentScopeScripts/dist/contentScopeIsolated.js

Large diffs are not rendered by default.

193 changes: 158 additions & 35 deletions build/contentScope.js

Large diffs are not rendered by default.

193 changes: 158 additions & 35 deletions build/integration/contentScope.js

Large diffs are not rendered by default.

277 changes: 200 additions & 77 deletions build/windows/contentScope.js

Large diffs are not rendered by default.

65 changes: 63 additions & 2 deletions integration-test/playwright/duckplayer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ test.describe('Video Player overlays', () => {
await overlays.userSettingIs('always ask')
await overlays.gotoPlayerPage()

// Then then the overlay shows and blocks the video from playing
// Then the overlay shows and blocks the video from playing
await overlays.overlayBlocksVideo()
})
test('Overlay blocks video from playing (supporting DOM appearing over time)', async ({ page }, workerInfo) => {
Expand All @@ -144,7 +144,7 @@ test.describe('Video Player overlays', () => {
await overlays.userSettingIs('always ask')
await overlays.gotoPlayerPage({ variant: 'incremental-dom' })

// Then then the overlay shows and blocks the video from playing
// Then the overlay shows and blocks the video from playing
await overlays.overlayBlocksVideo()
})
test('Overlay is removed when new settings arrive', async ({ page }, workerInfo) => {
Expand Down Expand Up @@ -299,6 +299,67 @@ test.describe('Video Player overlays', () => {
await overlays.overlayBlocksVideo()
})
})
test.describe('with UI settings overrides', () => {
test('displays default overlay copy when no cohort is given', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
await overlays.withRemoteConfig()

// And my setting is 'always ask'
// And no overlay copy experiment cohort is set
await overlays.initialSetupIs('always ask')
await overlays.gotoPlayerPage()

// Then the overlay shows the correct copy for the default variant
await overlays.overlayCopyIsDefault()
})

test('displays default overlay copy in control cohort', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
await overlays.withRemoteConfig()

// And my setting is 'always ask'
// And I'm in the 'control' experiment cohort
await overlays.initialSetupIs('always ask', 'default overlay copy')
await overlays.gotoPlayerPage()

// Then the overlay shows the correct copy for the default variant
await overlays.overlayCopyIsDefault()
})

test('displays overlay copy for cohort A1', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
await overlays.withRemoteConfig()

// And my setting is 'always ask'
// And I'm in the 'A1' experiment cohort
await overlays.initialSetupIs('always ask', 'overlay copy a1')
await overlays.gotoPlayerPage()

// Then the overlay shows the correct copy for the A1 variant
await overlays.overlayCopyIsA1()
})

test('displays overlay copy for cohort B1', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
await overlays.withRemoteConfig()

// And my setting is 'always ask'
// And I'm in the 'B1' experiment cohort
await overlays.initialSetupIs('always ask', 'overlay copy b1')
await overlays.gotoPlayerPage()

// Then the overlay shows the correct copy for the B1 variant
await overlays.overlayCopyIsB1()
})
})
})

test.describe('serp proxy', () => {
Expand Down
79 changes: 79 additions & 0 deletions integration-test/playwright/page-objects/duckplayer-overlays.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,22 @@ const userValues = {
}
}

// Possible UI Settings
const uiSettings = {
/** @type {import("../../../src/features/duck-player.js").UISettings} */
'default overlay copy': {
overlayCopy: 'default'
},
/** @type {import("../../../src/features/duck-player.js").UISettings} */
'overlay copy a1': {
overlayCopy: 'a1'
},
/** @type {import("../../../src/features/duck-player.js").UISettings} */
'overlay copy b1': {
overlayCopy: 'b1'
}
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const configFiles = /** @type {const} */([
'overlays.json',
Expand Down Expand Up @@ -254,6 +270,27 @@ export class DuckplayerOverlays {
})
}

/**
* @param {keyof userValues} userValueSetting
* @param {keyof uiSettings} [uiSetting]
* @return {Promise<void>}
*/
async initialSetupIs (userValueSetting, uiSetting) {
const initialSetupResponse = {
userValues: userValues[userValueSetting]
}

if (uiSetting && uiSettings[uiSetting]) {
initialSetupResponse.ui = uiSettings[uiSetting]
}

await this.page.addInitScript(mockResponses, {
responses: {
initialSetup: initialSetupResponse
}
})
}

/**
* @param {keyof userValues} setting
*/
Expand Down Expand Up @@ -542,6 +579,48 @@ export class DuckplayerOverlays {
})
})
}

/**
* Checks for presence of default overlay copy
*/
async overlayCopyIsDefault () {
await this.page.locator('ddg-video-overlay').waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByText('Tired of targeted YouTube ads and recommendations?', { exact: true }).waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByText('Duck Player provides a clean viewing experience without personalized ads and prevents viewing activity from influencing your YouTube recommendations.', { exact: true }).waitFor({ state: 'visible', timeout: 1000 })

await this.page.getByRole('link', { name: 'Watch in Duck Player' }).waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByRole('button', { name: 'Watch Here' }).waitFor({ state: 'visible', timeout: 1000 })

await this.page.getByLabel('Remember my choice').waitFor({ state: 'visible', timeout: 1000 })
}

/**
* Checks for presence of overlay copy A1 experiment
*/
async overlayCopyIsA1 () {
await this.page.locator('ddg-video-overlay').waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByText('Turn on Duck Player to watch without targeted ads', { exact: true }).waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByText('What you watch in DuckDuckGo won’t influence your recommendations on YouTube.', { exact: true }).waitFor({ state: 'visible', timeout: 1000 })

await this.page.getByRole('link', { name: 'Turn On Duck Player' }).waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByRole('button', { name: 'No Thanks' }).waitFor({ state: 'visible', timeout: 1000 })

await this.page.getByLabel('Remember my choice').waitFor({ state: 'visible', timeout: 1000 })
}

/**
* Checks for presence of overlay copy B1 experiment
*/
async overlayCopyIsB1 () {
await this.page.locator('ddg-video-overlay').waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByText('Drowning in ads on YouTube? Turn on Duck Player.', { exact: true }).waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByText('What you watch in DuckDuckGo won’t influence your recommendations on YouTube.', { exact: true }).waitFor({ state: 'visible', timeout: 1000 })

await this.page.getByRole('link', { name: 'Turn On Duck Player' }).waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByRole('button', { name: 'No Thanks' }).waitFor({ state: 'visible', timeout: 1000 })

await this.page.getByLabel('Remember my choice').waitFor({ state: 'visible', timeout: 1000 })
}
}

/**
Expand Down
30 changes: 29 additions & 1 deletion integration-test/test-pages/duckplayer/pages/player.html
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,34 @@
</div>
</div>
</template>
<script>
(async () => {
if (!new URLSearchParams(location.search).has('preview')) {
return;
}
await import("/build/integration/contentScope.js").catch(console.error)
const overlays = await fetch('/integration-test/test-pages/duckplayer/config/overlays.json').then(x => x.json())
document.dispatchEvent(new CustomEvent('content-scope-init-args', {
detail: {
debug: true,
platform: {
name: 'macos'
},
site: {
domain: location.hostname,
isBroken: false,
allowlisted: false,
enabledFeatures: [
'duckPlayer'
]
},
featureSettings: {
duckPlayer: overlays.features.duckPlayer.settings,
}
}
}))
})();
</script>

<script type="module">
const variant = new URLSearchParams(window.location.search).get('variant') || 'default';
Expand Down Expand Up @@ -140,7 +168,7 @@
const params = new URLSearchParams(a.search);
const current = new URL(window.location.href);
current.searchParams.set('v', params.get('v'));
history.pushState('','',current.toString());
history.pushState('', '', current.toString());
document.title = a.title;
return;
}
Expand Down
9 changes: 8 additions & 1 deletion src/features/duck-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,15 @@ import { Environment, initOverlays } from './duckplayer/overlays.js'
* @property {boolean} overlayInteracted - always a boolean
*/

/**
* @typedef UISettings - UI-specific settings
* @property {'default'|'a1'|'b1'} overlayCopy
*/

/**
* @typedef OverlaysInitialSettings - The initial payload used to communicate render-blocking information
* @property {UserValues} userValues
* @property {UISettings} ui
*/

/**
Expand Down Expand Up @@ -87,11 +93,12 @@ export default class DuckPlayerFeature extends ContentFeature {
throw new Error('cannot operate duck player without a messaging backend')
}

const comms = new DuckPlayerOverlayMessages(this.messaging)
const env = new Environment({
debug: args.debug,
injectName: import.meta.injectName,
platform: this.platform
})
const comms = new DuckPlayerOverlayMessages(this.messaging, env)

if (overlaysEnabled) {
initOverlays(overlaySettings.youtube, env, comms)
Expand Down
16 changes: 1 addition & 15 deletions src/features/duckplayer/assets/dax.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ebeeaea

Please sign in to comment.