diff --git a/test/e2e/network/network_test.ts b/test/e2e/network/network_test.ts index 4b4010de1f..ac673f6098 100644 --- a/test/e2e/network/network_test.ts +++ b/test/e2e/network/network_test.ts @@ -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'); });