Skip to content

Commit

Permalink
Merge branch 'main' into dbajpeyi/gpm-password-import
Browse files Browse the repository at this point in the history
  • Loading branch information
dbajpeyi authored Sep 19, 2024
2 parents f87a061 + 429f456 commit 129e8a2
Show file tree
Hide file tree
Showing 12 changed files with 86 additions and 201 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ jobs:
- name: Setup Github Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: docs
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ src/features/click-to-load/ @kzar @ladamski @franfaccin @jonathanKingston @shaky
src/locales/click-to-load/ @kzar @ladamski @franfaccin @jonathanKingston @shakyShane
src/features/broker-protection.js @brianhall @shakyShane
src/features/broker-protection/ @brianhall @shakyShane
packages/special-pages/ @shakyShane @mgurgel

# Platform owners
inject/android.js @jonathanKingston @joshliebe
Expand Down
65 changes: 10 additions & 55 deletions integration-test/playwright/duckplayer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ test.describe('Video Player overlays', () => {
// No video overlay
await overlays.videoOverlayDoesntShow()
})
test('Selecting \'watch in duck player\'', async ({ page }, workerInfo) => {
test('Selecting \'Turn On Duck Player\'', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
Expand All @@ -242,10 +242,10 @@ test.describe('Video Player overlays', () => {
await overlays.userSettingIs('always ask')
await overlays.gotoPlayerPage()

await overlays.watchInDuckPlayer()
await overlays.turnOnDuckPlayer()
await overlays.userSettingWasUpdatedTo('always ask') // not updated
})
test('Selecting \'watch in duck player\' + remember', async ({ page }, workerInfo) => {
test('Selecting \'Turn On Duck Player\' + remember', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
Expand All @@ -256,10 +256,10 @@ test.describe('Video Player overlays', () => {
await overlays.gotoPlayerPage()

await overlays.rememberMyChoice()
await overlays.watchInDuckPlayer()
await overlays.turnOnDuckPlayer()
await overlays.userSettingWasUpdatedTo('enabled') // updated
})
test('Selecting \'watch here\'', async ({ page }, workerInfo) => {
test('Selecting \'No Thanks\'', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
Expand All @@ -269,10 +269,10 @@ test.describe('Video Player overlays', () => {
await overlays.userSettingIs('always ask')
await overlays.gotoPlayerPage()

await overlays.watchHere()
await overlays.noThanks()
await overlays.secondOverlayExistsOnVideo()
})
test('Selecting \'watch here\' + remember', async ({ page }, workerInfo) => {
test('Selecting \'No Thanks\' + remember', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
Expand All @@ -283,11 +283,11 @@ test.describe('Video Player overlays', () => {
await overlays.gotoPlayerPage()

await overlays.rememberMyChoice()
await overlays.watchHere()
await overlays.noThanks()
await overlays.userSettingWasUpdatedTo('always ask remembered') // updated
})
test.describe('with remote config overrides', () => {
test('Selecting \'watch here\' + remember', async ({ page }, workerInfo) => {
test('Selecting \'No Thanks\' + remember', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// config with some CSS selectors overridden
Expand All @@ -300,7 +300,7 @@ test.describe('Video Player overlays', () => {
})
})
test.describe('with UI settings overrides', () => {
test('displays default overlay copy when no cohort is given', async ({ page }, workerInfo) => {
test('displays default overlay copy', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

// Given overlays feature is enabled
Expand All @@ -315,51 +315,6 @@ test.describe('Video Player overlays', () => {
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('forces next video to play in Duck Player', async ({ page }, workerInfo) => {
const overlays = DuckplayerOverlays.create(page, workerInfo)

Expand Down
54 changes: 7 additions & 47 deletions integration-test/playwright/page-objects/duckplayer-overlays.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ 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'
},
'play in duck player': {
playInDuckPlayer: true
}
Expand Down Expand Up @@ -202,9 +190,9 @@ export class DuckplayerOverlays {

async overlayBlocksVideo () {
await this.page.locator('ddg-video-overlay').waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByRole('link', { name: 'Watch in Duck Player' }).waitFor({ state: 'visible', timeout: 1000 })
await this.page.getByRole('link', { name: 'Turn On Duck Player' }).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.')
.getByText('What you watch in DuckDuckGo won’t influence your recommendations on YouTube.')
.waitFor({ timeout: 100 })
}

Expand All @@ -217,7 +205,7 @@ export class DuckplayerOverlays {

// this is added because 'getAttribute' does not auto-wait
await expect(async () => {
const link = await this.page.getByRole('link', { name: 'Watch in Duck Player' }).getAttribute('href')
const link = await this.page.getByRole('link', { name: 'Turn On Duck Player' }).getAttribute('href')
expect(link).toEqual('duck://player/' + videoID)
}).toPass({ timeout: 5000 })
}
Expand Down Expand Up @@ -405,8 +393,8 @@ export class DuckplayerOverlays {
// if we get here, the element was absent
}

async watchInDuckPlayer () {
const action = () => this.page.getByRole('link', { name: 'Watch in Duck Player' }).click()
async turnOnDuckPlayer () {
const action = () => this.page.getByRole('link', { name: 'Turn On Duck Player' }).click()

await this.build.switch({
'apple-isolated': async () => {
Expand All @@ -428,8 +416,8 @@ export class DuckplayerOverlays {
})
}

async watchHere () {
await this.page.getByText('Watch Here').click()
async noThanks () {
await this.page.getByText('No Thanks').click()
}

async rememberMyChoice () {
Expand Down Expand Up @@ -619,20 +607,6 @@ 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 })
Expand All @@ -642,20 +616,6 @@ export class DuckplayerOverlays {

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 })
}
}

class DuckplayerOverlaysMobile {
Expand Down
2 changes: 1 addition & 1 deletion integration-test/test-pages/duckplayer/scripts/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ customElements.define(DDGVideoOverlayMobile.CUSTOM_TAG_NAME, DDGVideoOverlayMobi

const elem = /** @type {DDGVideoOverlayMobile} */(document.createElement(DDGVideoOverlayMobile.CUSTOM_TAG_NAME))
elem.testMode = true
elem.text = overlayCopyVariants.a1
elem.text = overlayCopyVariants.default

elem.addEventListener('opt-in', (/** @type {CustomEvent} */e) => {
console.log('did opt in?', e.detail)
Expand Down
Loading

0 comments on commit 129e8a2

Please sign in to comment.