mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
test: make page-leaks tests pass in electron (#22277)
They've been failing https://devops.playwright.dev/flakiness.html#filter_spec=page%2Fpage-leaks.spec.ts&test_parameter_filters=%5B%5D×tamp=1680901928195
This commit is contained in:
parent
26bbf8ca1b
commit
8d2502ee62
@ -71,7 +71,8 @@ export class ElectronApplication extends SdkObject {
|
||||
this._nodeSession.on('Runtime.executionContextCreated', async (event: any) => {
|
||||
if (event.context.auxData && event.context.auxData.isDefault) {
|
||||
this._nodeExecutionContext = new js.ExecutionContext(this, new CRExecutionContext(this._nodeSession, event.context), 'electron');
|
||||
f(await js.evaluate(this._nodeExecutionContext, false /* returnByValue */, `process.mainModule.require('electron')`));
|
||||
const source = `process.mainModule.require('electron')`;
|
||||
f(await this._nodeExecutionContext.rawEvaluateHandle(source).then(objectId => new js.JSHandle(this._nodeExecutionContext!, 'object', 'ElectronModule', objectId)));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -21,7 +21,7 @@ function leakedJSHandles(): string {
|
||||
const map = new MultiMap();
|
||||
for (const [h, e] of (globalThis as any).leakedJSHandles) {
|
||||
const name = `[${h.worldNameForTest()}] ${h.preview()}`;
|
||||
if (name === '[main] UtilityScript' || name === '[utility] UtilityScript' || name === '[main] InjectedScript' || name === '[utility] InjectedScript')
|
||||
if (name === '[main] UtilityScript' || name === '[utility] UtilityScript' || name === '[electron] UtilityScript' || name === '[main] InjectedScript' || name === '[utility] InjectedScript' || name === '[electron] ElectronModule')
|
||||
continue;
|
||||
map.set(e.stack, name);
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ test('render steps', async ({ runInlineTest }) => {
|
||||
`,
|
||||
}, { reporter: 'list' }, { PW_TEST_DEBUG_REPORTERS: '1', PW_TEST_DEBUG_REPORTERS_PRINT_STEPS: '1', PWTEST_TTY_WIDTH: '80' });
|
||||
const text = result.output;
|
||||
console.log(result.output)
|
||||
const lines = text.split('\n').filter(l => l.match(/^\d :/)).map(l => l.replace(/\d+ms/, 'Xms'));
|
||||
lines.pop(); // Remove last item that contains [v] and time in ms.
|
||||
expect(lines).toEqual([
|
||||
|
Loading…
Reference in New Issue
Block a user