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): align navigation-runner with legacy gather-runner #12478

Merged
merged 6 commits into from
May 18, 2021

Conversation

patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented May 13, 2021

Summary
Won't work until #12469 is merged, but this brings fraggle rock up to snuff with gather runner and makes use of all the refactoring over the past month! 🎉

Related Issues/PRs
ref #11313

@google-cla google-cla bot added the cla: yes label May 13, 2021
@patrickhulce patrickhulce marked this pull request as ready for review May 17, 2021 15:27
@patrickhulce patrickhulce requested a review from a team as a code owner May 17, 2021 15:27
@patrickhulce patrickhulce requested review from adamraine and removed request for a team May 17, 2021 15:27
Copy link
Member

@adamraine adamraine left a comment

Choose a reason for hiding this comment

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

Nice work, very excited to use this!


const baseArtifacts = await getBaseArtifacts(config, driver);
baseArtifacts.URL.requestedUrl = requestedUrl;

await prepare.prepareTargetForNavigationMode(driver, config.settings);
Copy link
Member

Choose a reason for hiding this comment

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

Are we leaving this check out then or is it still TBD?

// Assert no service workers are still installed, so we test that they would actually be installed for a new user.
// TODO(FR-COMPAT): re-evaluate the necessity of this check
await GatherRunner.assertNoSameOriginServiceWorkerClients(session, options.requestedUrl);

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm intending on leaving it out as it's unrealistic to enforce in a puppeteer context, but I like leaving the TODO in as a callout. We'll probably end up converting it to a warning when we make a pass over our leftover TODOs soon

log.error('NavigationRunner', localizedMessage, navigationContext.requestedUrl);

return {artifacts: {}, warnings: [...warnings, pageLoadError.friendlyMessage], pageLoadError};
} else {
Copy link
Member

Choose a reason for hiding this comment

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

nit: don't need else

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ack

I intentionally added the else to make explicit the two paths this can take. IMO, without the else it's very easy to miss the return and think that the else bit is executed even in the case of a pageLoadError. I'm all for the early return pattern to avoid nesting but when it's a one-line and/or early check where the intention is clearer :) Convinced? or still prefer no else?

Copy link
Member

Choose a reason for hiding this comment

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

I still prefer no else but I won't die on this hill, it's your choice.

break;
}

// TODO(FR-COMPAT): merge RunWarnings between navigations
Copy link
Member

Choose a reason for hiding this comment

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

What's preventing us from doing this now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

PR size, the handling of runwarnings has a small cascade of other changes that already fit in well with the base artifacts cleanup I have left and was planning on putting up today.

Comment on lines -108 to -109
it.todo('should reset storage');
it.todo('should not reset storage when skipped');
Copy link
Member

Choose a reason for hiding this comment

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

The reset storage tests seem useful at least.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

agreed, but these are all tested in prepare-test.js now, I put these placeholders here when the runner was first added to capture what gather-runner did at the time, and didn't update as those pieces were stripped out of gather-runner into submodules.

Or were you commenting that an integration test where the preparation module isn't mocked would be preferred?

Copy link
Member

Choose a reason for hiding this comment

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

I was thinking these applied to the code in _cleanup as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah gotcha, for _cleanup! Yes good catch 👍

Co-authored-by: Adam Raine <6752989+adamraine@users.noreply.github.com>
const artifacts = await awaitArtifacts(phaseState.artifactState);
return {artifacts, warnings, pageLoadError: undefined};
}
}

/**
* @param {NavigationContext} navigationContext
Copy link
Member

Choose a reason for hiding this comment

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

@return

Copy link

@Anasnada Anasnada left a comment

Choose a reason for hiding this comment

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

@Elkemaa
Copy link

Elkemaa commented Aug 18, 2022

ملخص ~لن تعمل حتى يتم دمج # 12469 ، لكن~يؤدي هذا إلى ارتفاع مستوى صخرة الهشاشة مع عداء التجميع والاستفادة من جميع عمليات إعادة البناء على مدار الشهر الماضي!🎉

القضايا ذات الصلة / العلاقات العامة المرجع # 11313

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.

5 participants