From 22c0ce63ce4334047df6c2c8457569c191ef44e1 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Tue, 4 Sep 2018 19:05:48 +0100 Subject: [PATCH] test: cleanup newly added test for navigation referer (#3179) Make sure that referer that is passed as `page.goto` option doesn't override subrequest referers. --- test/page.spec.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/page.spec.js b/test/page.spec.js index 66189b10..9c1d0f9b 100644 --- a/test/page.spec.js +++ b/test/page.spec.js @@ -755,15 +755,16 @@ module.exports.addTests = function({testRunner, expect, headless}) { expect(error.message).toContain(url); }); it('should send referer', async({page, server}) => { - await page.setRequestInterception(true); - page.on('request', request => request.continue()); - const [request] = await Promise.all([ + const [request1, request2] = await Promise.all([ server.waitForRequest('/grid.html'), + server.waitForRequest('/digits/1.png'), page.goto(server.PREFIX + '/grid.html', { referer: 'http://google.com/', }), ]); - expect(request.headers['referer']).toBe('http://google.com/'); + expect(request1.headers['referer']).toBe('http://google.com/'); + // Make sure subresources do not inherit referer. + expect(request2.headers['referer']).toBe(server.PREFIX + '/grid.html'); }); });