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

chore(server): enable caching global session state #23600

Merged
merged 21 commits into from
Sep 16, 2022

Conversation

emilyrohrbough
Copy link
Member

Update server backend to allow persisting global sessions across specs. This break out the back-end work related to introducing this cy.session() behavior.

User facing changelog

  • N/A this work is on the back-end and wont impact users at this point in time.

  • Have tests been added/updated?

  • [n/a] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)

  • [n/a] Has a PR for user-facing changes been opened in cypress-documentation?

  • [n/a] Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Aug 29, 2022

Thanks for taking the time to open a PR!

@emilyrohrbough emilyrohrbough self-assigned this Aug 29, 2022
@emilyrohrbough emilyrohrbough added the topic: session Issues when using session command label Aug 29, 2022
@emilyrohrbough emilyrohrbough requested review from mschile, chrisbreiding, AtofStryker and mjhenkes and removed request for mschile August 29, 2022 22:35
@cypress
Copy link

cypress bot commented Aug 29, 2022



Test summary

40097 0 3354 0Flakiness 1


Run details

Project cypress
Status Passed
Commit 8f40285
Started Sep 16, 2022 3:44 PM
Ended Sep 16, 2022 3:59 PM
Duration 15:38 💡
OS Linux Debian - 11.3
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/e2e/origin/config_env.cy.ts Flakiness
1 cy.origin- Cypress.config() > serializable > overwrites different values in secondary, even if the Cypress.config() value does not exist in the primary

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

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

This has me thinking... I wonder if we need to do anything with the server side cookie jar when it comes to preserving/restoring sessions... 🤔

packages/driver/src/cy/commands/navigation.ts Outdated Show resolved Hide resolved
packages/driver/src/cy/commands/navigation.ts Outdated Show resolved Hide resolved
packages/driver/src/cy/commands/navigation.ts Outdated Show resolved Hide resolved
packages/driver/src/cypress.ts Outdated Show resolved Hide resolved
const reporterEvents: ReporterEvent[] = [
] as const

const reporterEvents = [
Copy link
Contributor

Choose a reason for hiding this comment

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

Would we want to leverage freeze here instead to persist to JS files, or is that too aggressive? As I am typing this I think the cast to const is probably enough 😆

Copy link
Member Author

@emilyrohrbough emilyrohrbough Sep 1, 2022

Choose a reason for hiding this comment

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

I'm not a types expert 😬 We've done this in other places so I took it as a opportunity to remove some redundancies. I'll take all suggestions

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the main difference here is that one would prevent types being pushed in at runtime vs just a TS check. Honestly don't think it matters too much either way

packages/server/lib/socket-base.ts Show resolved Hide resolved
@chrisbreiding
Copy link
Contributor

Looks good, though it seems there a some CI failures that need addressing. Since the front-end of the this isn't implemented here, is there a way I can test this out?

emilyrohrbough and others added 6 commits September 14, 2022 10:01
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
# Conflicts:
#	packages/app/src/runner/event-manager.ts
#	packages/runner/src/studio/studio-recorder.js
#	packages/types/src/driver.ts
@@ -1162,26 +1164,26 @@ export default (Commands, Cypress, cy, state, config) => {
// tell our backend we're changing origins
// TODO: add in other things we want to preserve
// state for like scrollTop
let s: Record<string, any> = {
let runState: RunState = {
Copy link
Contributor

Choose a reason for hiding this comment

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

🙏🏻

const reporterEvents: ReporterEvent[] = [
] as const

const reporterEvents = [
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the main difference here is that one would prevent types being pushed in at runtime vs just a TS check. Honestly don't think it matters too much either way

packages/server/lib/socket-base.ts Show resolved Hide resolved
packages/server/lib/experiments.ts Outdated Show resolved Hide resolved
emilyrohrbough and others added 2 commits September 16, 2022 10:35
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
@emilyrohrbough emilyrohrbough merged commit fac44fa into develop Sep 16, 2022
@emilyrohrbough emilyrohrbough deleted the cache-sessions-server branch September 16, 2022 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: session Issues when using session command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants