From 040aec4e5b764da74cf3c0d1436cc809064103ae Mon Sep 17 00:00:00 2001 From: Shane Osbourne Date: Mon, 8 Jul 2024 09:31:50 +0100 Subject: [PATCH] use message to open duckplayer from overlay --- .../playwright/page-objects/duckplayer-overlays.js | 10 +--------- src/features/duckplayer/video-overlay.js | 4 +++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/integration-test/playwright/page-objects/duckplayer-overlays.js b/integration-test/playwright/page-objects/duckplayer-overlays.js index 0daa89de1b..922d7ebc3e 100644 --- a/integration-test/playwright/page-objects/duckplayer-overlays.js +++ b/integration-test/playwright/page-objects/duckplayer-overlays.js @@ -344,16 +344,8 @@ export class DuckplayerOverlays { } async watchInDuckPlayer () { - const failure = new Promise(resolve => { - this.page.context().on('requestfailed', f => { - if (f.url().startsWith('duck')) resolve(f.url()) - }) - }) - await this.page.getByRole('link', { name: 'Watch in Duck Player' }).click() - - // assert the page tried to navigate to duck player - expect(await failure).toEqual('duck://player/123') + await this.duckPlayerLoadsFor('123') } async watchHere () { diff --git a/src/features/duckplayer/video-overlay.js b/src/features/duckplayer/video-overlay.js index 8fdbe4fd56..dccbdf2a89 100644 --- a/src/features/duckplayer/video-overlay.js +++ b/src/features/duckplayer/video-overlay.js @@ -269,6 +269,8 @@ export class VideoOverlay { * But, if the checkbox was not checked, then we want to keep the state * as 'alwaysAsk' * + * @param {boolean} remember + * @param {VideoParams} params */ userOptIn (remember, params) { /** @type {import("../duck-player.js").UserValues['privatePlayerMode']} */ @@ -285,7 +287,7 @@ export class VideoOverlay { privatePlayerMode } this.messages.setUserValues(outgoing) - .then(() => this.environment.setHref(params.toPrivatePlayerUrl())) + .then(() => this.messages.openDuckPlayer({ href: params.toPrivatePlayerUrl() })) .catch(e => console.error('error setting user choice', e)) }