mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-06 20:11:38 +08:00
Fix flaky e2e-tests in network_test.ts
Bug: 1093287 Change-Id: I2b9c91b78f9f2e7e42091786ad11013dffdc5cbf Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3629778 Reviewed-by: Danil Somsikov <dsv@chromium.org> Commit-Queue: Wolfgang Beyer <wolfi@chromium.org>
This commit is contained in:
committed by
Devtools-frontend LUCI CQ
parent
6fa122c18f
commit
57f2920874
@@ -4,7 +4,7 @@
|
||||
|
||||
import {assert} from 'chai';
|
||||
|
||||
import {$textContent, goTo, reloadDevTools, typeText, waitFor} from '../../shared/helper.js';
|
||||
import {$textContent, goTo, reloadDevTools, typeText, waitFor, waitForFunction} from '../../shared/helper.js';
|
||||
import {describe, it} from '../../shared/mocha-extensions.js';
|
||||
import {
|
||||
getAllRequestNames,
|
||||
@@ -48,19 +48,19 @@ describe('The Network Tab', async function() {
|
||||
await setPersistLog(false);
|
||||
});
|
||||
|
||||
// Flakey test
|
||||
it.skip('[crbug.com/1093287] displays requests', async () => {
|
||||
it('displays requests', async () => {
|
||||
await navigateToNetworkTab(SIMPLE_PAGE_URL);
|
||||
|
||||
// Wait for all the requests to be displayed + 1 to account for the page itself.
|
||||
await waitForSomeRequestsToAppear(SIMPLE_PAGE_REQUEST_NUMBER + 1);
|
||||
|
||||
const expectedNames = [SIMPLE_PAGE_URL];
|
||||
const expectedNames = [];
|
||||
for (let i = 0; i < SIMPLE_PAGE_REQUEST_NUMBER; i++) {
|
||||
expectedNames.push(`image.svg?id=${i}`);
|
||||
}
|
||||
expectedNames.push(SIMPLE_PAGE_URL);
|
||||
|
||||
const names = await getAllRequestNames();
|
||||
const names = (await getAllRequestNames()).sort();
|
||||
assert.deepStrictEqual(names, expectedNames, 'The right request names should appear in the list');
|
||||
});
|
||||
|
||||
@@ -85,20 +85,24 @@ describe('The Network Tab', async function() {
|
||||
assert.strictEqual(selected, lastRequestName, 'Selecting the last request should work');
|
||||
});
|
||||
|
||||
// Flakey test
|
||||
it.skip('[crbug.com/1093287] can persist requests', async () => {
|
||||
it('can persist requests', async () => {
|
||||
await navigateToNetworkTab(SIMPLE_PAGE_URL);
|
||||
|
||||
// Wait for all the requests to be displayed + 1 to account for the page itself, and get their names.
|
||||
await waitForSomeRequestsToAppear(SIMPLE_PAGE_REQUEST_NUMBER + 1);
|
||||
const firstPageRequestNames = await getAllRequestNames();
|
||||
const firstPageRequestNames = (await getAllRequestNames()).sort();
|
||||
|
||||
await setPersistLog(true);
|
||||
|
||||
// Navigate to a new page, and wait for the same requests to still be there.
|
||||
await goTo('about:blank');
|
||||
await waitForSomeRequestsToAppear(SIMPLE_PAGE_REQUEST_NUMBER + 1);
|
||||
const secondPageRequestNames = await getAllRequestNames();
|
||||
let secondPageRequestNames: (string|null)[] = [];
|
||||
await waitForFunction(async () => {
|
||||
secondPageRequestNames = await getAllRequestNames();
|
||||
return secondPageRequestNames.length === SIMPLE_PAGE_REQUEST_NUMBER + 1;
|
||||
});
|
||||
secondPageRequestNames.sort();
|
||||
|
||||
assert.deepStrictEqual(secondPageRequestNames, firstPageRequestNames, 'The requests were persisted');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user