Skip to content

Commit 82041b2

Browse files
authored
test: roll to [email protected] (#6918)
1 parent f441755 commit 82041b2

File tree

138 files changed

+38
-40
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+38
-40
lines changed

docs/src/test-snapshots.md

Lines changed: 9 additions & 9 deletions

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"eslint-plugin-notice": "^0.9.10",
8181
"eslint-plugin-react-hooks": "^4.2.0",
8282
"file-loader": "^6.1.0",
83-
"folio": "=0.4.0-alpha27",
83+
"folio": "=0.4.0-alpha28",
8484
"formidable": "^1.2.2",
8585
"html-webpack-plugin": "^4.4.1",
8686
"ncp": "^2.0.0",

src/cli/fixtures.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import type { PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, P
2121

2222
export * from 'folio';
2323
export const test = folio.test.extend<PlaywrightTestArgs & PlaywrightTestOptions, PlaywrightWorkerArgs & PlaywrightWorkerOptions>({
24-
browserName: [ 'chromium', { scope: 'worker' } ],
24+
defaultBrowserType: [ 'chromium', { scope: 'worker' } ],
25+
browserName: [ ({ defaultBrowserType }, use) => use(defaultBrowserType), { scope: 'worker' } ],
2526
playwright: [ require('../inprocess'), { scope: 'worker' } ],
2627
headless: [ undefined, { scope: 'worker' } ],
2728
channel: [ undefined, { scope: 'worker' } ],
@@ -66,8 +67,8 @@ export const test = folio.test.extend<PlaywrightTestArgs & PlaywrightTestOptions
6667
viewport: undefined,
6768
contextOptions: {},
6869

69-
context: async ({ browserName, browser, screenshot, video, acceptDownloads, bypassCSP, colorScheme, deviceScaleFactor, extraHTTPHeaders, hasTouch, geolocation, httpCredentials, ignoreHTTPSErrors, isMobile, javaScriptEnabled, locale, offline, permissions, proxy, storageState, viewport, timezoneId, userAgent, contextOptions }, use, testInfo) => {
70-
testInfo.snapshotSuffix = browserName + '-' + process.platform;
70+
context: async ({ browser, screenshot, video, acceptDownloads, bypassCSP, colorScheme, deviceScaleFactor, extraHTTPHeaders, hasTouch, geolocation, httpCredentials, ignoreHTTPSErrors, isMobile, javaScriptEnabled, locale, offline, permissions, proxy, storageState, viewport, timezoneId, userAgent, contextOptions }, use, testInfo) => {
71+
testInfo.snapshotSuffix = process.platform;
7172
if (process.env.PWDEBUG)
7273
testInfo.setTimeout(0);
7374

@@ -148,3 +149,5 @@ export const test = folio.test.extend<PlaywrightTestArgs & PlaywrightTestOptions
148149
},
149150
});
150151
export default test;
152+
153+
export const __baseTest = folio.test;

src/cli/testRunner.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,16 @@ export function addTestCommand(program: commander.CommanderStatic) {
8787
}
8888

8989
async function runTests(Runner: RunnerType, args: string[], opts: { [key: string]: any }) {
90-
if (opts.browser) {
91-
const browserOpt = opts.browser.toLowerCase();
92-
if (!['all', 'chromium', 'firefox', 'webkit'].includes(browserOpt))
93-
throw new Error(`Unsupported browser "${opts.browser}", must be one of "all", "chromium", "firefox" or "webkit"`);
94-
const browserNames = browserOpt === 'all' ? ['chromium', 'firefox', 'webkit'] : [browserOpt];
95-
defaultConfig.projects = browserNames.map(browserName => {
96-
return {
97-
name: browserName,
98-
use: { browserName },
99-
};
100-
});
101-
}
90+
const browserOpt = opts.browser ? opts.browser.toLowerCase() : 'chromium';
91+
if (!['all', 'chromium', 'firefox', 'webkit'].includes(browserOpt))
92+
throw new Error(`Unsupported browser "${opts.browser}", must be one of "all", "chromium", "firefox" or "webkit"`);
93+
const browserNames = browserOpt === 'all' ? ['chromium', 'firefox', 'webkit'] : [browserOpt];
94+
defaultConfig.projects = browserNames.map(browserName => {
95+
return {
96+
name: browserName,
97+
use: { browserName },
98+
};
99+
});
102100

103101
const overrides = overridesFromOptions(opts);
104102
if (opts.headed)

tests/config/baseTest.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class DefaultMode {
101101
}
102102
}
103103

104-
const baseFixtures: folio.Fixtures<{ __baseSetup: void }, BaseOptions & BaseFixtures> = {
104+
const baseFixtures: folio.Fixtures<{}, BaseOptions & BaseFixtures> = {
105105
mode: [ 'default', { scope: 'worker' } ],
106106
browserName: [ 'chromium' , { scope: 'worker' } ],
107107
channel: [ undefined, { scope: 'worker' } ],
@@ -123,10 +123,6 @@ const baseFixtures: folio.Fixtures<{ __baseSetup: void }, BaseOptions & BaseFixt
123123
isWindows: [ process.platform === 'win32', { scope: 'worker' } ],
124124
isMac: [ process.platform === 'darwin', { scope: 'worker' } ],
125125
isLinux: [ process.platform === 'linux', { scope: 'worker' } ],
126-
__baseSetup: [ async ({ browserName }, run, testInfo) => {
127-
testInfo.snapshotSuffix = browserName;
128-
await run();
129-
}, { auto: true } ],
130126
};
131127

132128
type ServerOptions = {

tests/config/electron.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const metadata = {
4848
};
4949

5050
config.projects.push({
51-
name: 'electron',
51+
name: 'chromium', // We use 'chromium' here to share screenshots with chromium.
5252
use: {
5353
mode: 'default',
5454
browserName: 'chromium',
@@ -59,7 +59,7 @@ config.projects.push({
5959
});
6060

6161
config.projects.push({
62-
name: 'electron',
62+
name: 'chromium', // We use 'chromium' here to share screenshots with chromium.
6363
use: {
6464
mode: 'default',
6565
browserName: 'chromium',

0 commit comments

Comments
 (0)