Skip to content
New issue

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

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

Already on GitHub? # to your account

test(pf5): fix broken tests after PF5 upgrades #1347

Merged
merged 27 commits into from
Sep 13, 2024

Conversation

tthvo
Copy link
Member

@tthvo tthvo commented Sep 9, 2024

Welcome to Cryostat! 👋

Before contributing, make sure you have:

  • Read the contributing guidelines
  • Linked a relevant issue which this PR resolves
  • Linked any other relevant issues, PR's, or documentation, if any
  • Resolved all conflicts, if any
  • Rebased your branch PR on top of the latest upstream main branch
  • Attached at least one of the following labels to the PR: [chore, ci, docs, feat, fix, test]
  • Signed all commits using a GPG signature

To recreate commits with GPG signature git fetch upstream && git rebase --force --gpg-#stream/main


Related to #1303

Description of the change:

Unit/Integration tests

Fixed broken tests after upgrading to Patternfly 5. This PR involves the following changes to the tests:

  • Updated snapshots. Some requires mocking ref (See below notes).
  • Corrected the display texts or aria-label texts that the tests use for locating the elements.
  • Wrapped codes that cause React state changes in act where applicable, for example, actions that opens modal.
  • Added/Removed tests to accommodate new designs, for example, label editor or range filters.

I also added some tips/notes (i.e. TESTING.md) that I figured out when fixing the tests.

Other bug fixes

Thanks to the unit tests, the following bugs are fixed:

  • Fixed bug where in bulk label editor, if a label input is invalid, all labels after that is removed. Only the invalid one should be removed.
  • Fixed agent template row action. This was missed in previous PRs.
  • Use SearchInput for agent template search bar (i.e. has Search icon for consistency).

Notes

There are some odd instances where snapshot test environment messes up DOM testing with react-testing-library. For example, createNodeMock (only for snapshot rendering) is leaked into other DOM tests.

Reordering the snapshot tests to last solved the problem. We might need some restructuring in #661 to split the 2 types of unit tests.

@tthvo tthvo changed the title test(pf5): fix broken unit tests after PF5 upgrades test(pf5): fix broken tests after PF5 upgrades Sep 9, 2024
@tthvo tthvo added the chore Refactor, rename, cleanup, etc. label Sep 10, 2024
@tthvo tthvo mentioned this pull request Sep 11, 2024
7 tasks
@tthvo tthvo marked this pull request as ready for review September 12, 2024 00:14
@tthvo tthvo requested a review from a team September 12, 2024 00:14
@tthvo
Copy link
Member Author

tthvo commented Sep 12, 2024

Pheww! I think the tests are all updated to accommodate the PF5 upgrades now :D

Not satisfied with it though, as many test logics are not yet standardized (i.e. repeated or done differently). I hope there will be some time to get to #848 to clean things up :D

And many thanks again to @maxcao13 for helping out with this work!!!

@andrewazores
Copy link
Member

I'll start reviewing this now, but it might take a bit of time :-)

@andrewazores andrewazores merged commit 40d1582 into cryostatio:pf5 Sep 13, 2024
18 checks passed
@tthvo tthvo deleted the pf5-rec-tests branch September 13, 2024 14:52
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
chore Refactor, rename, cleanup, etc. safe-to-test test
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants