Skip to content

Edit collect logs form cypress refactor #9516

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

asirvadAbrahamVarghese
Copy link
Contributor

PR that refactors Cypress tests for Collect Logs edit form also include review comments changes from #9508

@miq-bot assign @jrafanie
@miq-bot add-label cypress
@miq-bot add-label test

@asirvadAbrahamVarghese asirvadAbrahamVarghese requested a review from a team as a code owner July 9, 2025 13:52
@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the edit-collect-logs-form-cypress-refactor branch from df8d9be to b6be458 Compare July 10, 2025 05:38
@asirvadAbrahamVarghese
Copy link
Contributor Author

asirvadAbrahamVarghese commented Jul 10, 2025

This is also prone to sporadic server-related failures, as we’ve seen with the schedules form:
image

@asirvadAbrahamVarghese
Copy link
Contributor Author

asirvadAbrahamVarghese commented Jul 10, 2025

comment - When #9504 gets merged, we can use the helper function here.
comment - Note, checking for "saved" in the message is probably all we need.
comment - Also, we can merge this now and open a new PR to update to the helper function cy.expectFlash('success', 'saved')

comment - Note, the hardcoded 2 in these intercepts here and the tree select feel brittle to me. I wonder if we need to be this precise with the intercepts. Can we use glob pattern matching or are there similar POSTs that occur that we have to avoid intercept/waiting on?

@jrafanie
Copy link
Member

This is also prone to sporadic server-related failures, as we’ve seen with the schedules form:

sorry, I can't read the error in the screenshot. Is that the session issue losing the tree info? undefined method to_sym for nil or undefined method split for nil: #9515?

@asirvadAbrahamVarghese
Copy link
Contributor Author

sorry, I can't read the error in the screenshot. Is that the session issue losing the tree info? undefined method to_sym for nil or undefined method split for nil

Yes a similar one, Data undefined method downcase' for nil [ops/accordion_select] (replaced the screenshot)

@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the edit-collect-logs-form-cypress-refactor branch from b6be458 to a5142fd Compare July 16, 2025 06:08
@miq-bot
Copy link
Member

miq-bot commented Jul 16, 2025

Checked commits asirvadAbrahamVarghese/manageiq-ui-classic@1d5b2a8~...a5142fd with ruby 3.1.7, rubocop 1.56.3, haml-lint 0.64.0, and yamllint
0 files checked, 0 offenses detected
Everything looks fine. 🍰

@jrafanie
Copy link
Member

sorry, I can't read the error in the screenshot. Is that the session issue losing the tree info? undefined method to_sym for nil or undefined method split for nil

Yes a similar one, Data undefined method downcase' for nil [ops/accordion_select] (replaced the screenshot)

Ok, I still have to get back to that one but I'm pretty sure it's a session race condition where one puma thread overwrites another threads session update.

}

function resetButtonValidation() {
// Confirm Reset button is disabled initially
cy.get('#diagnostics_collect_logs .bx--btn-set button[type="button"]')
.contains('Reset')
.contains(resetButton)
Copy link
Member

Choose a reason for hiding this comment

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

FYI, I just learned that cypress will retry the last query it did until the timeout. If you do cy.contains(selector, text), it will retry the whole thing and not just the contains call. If we rerender things and update the DOM element, we should probably avoid doing cy.get(selector).contains(string) as we may get the element before it's updated in the DOM. Instead, we should use cy.contains(selector+sub element, string)

https://www.youtube.com/watch?v=VSIaDbv4GyE

See also:
https://youtu.be/AhgkBjOF5Ts?t=1530

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am thinking about making this as a new custom command, like I mentioned here

Cypress.Commands.add('getFormFooterButtonByType', (type, name) => {
  return cy.contains(`#main-content .bx--btn-set button[type="${type}"]`, name);
});

flashMessageOperationCanceled,
} = textConstants;

function interceptAndAwaitApi({
Copy link
Member

Choose a reason for hiding this comment

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

We might want to extract this to a custom command for use in other tests.

@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the edit-collect-logs-form-cypress-refactor branch 3 times, most recently from 4491ed3 to dca3967 Compare July 29, 2025 09:13
@asirvadAbrahamVarghese asirvadAbrahamVarghese force-pushed the edit-collect-logs-form-cypress-refactor branch from dca3967 to 0b9cb2e Compare July 29, 2025 13:38
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