mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
chore: pass fixture defaults different from falsy (#14237)
This commit is contained in:
parent
50b2d4aabe
commit
738d5e5b3e
@ -64,7 +64,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
|
|||||||
await use(require('playwright-core'));
|
await use(require('playwright-core'));
|
||||||
}
|
}
|
||||||
}, { scope: 'worker' } ],
|
}, { scope: 'worker' } ],
|
||||||
headless: [ undefined, { scope: 'worker', option: true } ],
|
headless: [ true, { scope: 'worker', option: true } ],
|
||||||
channel: [ undefined, { scope: 'worker', option: true } ],
|
channel: [ undefined, { scope: 'worker', option: true } ],
|
||||||
launchOptions: [ {}, { scope: 'worker', option: true } ],
|
launchOptions: [ {}, { scope: 'worker', option: true } ],
|
||||||
connectOptions: [ undefined, { scope: 'worker', option: true } ],
|
connectOptions: [ undefined, { scope: 'worker', option: true } ],
|
||||||
@ -135,7 +135,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
|
|||||||
await browser.close();
|
await browser.close();
|
||||||
}, { scope: 'worker' } ],
|
}, { scope: 'worker' } ],
|
||||||
|
|
||||||
acceptDownloads: [ undefined, { option: true } ],
|
acceptDownloads: [ true, { option: true } ],
|
||||||
bypassCSP: [ undefined, { option: true } ],
|
bypassCSP: [ undefined, { option: true } ],
|
||||||
colorScheme: [ undefined, { option: true } ],
|
colorScheme: [ undefined, { option: true } ],
|
||||||
deviceScaleFactor: [ undefined, { option: true } ],
|
deviceScaleFactor: [ undefined, { option: true } ],
|
||||||
@ -145,7 +145,7 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
|
|||||||
httpCredentials: [ undefined, { option: true } ],
|
httpCredentials: [ undefined, { option: true } ],
|
||||||
ignoreHTTPSErrors: [ undefined, { option: true } ],
|
ignoreHTTPSErrors: [ undefined, { option: true } ],
|
||||||
isMobile: [ undefined, { option: true } ],
|
isMobile: [ undefined, { option: true } ],
|
||||||
javaScriptEnabled: [ undefined, { option: true } ],
|
javaScriptEnabled: [ true, { option: true } ],
|
||||||
locale: [ 'en-US', { option: true } ],
|
locale: [ 'en-US', { option: true } ],
|
||||||
offline: [ undefined, { option: true } ],
|
offline: [ undefined, { option: true } ],
|
||||||
permissions: [ undefined, { option: true } ],
|
permissions: [ undefined, { option: true } ],
|
||||||
@ -154,8 +154,8 @@ export const test = _baseTest.extend<TestFixtures, WorkerFixtures>({
|
|||||||
timezoneId: [ undefined, { option: true } ],
|
timezoneId: [ undefined, { option: true } ],
|
||||||
userAgent: [ undefined, { option: true } ],
|
userAgent: [ undefined, { option: true } ],
|
||||||
viewport: [ { width: 1280, height: 720 }, { option: true } ],
|
viewport: [ { width: 1280, height: 720 }, { option: true } ],
|
||||||
actionTimeout: [ undefined, { option: true } ],
|
actionTimeout: [ 0, { option: true } ],
|
||||||
navigationTimeout: [ undefined, { option: true } ],
|
navigationTimeout: [ 0, { option: true } ],
|
||||||
baseURL: [ async ({ }, use) => {
|
baseURL: [ async ({ }, use) => {
|
||||||
await use(process.env.PLAYWRIGHT_TEST_BASE_URL);
|
await use(process.env.PLAYWRIGHT_TEST_BASE_URL);
|
||||||
}, { option: true } ],
|
}, { option: true } ],
|
||||||
|
|||||||
@ -582,3 +582,23 @@ test('should work with video.path() throwing', async ({ runInlineTest }, testInf
|
|||||||
const video = fs.readdirSync(dir).find(file => file.endsWith('webm'));
|
const video = fs.readdirSync(dir).find(file => file.endsWith('webm'));
|
||||||
expect(video).toBeTruthy();
|
expect(video).toBeTruthy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should pass fixture defaults to tests', async ({ runInlineTest }) => {
|
||||||
|
const result = await runInlineTest({
|
||||||
|
'playwright.config.js': `
|
||||||
|
module.exports = {};
|
||||||
|
`,
|
||||||
|
'a.test.ts': `
|
||||||
|
const { test } = pwt;
|
||||||
|
test('pass', async ({ acceptDownloads, actionTimeout, headless, javaScriptEnabled, navigationTimeout }) => {
|
||||||
|
expect(acceptDownloads).toBe(true);
|
||||||
|
expect(actionTimeout).toBe(0);
|
||||||
|
expect(headless).toBe(true);
|
||||||
|
expect(javaScriptEnabled).toBe(true);
|
||||||
|
expect(navigationTimeout).toBe(0);
|
||||||
|
});
|
||||||
|
`,
|
||||||
|
}, { workers: 1 });
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
expect(result.passed).toBe(1);
|
||||||
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user