mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
feat(test-runner): allow parametrized tests that don't extend base (#9301)
This commit is contained in:
parent
6e803f7186
commit
f63af830de
@ -182,3 +182,29 @@ test('config should allow void/empty options', async ({ runTSC }) => {
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
|
||||
test('config should allow ExtraUseOptions', async ({ runTSC }) => {
|
||||
const result = await runTSC({
|
||||
'playwright.config.ts': `
|
||||
const configs: pwt.Config[] = [];
|
||||
configs.push({ use: { myParam: 'text' }});
|
||||
`,
|
||||
'extraUseOptions.d.ts': `
|
||||
export {};
|
||||
declare global {
|
||||
namespace PlaywrightTest {
|
||||
export interface ExtraUseOptions {
|
||||
myParam: string
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
'a.spec.ts': `
|
||||
const { test } = pwt;
|
||||
test('my test', async ({ myParam }) => {
|
||||
console.log(myParam);
|
||||
});
|
||||
`
|
||||
});
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
|
2
types/test.d.ts
vendored
2
types/test.d.ts
vendored
@ -2444,7 +2444,7 @@ export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' |
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
export interface PlaywrightTestOptions {
|
||||
export interface PlaywrightTestOptions extends PlaywrightTest.ExtraUseOptions {
|
||||
/**
|
||||
* Whether to automatically download all the attachments. Defaults to `false` where all the downloads are canceled.
|
||||
*/
|
||||
|
7
types/testExpect.d.ts
vendored
7
types/testExpect.d.ts
vendored
@ -166,4 +166,11 @@ declare global {
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
namespace PlaywrightTest {
|
||||
export interface ExtraUseOptions {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { };
|
||||
|
2
utils/generate_types/overrides-test.d.ts
vendored
2
utils/generate_types/overrides-test.d.ts
vendored
@ -298,7 +298,7 @@ export interface PlaywrightWorkerOptions {
|
||||
|
||||
export type VideoMode = 'off' | 'on' | 'retain-on-failure' | 'on-first-retry' | /** deprecated */ 'retry-with-video';
|
||||
|
||||
export interface PlaywrightTestOptions {
|
||||
export interface PlaywrightTestOptions extends PlaywrightTest.ExtraUseOptions {
|
||||
acceptDownloads: boolean | undefined;
|
||||
bypassCSP: boolean | undefined;
|
||||
colorScheme: ColorScheme | undefined;
|
||||
|
Loading…
x
Reference in New Issue
Block a user