Skip to content

Commit c679a6c

Browse files
fix
1 parent 1a87f3f commit c679a6c

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/PageCollector.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,7 @@ export class NetworkCollector extends PageCollector<HTTPRequest> {
191191
// navigation request itself.
192192
// Keep the reference
193193
if (lastRequestIdx) {
194-
const fromCurrentNavigation = requests.splice(
195-
Math.min(lastRequestIdx, 0),
196-
);
194+
const fromCurrentNavigation = requests.splice(lastRequestIdx);
197195
navigations.unshift(fromCurrentNavigation);
198196
} else {
199197
navigations.unshift([]);

tests/PageCollector.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ describe('PageCollector', () => {
222222
});
223223

224224
describe('NetworkCollector', () => {
225-
it('clean up after navigation and be able to add data after', async () => {
225+
it('correctly picks up navigation requests to latest navigation', async () => {
226226
const browser = getMockBrowser();
227227
const page = (await browser.pages())[0];
228228
const mainFrame = page.mainFrame();
@@ -248,6 +248,6 @@ describe('NetworkCollector', () => {
248248

249249
assert.equal(collector.getData(page).length, 2);
250250
assert.equal(collector.getData(page)[0], navRequest);
251-
assert.equal(collector.getData(page)[0], request2);
251+
assert.equal(collector.getData(page)[1], request2);
252252
});
253253
});

0 commit comments

Comments
 (0)