mirror of
https://github.com/hanzoai/playwright.git
synced 2026-09-24 17:01:53 +00:00
test: fix android tests (#41301)
This commit is contained in:
@@ -81,8 +81,14 @@ export const androidTest = baseTest.extend<PageTestFixtures & AndroidTestFixture
|
||||
// Retain default page, otherwise Clank will re-create it.
|
||||
while (androidContext.pages().length > 1)
|
||||
await androidContext.pages()[1].close();
|
||||
const page = await androidContext.newPage();
|
||||
await run(page);
|
||||
await run(await androidContext.newPage());
|
||||
const pages = androidContext.pages();
|
||||
// Keep one fresh page - Clank does not like having zero pages.
|
||||
await androidContext.newPage();
|
||||
// Close all existing pages that could be stuck in a navigation, have an open dialog, etc.
|
||||
for (const page of pages)
|
||||
await page.close();
|
||||
// Cleanup as much as we can. This requires a non-stuck page that can respond to CDP.
|
||||
await androidContext.setStorageState({ cookies: [], origins: [] });
|
||||
},
|
||||
});
|
||||
|
||||
@@ -449,7 +449,9 @@ it('should still allow routeWebSocket to modify messages when capturing HAR', as
|
||||
]);
|
||||
});
|
||||
|
||||
it('should respect PLAYWRIGHT_HAR_NO_WEBSOCKET_FRAMES', async ({ contextFactory, server }, testInfo) => {
|
||||
it('should respect PLAYWRIGHT_HAR_NO_WEBSOCKET_FRAMES', async ({ contextFactory, server, mode }, testInfo) => {
|
||||
it.skip(mode !== 'default', 'no env vars in non-default mode');
|
||||
|
||||
process.env.PLAYWRIGHT_HAR_NO_WEBSOCKET_FRAMES = '1';
|
||||
server.onceWebSocketConnection(ws => {
|
||||
ws.on('message', () => ws.close());
|
||||
|
||||
@@ -343,7 +343,7 @@ it('should succeed if element handle was detached while waiting for hidden', asy
|
||||
await page.setContent(`<button>hello</button>`);
|
||||
const button = await page.$('button');
|
||||
const promise = button.waitForSelector('something', { state: 'hidden' });
|
||||
await page.waitForTimeout(100);
|
||||
await page.waitForTimeout(1000);
|
||||
await page.evaluate(() => document.body.innerText = '');
|
||||
await promise;
|
||||
});
|
||||
@@ -352,7 +352,7 @@ it('should succeed if element handle was detached while waiting for detached', a
|
||||
await page.setContent(`<button>hello</button>`);
|
||||
const button = await page.$('button');
|
||||
const promise = button.waitForSelector('something', { state: 'detached' });
|
||||
await page.waitForTimeout(100);
|
||||
await page.waitForTimeout(1000);
|
||||
await page.evaluate(() => document.body.innerText = '');
|
||||
await promise;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user