Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(fr): convert additional base artifacts #12594

Merged
merged 9 commits into from
Jun 3, 2021
Merged

Conversation

adamraine
Copy link
Member

@adamraine adamraine commented Jun 1, 2021

Converts HostUserAgent, HostFormFactor, and BenchmarkIndex to true gatherers. This is a necessary step to convert ScriptElements which depends on HostFormFactor.

Land after #12510

@adamraine adamraine requested a review from a team as a code owner June 1, 2021 20:15
@adamraine adamraine requested review from patrickhulce and removed request for a team June 1, 2021 20:15
@google-cla google-cla bot added the cla: yes label Jun 1, 2021
Comment on lines 16 to 28
const HostUserAgent = (await getBrowserVersion(driver.defaultSession)).userAgent;

// Whether Lighthouse was run on a mobile device (i.e. not on a desktop machine).
const HostFormFactor =
HostUserAgent.includes('Android') || HostUserAgent.includes('Mobile') ? 'mobile' : 'desktop';

const BenchmarkIndex = await getBenchmarkIndex(driver.executionContext);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we keep this here so we don't need to provide a starting value for legacy base artifacts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to rebase this on top of https://github.com/GoogleChrome/lighthouse/pull/12510/files which fixes up most of our base artifact usage in FR

lighthouse-core/gather/gatherers/benchmark-index.js Outdated Show resolved Hide resolved
@@ -114,21 +114,13 @@ describe('NavigationRunner', () => {

it('should collect base artifacts', async () => {
const {baseArtifacts} = await runner._setup({driver, config, requestedUrl});
expect(baseArtifacts).toMatchObject({HostUserAgent: 'Chrome', URL: {requestedUrl}});
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HostUserAgent is not initialized in _setup anymore

Comment on lines -72 to -79
export type PhaseArtifact = |
LH.GathererArtifacts[keyof LH.GathererArtifacts] |
LH.Artifacts['devtoolsLogs'] |
LH.Artifacts['traces'] |
LH.Artifacts['WebAppManifest'] |
LH.Artifacts['InstallabilityErrors'] |
LH.Artifacts['Stacks'];
export type PhaseResultNonPromise = void|PhaseArtifact
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only difference here should be NetworkUserAgent

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HostFormFactor/HostUserAgent look great!

would you be OK rebasing and landing on top of https://github.com/GoogleChrome/lighthouse/pull/12510/files? I was holding off merging that as 8 got closer, but it solves a few of the callouts here :)

lighthouse-core/gather/gatherers/benchmark-index.js Outdated Show resolved Hide resolved
Comment on lines 16 to 28
const HostUserAgent = (await getBrowserVersion(driver.defaultSession)).userAgent;

// Whether Lighthouse was run on a mobile device (i.e. not on a desktop machine).
const HostFormFactor =
HostUserAgent.includes('Android') || HostUserAgent.includes('Mobile') ? 'mobile' : 'desktop';

const BenchmarkIndex = await getBenchmarkIndex(driver.executionContext);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might want to rebase this on top of https://github.com/GoogleChrome/lighthouse/pull/12510/files which fixes up most of our base artifact usage in FR

@google-cla
Copy link

google-cla bot commented Jun 1, 2021

☹️ Sorry, but only Googlers may change the label cla: yes.

@google-cla

This comment has been minimized.

@google-cla google-cla bot added cla: no and removed cla: yes labels Jun 1, 2021
@adamraine adamraine changed the base branch from master to fr_base_artifacts June 1, 2021 21:33
Base automatically changed from fr_base_artifacts to master June 2, 2021 18:54
@google-cla

This comment has been minimized.

@patrickhulce

This comment has been minimized.

@google-cla google-cla bot added cla: yes and removed cla: no labels Jun 2, 2021
* @return {Promise<LH.Artifacts['HostFormFactor']>}
*/
async getArtifact(context) {
const userAgent = context.dependencies.HostUserAgent;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time to start a breaking changes v9 issue to merge these :)

lighthouse-core/test/fraggle-rock/config/filters-test.js Outdated Show resolved Hide resolved
expect(artifacts.HostFormFactor).toEqual('desktop');
});

it('should fetch the mobile user agent', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll probably want to bring these tests back when we have the breaking change for 9.0 to merge those

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants