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

Create E2E tests for cluster CRUD operations #6284

Merged
merged 19 commits into from
Aug 17, 2022

Conversation

cnotv
Copy link
Contributor

@cnotv cnotv commented Jul 7, 2022

Summary

Fixes #5990
Write E2E tests for cluster CRUD operations through cluster manager page.
Note: This excludes registration and provisioning.

Occurred changes and/or fixed issues

  • Added E2E tests for CRUD operations with clusters
  • Extended documentation regards E2E development
    • Naming conventions
    • Cypress Dashboard
    • Debugging
    • Custom commands

New issues

Technical notes summary

Important! Update packages with yarn due new changes to Cypress 10.

  • Added id based find() related Cypress command
  • Extended findId() and getId() Cypress to accept optional argument for matching CSS selection symbol
  • Added several data-testid attributes
  • Added componentTestId prop on several component to override attribute in duplicated cases
  • Prevent issues on bulk cluster delete
  • Prevent issues with ClusterProvider if no mgmt is provided
  • Added ability to link Cypress dashboard to personal Cypress project ID

Tests executed locally may actually fail as the user preferences may not match, which is why I've been created another issue for that.

Areas or cases that should be tested

Areas which could experience regressions

Screenshot/Video

Please refer to the check and logs.
Example run from the dashboard: http://139.59.134.103:8080/instance/8db3cf97-6d46-45de-9c14-2cdab137f69f

@github-actions github-actions bot added this to the v2.6.7 milestone Jul 7, 2022
@cnotv cnotv removed the request for review from catherineluse July 7, 2022 09:57
@cnotv cnotv marked this pull request as draft July 7, 2022 16:32
@cnotv cnotv force-pushed the feature/5990-e2e-cluster branch from d3ca1c0 to c31e62d Compare July 7, 2022 16:44
@cnotv cnotv marked this pull request as ready for review July 7, 2022 19:53
@cnotv cnotv marked this pull request as draft July 8, 2022 08:12
@cnotv cnotv force-pushed the feature/5990-e2e-cluster branch from 3f589cb to f128d45 Compare July 8, 2022 14:01
@cnotv
Copy link
Contributor Author

cnotv commented Jul 8, 2022

I am facing an actual issue while removing manually in bulk the clusters:

Screenshot 2022-07-08 at 19 38 45
Screenshot 2022-07-08 at 19 38 53

@cnotv cnotv force-pushed the feature/5990-e2e-cluster branch from f3fb5e1 to e2829a6 Compare July 8, 2022 17:46
@nwmac nwmac modified the milestones: v2.6.7, v2.7.0 Jul 20, 2022
@cnotv cnotv force-pushed the feature/5990-e2e-cluster branch 2 times, most recently from 4b8dafc to f6e70b3 Compare July 26, 2022 11:42
@cnotv cnotv marked this pull request as ready for review July 26, 2022 12:25
@cnotv cnotv marked this pull request as draft July 26, 2022 14:53
@cnotv
Copy link
Contributor Author

cnotv commented Jul 26, 2022

I keep getting randomly 500 on POST request only when running in CI.

Cluster Manager -- can create new local RKE2 custom cluster (failed)

@cnotv cnotv force-pushed the feature/5990-e2e-cluster branch 7 times, most recently from f3b89ff to ab31a7b Compare July 27, 2022 22:05
@cnotv cnotv marked this pull request as ready for review July 27, 2022 23:21
@cnotv
Copy link
Contributor Author

cnotv commented Jul 27, 2022

I've executed the tests 3 times after rebasing master and it seems to work fine now.
Wonder why is that 🤔

@cnotv cnotv requested a review from catherineluse July 28, 2022 07:48
@cnotv cnotv force-pushed the feature/5990-e2e-cluster branch from cfd8d11 to a64c2c8 Compare August 5, 2022 08:05
Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

  • I made some suggestions on test names to clarify the type of clusters (imported generic cluster and RKE2 custom cluster). This makes it easier to know which other types we'll need to cover in the future, and clearer if we need to reproduce failing tests locally.
  • This PR would be a perfect time to create basic POs for common components that will enable everyone to start creating e2e tests quickly (and without everyone trying to create the same components at the same time). There's a number that should be created, such as
    • Cluster page PO
      • includes selecting clusters and rke toggle
    • Cluster create page POs for the two cluster types
    • NameNsDescription PO
      • convenience getters for name, ns, description labelled input POs
    • Action menu PO
      • get options, click on an option
    • lists (column values, action menu PO for a row)
      • get rows with their column values
      • convenience method to get a row's action menu
      • convenience method to get row count
  • I tried running yarn run e2e:dev but got the error below. It looks like we can't now tell e2e to run off of an existing dashboard or run the tests without having to make a build first. Being able to update the core dashboard code is incredibly helpful when writing tests. I then tried to make a manual
    •  FATAL  No build files found in /home/richard/dev/github/rancher/dashboard-giu/.nuxt/dist/server.                                                                                                        14:46:29
      Use either `nuxt build` or `builder.build()` or start nuxt in development mode.
      
  • After manually building the dashboard i tried again with yarn run e2e:dev but got the below error. How does the sorry cypress dashboard work, does it need to run locally... or do local tests go to the remote instance? How can i disable recording when running tests locally?
    • [cy2] Running cypress with API URL: http://139.59.134.103:1234
      You passed the --record flag but this project has not been setup to record.
      

shell/plugins/dashboard-store/mutations.js Show resolved Hide resolved
shell/plugins/dashboard-store/mutations.js Show resolved Hide resolved
cypress/e2e/tests/pages/cluster-manager.spec.ts Outdated Show resolved Hide resolved
cypress/e2e/tests/pages/cluster-manager.spec.ts Outdated Show resolved Hide resolved
cypress/e2e/tests/pages/cluster-manager.spec.ts Outdated Show resolved Hide resolved
cypress/e2e/tests/pages/cluster-manager.spec.ts Outdated Show resolved Hide resolved
cypress/e2e/tests/pages/cluster-manager.spec.ts Outdated Show resolved Hide resolved
cypress/e2e/tests/pages/cluster-manager.spec.ts Outdated Show resolved Hide resolved
cypress/e2e/tests/pages/cluster-manager.spec.ts Outdated Show resolved Hide resolved
@cnotv
Copy link
Contributor Author

cnotv commented Aug 9, 2022

@richard-cox

  • I tried running yarn run e2e:dev but got the error below. It looks like we can't now tell e2e to run off of an existing dashboard or run the tests without having to make a build first. Being able to update the core dashboard code is incredibly helpful when writing tests. I then tried to make a manual

    •  FATAL  No build files found in /home/richard/dev/github/rancher/dashboard-giu/.nuxt/dist/server.                                                                                                        14:46:29
      Use either `nuxt build` or `builder.build()` or start nuxt in development mode.
      
  • After manually building the dashboard i tried again with yarn run e2e:dev but got the below error. How does the sorry cypress dashboard work, does it need to run locally... or do local tests go to the remote instance? How can i disable recording when running tests locally?

As defined in the documentation:

Development with watch/dev
While writing the tests, you can simply run Rancher dashboard and then open the Cypress dashboard with the commands

yarn dev
yarn cy:open

Then you just browse the tests.

@cnotv
Copy link
Contributor Author

cnotv commented Aug 9, 2022

@richard-cox I rather prefer create a separated issue were we identify the PO for the cluster, as the scope of this issue is just to have reliable tests. #6627

@cnotv cnotv requested a review from richard-cox August 9, 2022 22:08
@cnotv
Copy link
Contributor Author

cnotv commented Aug 9, 2022

Screenshot 2022-08-10 at 00 36 24
New random error.

Copy link
Member

@richard-cox richard-cox left a comment

Choose a reason for hiding this comment

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

I've spoken with Neil and this PR can go in (with a squash merge and once 2.6.7 is out). I've created #6675 that adds the POs and fixes any remaining issues from this PR.

@cnotv
Copy link
Contributor Author

cnotv commented Aug 17, 2022

The current structure of the tests is breaking as it's not anymore in the right order. I'll may have to revert the last change or shift all the tests under the same hood.

@cnotv
Copy link
Contributor Author

cnotv commented Aug 17, 2022

Suddenly it seems like there's some errors which prevent to actually create clusters.
Screenshot 2022-08-17 at 18 30 01

It seems caused by the ResourceDetail not been able to pass the data value correctly, which should later on be replaced by the router parameters.
I'm reverting the change as it may be extended later on.
Same for the element in the provisioning.cattle.io.cluster editor.

Screenshot 2022-08-17 at 18 35 51

@cnotv cnotv force-pushed the feature/5990-e2e-cluster branch from 3271e0a to b16ac10 Compare August 17, 2022 16:46
@cnotv
Copy link
Contributor Author

cnotv commented Aug 17, 2022

I'm re-running trice the tests, to have a bit more chances to avoid flaky tests (as we may have already now).

@cnotv cnotv merged commit 698194f into rancher:master Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create E2E tests for cluster CRUD operations
4 participants