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.skip(!!process.env.INSIDE_DOCKER, 'connect ECONNREFUSED 127.0.0.1:<port>');
const request = await playwright.request.newContext({ proxy: {
server: `socks5://localhost:${socksPort}`,
} });

View File

@ -131,12 +131,11 @@ class Recorder {
async waitForOutput(file: string, text: string): Promise<Map<string, Source>> {
if (!codegenLang2Id.has(file))
throw new Error(`Unknown language: ${file}`);
const handle = await this.recorderPage.waitForFunction((params: { text: string, languageId: string }) => {
const w = window as any;
const source = (w.playwrightSourcesEchoForTest || []).find((s: Source) => s.id === params.languageId);
return source && source.text.includes(params.text) ? w.playwrightSourcesEchoForTest : null;
}, { text, languageId: codegenLang2Id.get(file) }, { timeout: 0, polling: 300 });
const sources: Source[] = await handle.jsonValue();
await expect.poll(() => this.recorderPage.evaluate(languageId => {
const sources = ((window as any).playwrightSourcesEchoForTest || []) as Source[];
return sources.find(s => s.id === languageId)?.text || '';
}, codegenLang2Id.get(file)), { timeout: 0 }).toContain(text);
const sources: Source[] = await this.recorderPage.evaluate(() => (window as any).playwrightSourcesEchoForTest || []);
for (const source of sources) {
if (!codegenLangId2lang.has(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);
});
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.skip(browserName === 'chromium' && browserMajorVersion < 126, 'Requires a recent enough protocol');
await page.goto(server.EMPTY_PAGE);
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');
expect.soft((await reqBefore.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);
});