Skip to content

Update DB capture to run before spec in local - #10321

Merged
jrafanie merged 1 commit into
ManageIQ:masterfrom
asirvadAbrahamVarghese:update-cypress-config
Oct 8, 2026
Merged

jrafanie merged 1 commit into
ManageIQ:masterfrom
asirvadAbrahamVarghese:update-cypress-config

Conversation

@asirvadAbrahamVarghese

@asirvadAbrahamVarghese asirvadAbrahamVarghese commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

#10026 follow-up

What I’m running into with db_state capture in before:run is that the cy.appDbState('restore') call ends up clearing other data created through the UI while Cypress is still open:

For example:

  • Opened cypress in run mode and ran schedule form test (DB state is captured initially)
  • While Cypress is still open, I go through UI and create some other data, say a catalog item
  • Came back to schedule test and ran it again (has a restore call in afterEach)
  • Since the DB state was captured only when Cypress started, the restore also clears the catalog item created through the UI

I feel like, for local runs, capturing the DB state before each spec would be better

@Fryguy Fryguy added the cypress label Sep 18, 2026
@asirvadAbrahamVarghese
asirvadAbrahamVarghese marked this pull request as ready for review September 21, 2026 04:12
@asirvadAbrahamVarghese
asirvadAbrahamVarghese requested a review from a team as a code owner September 21, 2026 04:12
@Fryguy Fryguy added the test label Sep 23, 2026
@miq-bot

miq-bot commented Sep 29, 2026

Copy link
Copy Markdown
Member

Checked commit asirvadAbrahamVarghese@67b22eb with ruby 3.3.12, rubocop 1.91.0, haml-lint 0.78.0, and yamllint 1.37.1
0 files checked, 0 offenses detected
Everything looks fine. ⭐

@jrafanie

jrafanie commented Oct 6, 2026

Copy link
Copy Markdown
Member

Make sense to me. @asirvadAbrahamVarghese since this is conditional on CI, we need to be careful about other run/open modes. I feel like we only want to do this in open mode. Thoughts?

@asirvadAbrahamVarghese

Copy link
Copy Markdown
Contributor Author

I feel like we only want to do this in open mode

Good call, that’s even better

Comment thread cypress.config.js
on('before:run', () => captureDbState());
} else if (config.isInteractive){
// open mode (cypress open) — capture per-spec to pick up any manual UI changes
on('before:spec', () => captureDbState());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

do we need an else for when it's not CI and not interactive (open)?

Or easier, would swap it and do if interactive, use before:spec, else, before:run?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right. My bad

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's all good. Looks good to me!

@jrafanie jrafanie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment thread cypress.config.js
on('before:run', () => captureDbState());
} else if (config.isInteractive){
// open mode (cypress open) — capture per-spec to pick up any manual UI changes
on('before:spec', () => captureDbState());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's all good. Looks good to me!

@jrafanie

jrafanie commented Oct 8, 2026

Copy link
Copy Markdown
Member

bumping after ManageIQ/manageiq#24003 merge

@jrafanie jrafanie closed this Oct 8, 2026
@jrafanie jrafanie reopened this Oct 8, 2026
@jrafanie
jrafanie merged commit beda105 into ManageIQ:master Oct 8, 2026
14 of 20 checks passed
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.

4 participants