test: unflake some network-tab related tests (#35574)
This commit is contained in:
parent
eed11cabb4
commit
51a7b8f27f
|
@ -12,8 +12,6 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script src='script.js'></script>
|
<script src='script.js'></script>
|
||||||
<script>fetch('/api/endpoint')</script>
|
|
||||||
<script>fetch('/call-with-query-params?param1=value1¶m1=value2¶m2=value2')</script>
|
|
||||||
<script>
|
<script>
|
||||||
const body = JSON.stringify({
|
const body = JSON.stringify({
|
||||||
data: {
|
data: {
|
||||||
|
@ -21,17 +19,25 @@
|
||||||
array: ['value-1', 'value-2'],
|
array: ['value-1', 'value-2'],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
const fetches = [
|
||||||
|
fetch('/api/endpoint'),
|
||||||
|
fetch('/call-with-query-params?param1=value1¶m1=value2¶m2=value2'),
|
||||||
fetch('/post-data-1', {
|
fetch('/post-data-1', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'content-type': 'application/json' },
|
headers: { 'content-type': 'application/json' },
|
||||||
body,
|
body,
|
||||||
});
|
}),
|
||||||
fetch('/post-data-2', {
|
fetch('/post-data-2', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body,
|
body,
|
||||||
});
|
}),
|
||||||
|
];
|
||||||
|
window.donePromise = Promise.all(fetches.map(f => f.then(r => r.body()).then(() => null).catch(e => {})));
|
||||||
|
</script>
|
||||||
|
<script></script>
|
||||||
|
<script>
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -367,6 +367,7 @@ test('should filter network requests by resource type', async ({ page, runAndTra
|
||||||
const traceViewer = await runAndTrace(async () => {
|
const traceViewer = await runAndTrace(async () => {
|
||||||
server.setRoute('/api/endpoint', (_, res) => res.setHeader('Content-Type', 'application/json').end());
|
server.setRoute('/api/endpoint', (_, res) => res.setHeader('Content-Type', 'application/json').end());
|
||||||
await page.goto(`${server.PREFIX}/network-tab/network.html`);
|
await page.goto(`${server.PREFIX}/network-tab/network.html`);
|
||||||
|
await page.evaluate(() => (window as any).donePromise);
|
||||||
});
|
});
|
||||||
await traceViewer.selectAction('http://localhost');
|
await traceViewer.selectAction('http://localhost');
|
||||||
await traceViewer.showNetworkTab();
|
await traceViewer.showNetworkTab();
|
||||||
|
@ -399,6 +400,7 @@ test('should filter network requests by resource type', async ({ page, runAndTra
|
||||||
test('should show font preview', async ({ page, runAndTrace, server }) => {
|
test('should show font preview', async ({ page, runAndTrace, server }) => {
|
||||||
const traceViewer = await runAndTrace(async () => {
|
const traceViewer = await runAndTrace(async () => {
|
||||||
await page.goto(`${server.PREFIX}/network-tab/network.html`);
|
await page.goto(`${server.PREFIX}/network-tab/network.html`);
|
||||||
|
await page.evaluate(() => (window as any).donePromise);
|
||||||
});
|
});
|
||||||
await traceViewer.selectAction('http://localhost');
|
await traceViewer.selectAction('http://localhost');
|
||||||
await traceViewer.showNetworkTab();
|
await traceViewer.showNetworkTab();
|
||||||
|
@ -413,6 +415,7 @@ test('should show font preview', async ({ page, runAndTrace, server }) => {
|
||||||
test('should filter network requests by url', async ({ page, runAndTrace, server }) => {
|
test('should filter network requests by url', async ({ page, runAndTrace, server }) => {
|
||||||
const traceViewer = await runAndTrace(async () => {
|
const traceViewer = await runAndTrace(async () => {
|
||||||
await page.goto(`${server.PREFIX}/network-tab/network.html`);
|
await page.goto(`${server.PREFIX}/network-tab/network.html`);
|
||||||
|
await page.evaluate(() => (window as any).donePromise);
|
||||||
});
|
});
|
||||||
await traceViewer.selectAction('http://localhost');
|
await traceViewer.selectAction('http://localhost');
|
||||||
await traceViewer.showNetworkTab();
|
await traceViewer.showNetworkTab();
|
||||||
|
|
|
@ -24,6 +24,7 @@ test('should filter network requests by resource type', async ({ runUITest, serv
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('network tab test', async ({ page }) => {
|
test('network tab test', async ({ page }) => {
|
||||||
await page.goto('${server.PREFIX}/network-tab/network.html');
|
await page.goto('${server.PREFIX}/network-tab/network.html');
|
||||||
|
await page.evaluate(() => (window as any).donePromise);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
|
@ -64,6 +65,7 @@ test('should filter network requests by url', async ({ runUITest, server }) => {
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('network tab test', async ({ page }) => {
|
test('network tab test', async ({ page }) => {
|
||||||
await page.goto('${server.PREFIX}/network-tab/network.html');
|
await page.goto('${server.PREFIX}/network-tab/network.html');
|
||||||
|
await page.evaluate(() => (window as any).donePromise);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
|
@ -100,6 +102,7 @@ test('should format JSON request body', async ({ runUITest, server }) => {
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('network tab test', async ({ page }) => {
|
test('network tab test', async ({ page }) => {
|
||||||
await page.goto('${server.PREFIX}/network-tab/network.html');
|
await page.goto('${server.PREFIX}/network-tab/network.html');
|
||||||
|
await page.evaluate(() => (window as any).donePromise);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
|
@ -142,6 +145,7 @@ test('should display list of query parameters (only if present)', async ({ runUI
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
test('network tab test', async ({ page }) => {
|
test('network tab test', async ({ page }) => {
|
||||||
await page.goto('${server.PREFIX}/network-tab/network.html');
|
await page.goto('${server.PREFIX}/network-tab/network.html');
|
||||||
|
await page.evaluate(() => (window as any).donePromise);
|
||||||
});
|
});
|
||||||
`,
|
`,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue