Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed May 21, 2021
1 parent bcd57b0 commit bb0e5dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 8 additions & 4 deletions src/server/firefox/ffBrowser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,14 @@ export class FFBrowserContext extends BrowserContext {
promises.push(this.setGeolocation(this._options.geolocation));
if (this._options.offline)
promises.push(this.setOffline(this._options.offline));
if (this._options.colorScheme)
promises.push(this._browser._connection.send('Browser.setColorScheme', { browserContextId, colorScheme: this._options.colorScheme }));
if (this._options.reducedMotion)
promises.push(this._browser._connection.send('Browser.setReducedMotion', { browserContextId, reducedMotion: this._options.reducedMotion }));
promises.push(this._browser._connection.send('Browser.setColorScheme', {
browserContextId,
colorScheme: this._options.colorScheme !== undefined ? this._options.colorScheme : 'light',
}));
promises.push(this._browser._connection.send('Browser.setReducedMotion', {
browserContextId,
reducedMotion: this._options.reducedMotion !== undefined ? this._options.reducedMotion : 'no-preference',
}));
if (this._options.recordVideo) {
promises.push(this._ensureVideosPath().then(() => {
return this._browser._connection.send('Browser.setVideoRecordingOptions', {
Expand Down
2 changes: 0 additions & 2 deletions tests/page/page-emulate-media.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,4 @@ it('should emulate reduced motion', async ({page}) => {
expect(await page.evaluate(() => matchMedia('(prefers-reduced-motion: reduce)').matches)).toBe(false);
expect(await page.evaluate(() => matchMedia('(prefers-reduced-motion: no-preference)').matches)).toBe(true);
await page.emulateMedia({ reducedMotion: null });
expect(await page.evaluate(() => matchMedia('(prefers-reduced-motion: no-preference)').matches)).toBe(true);
expect(await page.evaluate(() => matchMedia('(prefers-reduced-motion: reduce)').matches)).toBe(false);
});

0 comments on commit bb0e5dc

Please sign in to comment.