diff --git a/lighthouse-cli/test/fixtures/redirects-self.html b/lighthouse-cli/test/fixtures/redirects-self.html deleted file mode 100644 index 33db793aba33..000000000000 --- a/lighthouse-cli/test/fixtures/redirects-self.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - -

Redirect to myself

- - - diff --git a/lighthouse-cli/test/smokehouse/core-tests.js b/lighthouse-cli/test/smokehouse/core-tests.js index 23cfbd390b58..baa0ae672205 100644 --- a/lighthouse-cli/test/smokehouse/core-tests.js +++ b/lighthouse-cli/test/smokehouse/core-tests.js @@ -53,7 +53,6 @@ import redirectsHistoryPushState from './test-definitions/redirects-history-push import redirectsMultipleServer from './test-definitions/redirects-multiple-server.js'; import redirectsSingleClient from './test-definitions/redirects-single-client.js'; import redirectsSingleServer from './test-definitions/redirects-single-server.js'; -import redirectsSelf from './test-definitions/redirects-self.js'; import screenshot from './test-definitions/screenshot.js'; import seoFailing from './test-definitions/seo-failing.js'; import seoPassing from './test-definitions/seo-passing.js'; @@ -112,7 +111,6 @@ const smokeTests = [ redirectsMultipleServer, redirectsSingleClient, redirectsSingleServer, - redirectsSelf, screenshot, seoFailing, seoPassing, diff --git a/lighthouse-cli/test/smokehouse/test-definitions/redirects-self.js b/lighthouse-cli/test/smokehouse/test-definitions/redirects-self.js deleted file mode 100644 index 2de7936fe8eb..000000000000 --- a/lighthouse-cli/test/smokehouse/test-definitions/redirects-self.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @license Copyright 2022 The Lighthouse Authors. All Rights Reserved. - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ -'use strict'; - -/** - * @type {Smokehouse.ExpectedRunnerResult} - */ -const expectations = { - artifacts: { - MainDocumentContent: /Redirect to myself/, - }, - lhr: { - requestedUrl: 'http://localhost:10200/redirects-self.html', - finalUrl: 'http://localhost:10200/redirects-self.html?done=', - audits: { - }, - runWarnings: [ - 'The page may not be loading as expected because your test URL (http://localhost:10200/redirects-self.html) was redirected to http://localhost:10200/redirects-self.html?done=. Try testing the second URL directly.', - ], - }, -}; - -export default { - id: 'redirects-self', - expectations, -}; - diff --git a/lighthouse-core/fraggle-rock/gather/navigation-runner.js b/lighthouse-core/fraggle-rock/gather/navigation-runner.js index 9f1d32e1ab41..78d751fec6fe 100644 --- a/lighthouse-core/fraggle-rock/gather/navigation-runner.js +++ b/lighthouse-core/fraggle-rock/gather/navigation-runner.js @@ -210,7 +210,6 @@ async function _computeNavigationResult( async function _navigation(navigationContext) { const artifactState = getEmptyArtifactState(); const phaseState = { - url: await navigationContext.driver.url(), gatherMode: /** @type {const} */ ('navigation'), driver: navigationContext.driver, computedCache: navigationContext.computedCache, @@ -224,7 +223,6 @@ async function _navigation(navigationContext) { await collectPhaseArtifacts({phase: 'startInstrumentation', ...phaseState}); await collectPhaseArtifacts({phase: 'startSensitiveInstrumentation', ...phaseState}); const navigateResult = await _navigate(navigationContext); - phaseState.url = navigateResult.finalUrl; await collectPhaseArtifacts({phase: 'stopSensitiveInstrumentation', ...phaseState}); await collectPhaseArtifacts({phase: 'stopInstrumentation', ...phaseState}); await _cleanupNavigation(navigationContext); diff --git a/lighthouse-core/fraggle-rock/gather/runner-helpers.js b/lighthouse-core/fraggle-rock/gather/runner-helpers.js index 903d4dda6de8..4521e2832839 100644 --- a/lighthouse-core/fraggle-rock/gather/runner-helpers.js +++ b/lighthouse-core/fraggle-rock/gather/runner-helpers.js @@ -15,7 +15,6 @@ * @property {LH.Gatherer.GatherMode} gatherMode * @property {Map} computedCache * @property {LH.Config.Settings} settings - * @property {string} url */ /** @typedef {Record>} IntermediateArtifacts */ @@ -75,7 +74,6 @@ async function collectPhaseArtifacts(options) { gatherMode, computedCache, settings, - url, } = options; const priorPhase = phaseToPriorPhase[phase]; const priorPhaseArtifacts = (priorPhase && artifactState[priorPhase]) || {}; @@ -92,7 +90,7 @@ async function collectPhaseArtifacts(options) { : /** @type {Dependencies} */ ({}); return gatherer[phase]({ - url, + url: await driver.url(), gatherMode, driver, baseArtifacts, diff --git a/lighthouse-core/fraggle-rock/gather/snapshot-runner.js b/lighthouse-core/fraggle-rock/gather/snapshot-runner.js index 8962dce3cd64..ba2c87c27814 100644 --- a/lighthouse-core/fraggle-rock/gather/snapshot-runner.js +++ b/lighthouse-core/fraggle-rock/gather/snapshot-runner.js @@ -27,7 +27,7 @@ async function snapshot(options) { /** @type {Map} */ const computedCache = new Map(); - const url = await driver.url(); + const url = await options.page.url(); const runnerOptions = {config, computedCache}; const artifacts = await Runner.gather( @@ -39,7 +39,6 @@ async function snapshot(options) { const artifactDefinitions = config.artifacts || []; const artifactState = getEmptyArtifactState(); await collectPhaseArtifacts({ - url, phase: 'getArtifact', gatherMode: 'snapshot', driver, diff --git a/lighthouse-core/fraggle-rock/gather/timespan-runner.js b/lighthouse-core/fraggle-rock/gather/timespan-runner.js index 66ee6ac419db..27b85be4b708 100644 --- a/lighthouse-core/fraggle-rock/gather/timespan-runner.js +++ b/lighthouse-core/fraggle-rock/gather/timespan-runner.js @@ -32,12 +32,11 @@ async function startTimespan(options) { /** @type {Map} */ const computedCache = new Map(); const artifactDefinitions = config.artifacts || []; - const requestedUrl = await driver.url(); + const requestedUrl = await options.page.url(); const baseArtifacts = await getBaseArtifacts(config, driver, {gatherMode: 'timespan'}); const artifactState = getEmptyArtifactState(); /** @type {Omit} */ const phaseOptions = { - url: requestedUrl, driver, artifactDefinitions, artifactState, @@ -53,9 +52,7 @@ async function startTimespan(options) { return { async endTimespan() { - const finalUrl = await driver.url(); - phaseOptions.url = finalUrl; - + const finalUrl = await options.page.url(); const runnerOptions = {config, computedCache}; const artifacts = await Runner.gather( async () => { diff --git a/lighthouse-core/test/fraggle-rock/gather/mock-driver.js b/lighthouse-core/test/fraggle-rock/gather/mock-driver.js index 8570d1ccb7e5..0dbb11c1bc06 100644 --- a/lighthouse-core/test/fraggle-rock/gather/mock-driver.js +++ b/lighthouse-core/test/fraggle-rock/gather/mock-driver.js @@ -129,7 +129,7 @@ function createMockDriver() { _page: page, _executionContext: context, _session: session, - url: jest.fn(() => page.url()), + url: () => page.url(), defaultSession: session, connect: jest.fn(), disconnect: jest.fn(), diff --git a/lighthouse-core/test/fraggle-rock/gather/runner-helpers-test.js b/lighthouse-core/test/fraggle-rock/gather/runner-helpers-test.js index 4376dda1dc35..cd17908c3d2e 100644 --- a/lighthouse-core/test/fraggle-rock/gather/runner-helpers-test.js +++ b/lighthouse-core/test/fraggle-rock/gather/runner-helpers-test.js @@ -132,7 +132,6 @@ describe('collectPhaseArtifacts', () => { it(`should run the ${phase} phase of gatherers in ${gatherMode} mode`, async () => { const {artifactDefinitions, gatherers} = createGathererSet(); await helpers.collectPhaseArtifacts({ - url: 'https://example.com', driver, artifactDefinitions, artifactState, @@ -157,7 +156,6 @@ describe('collectPhaseArtifacts', () => { it('should gather the artifacts', async () => { const {artifactDefinitions} = createGathererSet(); await helpers.collectPhaseArtifacts({ - url: 'https://example.com', driver, artifactDefinitions, artifactState, @@ -190,7 +188,6 @@ describe('collectPhaseArtifacts', () => { ]; await helpers.collectPhaseArtifacts({ - url: 'https://example.com', driver, artifactDefinitions, artifactState, @@ -224,7 +221,6 @@ describe('collectPhaseArtifacts', () => { const {artifactDefinitions, gatherers} = createGathererSet(); await helpers.collectPhaseArtifacts({ - url: 'https://example.com', driver, artifactDefinitions, artifactState, diff --git a/lighthouse-core/test/fraggle-rock/gather/snapshot-runner-test.js b/lighthouse-core/test/fraggle-rock/gather/snapshot-runner-test.js index 39125dee3e72..b74c11572148 100644 --- a/lighthouse-core/test/fraggle-rock/gather/snapshot-runner-test.js +++ b/lighthouse-core/test/fraggle-rock/gather/snapshot-runner-test.js @@ -71,7 +71,7 @@ describe('Snapshot Runner', () => { }); it('should collect base artifacts', async () => { - mockDriver.url.mockResolvedValue('https://lighthouse.example.com/'); + mockPage.url.mockResolvedValue('https://lighthouse.example.com/'); await snapshot({page, config}); const artifacts = await mockRunner.gather.mock.calls[0][0](); diff --git a/lighthouse-core/test/fraggle-rock/gather/timespan-runner-test.js b/lighthouse-core/test/fraggle-rock/gather/timespan-runner-test.js index 48f866d3d957..d89b9d4184ad 100644 --- a/lighthouse-core/test/fraggle-rock/gather/timespan-runner-test.js +++ b/lighthouse-core/test/fraggle-rock/gather/timespan-runner-test.js @@ -90,11 +90,11 @@ describe('Timespan Runner', () => { }); it('should collect base artifacts', async () => { - mockDriver.url.mockResolvedValue('https://start.example.com/'); + mockPage.url.mockResolvedValue('https://start.example.com/'); const timespan = await startTimespan({page, config}); - mockDriver.url.mockResolvedValue('https://end.example.com/'); + mockPage.url.mockResolvedValue('https://end.example.com/'); await timespan.endTimespan(); const artifacts = await mockRunner.gather.mock.calls[0][0]();