Skip to content

Commit 2e604ce

Browse files
committed
Test fix
1 parent 571e87b commit 2e604ce

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

special-pages/pages/duckplayer/integration-tests/duck-player.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,12 @@ export class DuckPlayerPage {
147147

148148
initError() {
149149
const clone = structuredClone(this.defaults);
150-
// Force an init error by passing an empty response to initialSetup
151150
// @ts-expect-error - this is a test
152-
clone.initialSetup = undefined;
151+
clone.initialSetup = {
152+
locale: 'en',
153+
env: 'development',
154+
platform: this.platform.name === 'windows' ? undefined : { name: this.platform.name },
155+
};
153156
this.mocks.defaultResponses(clone);
154157
}
155158

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,21 @@ test.describe('reporting exceptions', () => {
340340
// load as normal
341341
duckplayer.initError();
342342
await duckplayer.openWithVideoID();
343-
await duckplayer.didSendException('InitError', 'Max attempts reached: Error: response not found for initialSetup');
343+
const message = isWindows(workerInfo)
344+
? 'Cannot read properties of undefined (reading \'pip\')'
345+
: 'undefined is not an object (evaluating \'init2.settings.pip\')';
346+
await duckplayer.didSendException('InitError', message);
344347
});
345348
});
346349

350+
/**
351+
* @param {import("@playwright/test").TestInfo} testInfo
352+
*/
353+
function isWindows(testInfo) {
354+
const u = /** @type {any} */ (testInfo.project.use);
355+
return u?.platform === 'windows';
356+
}
357+
347358
/**
348359
* @param {import("@playwright/test").TestInfo} testInfo
349360
*/

0 commit comments

Comments
 (0)