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

test: [M3-8517] - Cloud changes for component test CI #10926

Conversation

jdamore-linode
Copy link
Contributor

@jdamore-linode jdamore-linode commented Sep 12, 2024

Description 📝

This PR contains the changes needed to get the Cloud Manager component tests running via CI. There isn't too much testing that can be done for this, but I did add some information to the ticket related to validating these changes.

Changes 🔄

  • Added yarn cy:component:run command to run component tests via the CLI
  • Enables JUnit generation for component tests
  • Discards passed test recordings for component tests
  • Adds a Docker Compose service for running component tests
  • Fixes a region select test failure related to recent util changes

How to test 🧪

  • Run yarn cy:component:run and make sure tests run and pass
  • See the ticket comments for more info about testing and validation

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@jdamore-linode jdamore-linode self-assigned this Sep 12, 2024
@jdamore-linode jdamore-linode requested review from a team as code owners September 12, 2024 00:58
@jdamore-linode jdamore-linode requested review from AzureLatte, mjac0bs and hkhalil-akamai and removed request for a team September 12, 2024 00:58
Copy link

github-actions bot commented Sep 12, 2024

Coverage Report:
Base Coverage: 86.64%
Current Coverage: 86.64%

mochaFile: 'cypress/results/test-results-[hash].xml',
rootSuiteTitle: 'Cloud Manager Cypress Tests',
testsuitesTitle: testSuiteName,
jenkinsMode,
Copy link
Contributor Author

@jdamore-linode jdamore-linode Sep 12, 2024

Choose a reason for hiding this comment

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

I can't remember why we never set Jenkins mode to begin with, but it makes the output in the Jenkins run "Test" section a lot more readable. Sadly we can't just set this globally now that we have other teams like SRE who depend on our JUnit test results, so for right now this will only be set for the component test JUnit output

return setupPlugins(on, config, [
loadEnvironmentConfig,
discardPassedTestRecordings,
enableJunitReport('Component', true),
Copy link
Contributor Author

@jdamore-linode jdamore-linode Sep 12, 2024

Choose a reason for hiding this comment

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

@abailly-akamai For the UI tests, we added the CY_TEST_DISABLE_FILE_WATCHING env var to prevent the Cypress UI from automatically stopping and re-running tests when it detects file changes.

Do you think that behavior should apply to the component tests as well, or do we want to keep file watching enabled since developing these tests is more iterative / the tests run quickly?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's okay to make the behavior apply to both.
As far as I know, I don't ever set CY_TEST_DISABLE_FILE_WATCHING. I like having my files be watched when developing 👀

Copy link
Contributor

Choose a reason for hiding this comment

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

i do use CY_TEST_DISABLE_FILE_WATCHING, it's very helpful when working on resource intensive CY test and saving files often (rate limiting etc). Doesn't really apply as much for component tests as you mentioned, but applying the behavior to both makes sense to me as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to pose one last option: we can break this into 2 env vars so they can be configured independently, so @abailly-akamai you could keep file watching disabled for UI tests and enabled for component tests

Copy link
Contributor

Choose a reason for hiding this comment

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

I kinda prefer to have it control both so it's one less variable to remember (and also very few people seem to use it), but I can go either way

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense too -- there's already an overwhelming number of configuration options.

I'll make it apply to both, but this is easy to change so if it ever becomes a pain point we can always revisit 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I spoke too soon -- with component tests, it looks like the hot reloading is handled by Vite/our Vite config.

I think it could be changed dynamically using the CY_TEST_DISABLE_FILE_WATCHING env var, but the little bit of messing around I was doing with it started to get real hacky so I figure I'll just hold off unless this becomes a pain.

Copy link
Member

Choose a reason for hiding this comment

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

Good with me!

Copy link
Contributor

@abailly-akamai abailly-akamai left a comment

Choose a reason for hiding this comment

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

YESS. ty! Can't wait to make more strides towards real interactive component tests and reduce UI behavior testing with jest/vitest

@mjac0bs mjac0bs added Approved Multiple approvals and ready to merge! and removed Ready for Review labels Sep 12, 2024
@jdamore-linode jdamore-linode merged commit e9927fc into linode:develop Sep 12, 2024
18 of 19 checks passed
nikhagra-akamai pushed a commit to nikhagra-akamai/manager that referenced this pull request Sep 23, 2024
* Add component test Jenkinsfile

* Load fonts from index template, add `cy:component:run` command

* Add component test runner to Docker Compose file

* Fix region select component test

* Allow explicit suite name to be specified in JUnit report

* Expose env, discard passed test recordings, and enable JUnit output for Cypress Component tests

* Add changeset, make slight improvements to Docker Compose docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants