test: skip/improve some tests that are flaky (#30993)

This commit is contained in:
Dmitry Gozman 2024-05-23 17:40:27 -07:00 committed by GitHub
parent b12cfe457b
commit ae1e07de10
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 11 deletions

View file

@ -132,6 +132,8 @@ it(`should support proxy.bypass`, async ({ contextFactory, contextOptions, serve
}); });
it('should use socks proxy', async ({ playwright, server, socksPort }) => { it('should use socks proxy', async ({ playwright, server, socksPort }) => {
it.skip(!!process.env.INSIDE_DOCKER, 'connect ECONNREFUSED 127.0.0.1:<port>');
const request = await playwright.request.newContext({ proxy: { const request = await playwright.request.newContext({ proxy: {
server: `socks5://localhost:${socksPort}`, server: `socks5://localhost:${socksPort}`,
} }); } });

View file

@ -131,12 +131,11 @@ class Recorder {
async waitForOutput(file: string, text: string): Promise<Map<string, Source>> { async waitForOutput(file: string, text: string): Promise<Map<string, Source>> {
if (!codegenLang2Id.has(file)) if (!codegenLang2Id.has(file))
throw new Error(`Unknown language: ${file}`); throw new Error(`Unknown language: ${file}`);
const handle = await this.recorderPage.waitForFunction((params: { text: string, languageId: string }) => { await expect.poll(() => this.recorderPage.evaluate(languageId => {
const w = window as any; const sources = ((window as any).playwrightSourcesEchoForTest || []) as Source[];
const source = (w.playwrightSourcesEchoForTest || []).find((s: Source) => s.id === params.languageId); return sources.find(s => s.id === languageId)?.text || '';
return source && source.text.includes(params.text) ? w.playwrightSourcesEchoForTest : null; }, codegenLang2Id.get(file)), { timeout: 0 }).toContain(text);
}, { text, languageId: codegenLang2Id.get(file) }, { timeout: 0, polling: 300 }); const sources: Source[] = await this.recorderPage.evaluate(() => (window as any).playwrightSourcesEchoForTest || []);
const sources: Source[] = await handle.jsonValue();
for (const source of sources) { for (const source of sources) {
if (!codegenLangId2lang.has(source.id)) if (!codegenLangId2lang.has(source.id))
throw new Error(`Unknown language: ${source.id}`); throw new Error(`Unknown language: ${source.id}`);

View file

@ -315,8 +315,9 @@ it('should get |undefined| with postDataJSON() when there is no post data', asyn
expect(response.request().postDataJSON()).toBe(null); expect(response.request().postDataJSON()).toBe(null);
}); });
it('should return multipart/form-data', async ({ page, server, browserName }) => { it('should return multipart/form-data', async ({ page, server, browserName, browserMajorVersion }) => {
it.fixme(browserName === 'webkit', 'File content is missing in WebKit'); it.fixme(browserName === 'webkit', 'File content is missing in WebKit');
it.skip(browserName === 'chromium' && browserMajorVersion < 126, 'Requires a recent enough protocol');
await page.goto(server.EMPTY_PAGE); await page.goto(server.EMPTY_PAGE);
server.setRoute('/post', (req, res) => res.end()); server.setRoute('/post', (req, res) => res.end());

View file

@ -515,8 +515,4 @@ it('continue should not change multipart/form-data body', async ({ page, server,
'------'].join('\r\n'); '------'].join('\r\n');
expect.soft((await reqBefore.postBody).toString('utf8')).toContain(fileContent); expect.soft((await reqBefore.postBody).toString('utf8')).toContain(fileContent);
expect.soft((await reqAfter.postBody).toString('utf8')).toContain(fileContent); expect.soft((await reqAfter.postBody).toString('utf8')).toContain(fileContent);
// Firefox sends a bit longer boundary.
const expectedLength = browserName === 'firefox' ? '246' : '208';
expect.soft(reqBefore.headers['content-length']).toBe(expectedLength);
expect.soft(reqAfter.headers['content-length']).toBe(expectedLength);
}); });