Skip to content

Commit 118333a

Browse files
authored
test: fix event coverage on Chromium (#1693)
Chromium events were mistakenly attributed to Firefox.
1 parent 222d01c commit 118333a

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

test/playwright.spec.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,6 @@ const {TestServer} = require('../utils/testserver/');
2323
const YELLOW_COLOR = '\x1b[33m';
2424
const RESET_COLOR = '\x1b[0m';
2525

26-
const BROWSER_CONFIGS = [
27-
{
28-
name: 'Firefox',
29-
events: {
30-
...require('../lib/events').Events,
31-
...require('../lib/chromium/events').Events,
32-
},
33-
missingCoverage: ['browserContext.setGeolocation', 'browserContext.setOffline', 'cDPSession.send', 'cDPSession.detach'],
34-
},
35-
{
36-
name: 'WebKit',
37-
events: require('../lib/events').Events,
38-
missingCoverage: ['browserContext.clearPermissions', 'cDPSession.send', 'cDPSession.detach'],
39-
},
40-
{
41-
name: 'Chromium',
42-
events: require('../lib/events').Events,
43-
missingCoverage: [],
44-
},
45-
];
46-
const browserNames = BROWSER_CONFIGS.map(config => config.name);
47-
4826
/**
4927
* @type {TestSuite}
5028
*/
@@ -265,6 +243,28 @@ module.exports.addPlaywrightTests = ({platform, products, playwrightPath, headle
265243
});
266244

267245
if (coverage) {
246+
const BROWSER_CONFIGS = [
247+
{
248+
name: 'Firefox',
249+
events: require('../lib/events').Events,
250+
missingCoverage: ['browserContext.setGeolocation', 'browserContext.setOffline', 'cDPSession.send', 'cDPSession.detach'],
251+
},
252+
{
253+
name: 'WebKit',
254+
events: require('../lib/events').Events,
255+
missingCoverage: ['browserContext.clearPermissions', 'cDPSession.send', 'cDPSession.detach'],
256+
},
257+
{
258+
name: 'Chromium',
259+
events: {
260+
...require('../lib/events').Events,
261+
...require('../lib/chromium/events').Events,
262+
},
263+
// Sometimes we already have a background page while launching, before adding a listener.
264+
missingCoverage: ['chromiumBrowserContext.emit("backgroundpage")'],
265+
},
266+
];
267+
const browserNames = BROWSER_CONFIGS.map(config => config.name);
268268
const browserConfig = BROWSER_CONFIGS.find(config => config.name === product);
269269
const api = require('../lib/api');
270270
const filteredApi = {};

0 commit comments

Comments
 (0)