mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: log more phases of plugins (#13825)
This commit is contained in:
parent
a06b06b82b
commit
e124d926ee
@ -48,13 +48,18 @@ test('event order', async ({ runInlineTest }, testInfo) => {
|
|||||||
export default setup;
|
export default setup;
|
||||||
`,
|
`,
|
||||||
'globalTeardown.ts': `
|
'globalTeardown.ts': `
|
||||||
|
import log from './log';
|
||||||
const teardown = () => log('globalTeardown');
|
const teardown = () => log('globalTeardown');
|
||||||
export default teardown;
|
export default teardown;
|
||||||
`,
|
`,
|
||||||
'plugin.ts': `
|
'plugin.ts': `
|
||||||
import log from './log';
|
import log from './log';
|
||||||
export const myPlugin = (name: string) => ({
|
export const myPlugin = (name: string) => ({
|
||||||
configure: async (config) => { config.use = (config.use || {}); config.use.baseURL = (config.use.baseURL || '') + name + ' | '; },
|
configure: async (config) => {
|
||||||
|
log(name, 'configure');
|
||||||
|
config.use = (config.use || {});
|
||||||
|
config.use.baseURL = (config.use.baseURL || '') + name + ' | ';
|
||||||
|
},
|
||||||
setup: async () => log(name, 'setup'),
|
setup: async () => log(name, 'setup'),
|
||||||
teardown: async () => log(name, 'teardown'),
|
teardown: async () => log(name, 'teardown'),
|
||||||
});
|
});
|
||||||
@ -64,10 +69,15 @@ test('event order', async ({ runInlineTest }, testInfo) => {
|
|||||||
expect(result.passed).toBe(1);
|
expect(result.passed).toBe(1);
|
||||||
const logLines = await fs.promises.readFile(log, 'utf8');
|
const logLines = await fs.promises.readFile(log, 'utf8');
|
||||||
expect(logLines.split('\n')).toEqual([
|
expect(logLines.split('\n')).toEqual([
|
||||||
|
'a configure',
|
||||||
|
'b configure',
|
||||||
'a setup',
|
'a setup',
|
||||||
'b setup',
|
'b setup',
|
||||||
'globalSetup',
|
'globalSetup',
|
||||||
|
'a configure',
|
||||||
|
'b configure',
|
||||||
'baseURL a | b | ',
|
'baseURL a | b | ',
|
||||||
|
'globalTeardown',
|
||||||
'b teardown',
|
'b teardown',
|
||||||
'a teardown',
|
'a teardown',
|
||||||
'',
|
'',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user