Closed Bug 1907589 Opened 3 months ago Closed 3 months ago

Investigate puppeteer cache tests failing because responseCompleted is emitted too late

Categories

(Remote Protocol :: Agent, task, P2)

task

Tracking

(firefox130 fixed)

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

We added new tests using scripts instead of stylesheets to test cache scenarios with puppeteer.

Those tests seem to consistently pass upstream, however in our CI they fail intermittently.

An example of such a test looks like:

        const {page, server} = await getTestState();

        // Load and re-load to make sure it's cached.
        await page.goto(server.PREFIX + url);

        await page.setRequestInterception(true);
        await page.setCacheEnabled(true);
        page.on('request', request => {
          return request.continue({}, 0);
        });

        const cached: HTTPRequest[] = [];
        page.on('requestservedfromcache', r => {
          return cached.push(r);
        });

        await page.reload();
        expect(cached).toHaveLength(1);

The critical part here is that we call await page.reload(); and then expect that the cached request has already been received. This should be correct spec wise, because the cached request is for a script in the body of the page, so it should be fully loaded & parsed when load is emitted. However since Firefox emits responseCompleted events slightly late, this fails intermittently. It seems to fail more frequently in cases where the HTML page was served with a 304 Not Modified (presumably we emit load "faster" in this case?).

Fixing Bug 1882803 might address this issue, but otherwise we could update the tests to wait for the request instead of simply calling reload.

Points: --- → 2
Priority: -- → P2
Whiteboard: [webdriver:m12]
Depends on: 1882803

Tests have been enabled again.

Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Assignee: nobody → jdescottes
Target Milestone: --- → 130 Branch
Points: 2 → ---
Whiteboard: [webdriver:m12]
You need to log in before you can comment on or make changes to this bug.