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

CONSOLE-3740: Upgrade Cypress #13070

Merged
merged 3 commits into from Oct 13, 2023
Merged

Conversation

rhamilto
Copy link
Member

@rhamilto rhamilto commented Aug 3, 2023

Based on my findings, there are a number of recommendations/observations:

As part of the upgrade from 8.5.0 >= 10.x, the existing cypress.json configs and test names need to be updated. Running cypress open with a >= 10.x version of Cypress installed provides a wizard that covers this process. I have done already done so for packages/integration-tests-cypress and packages/operator-lifecycle-manager/integration-tests-cypress in this PR. But the following configs and tests need updating:

  • packages/topology/integration-tests/cypress.json
  • packages/dev-console/integration-tests/cypress.json
  • packages/helm-plugin/integration-tests/cypress.json
  • packages/gitops-plugin/integration-tests /cypress.json
  • packages/knative-plugin/integration-tests/cypress.json
  • packages/pipelines-plugin/integration-tests /cypress.json
  • packages/shipwright-plugin/integration-tests/cypress.json
  • packages/webterminal-plugin/integration-tests/cypress.json
  • packages/ceph-storage-plugin/integration-tests-cypress/cypress-ceph.json (will be removed per @SanjalKatiyar)

The tests run significantly faster in Cypress >= 10.x. This exposes an issue with tests that use cy.visit where the console redirects to / if the console isn't fully loaded before Cypress starts testing. A workaround is to visit / first and then check the perspective is set to Administrator. This appears to give the console time to fully load. I've made these adjustments for packages/integration-tests-cypress and packages/operator-lifecycle-manager/integration-tests-cypress via global command (cy.initAdmin) I added.

I've also added cy.createProjectWithCLI and cy.deleteProjectWithCLI. It occurs to me we should use the CLI to create and delete projects where testing these functions isn't important to the test in order to reduce the run time of the tests, which is a task from https://issues.redhat.com/browse/CONSOLE-3718. cc: @TheRealJon

Notes on updated tests

Requires demo plugin be running locally:

  • app/demo-dynamic-plugin.cy.ts

Require monitoring plugin be running locally:

  • crud/other-routes.cy.ts
  • i18n/pseudolocalization.cy.ts
  • monitoring/monitoring.cy.ts

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 3, 2023
@openshift-ci openshift-ci bot added component/dev-console Related to dev-console component/olm Related to OLM approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/cypress Related to Cypress e2e integration testing labels Aug 3, 2023
frontend/.eslintignore Outdated Show resolved Hide resolved
@@ -12,8 +12,15 @@
"sourceMap": true,
"noUnusedLocals": true,
"typeRoots": ["node_modules/@types", "@types"],
"types": ["node", "jest", "cypress", "cypress-axe", "cypress-file-upload", "console"]
"types": ["node", "jest", "cypress-axe", "console"]
Copy link
Member Author

Choose a reason for hiding this comment

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

cypress and cypress-file-upload do not have @types packages.

frontend/tsconfig.json Show resolved Hide resolved
@rhamilto rhamilto force-pushed the CONSOLE-3716 branch 3 times, most recently from 3d635b0 to b3042a1 Compare August 23, 2023 19:05
@rhamilto rhamilto changed the title [WIP] Upgrade Cypress to v10.11.0 [WIP] Upgrade Cypress to v11.2.0 Aug 23, 2023
@rhamilto
Copy link
Member Author

/retest

@rhamilto
Copy link
Member Author

/retest

@rhamilto rhamilto force-pushed the CONSOLE-3716 branch 2 times, most recently from b1ec710 to 439692b Compare September 27, 2023 18:27
@openshift-ci openshift-ci bot added the component/topology Related to topology label Oct 2, 2023
@openshift-merge-robot
Copy link
Contributor

@rhamilto: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-console d5cc206 link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@rhamilto rhamilto changed the title [WIP] Upgrade Cypress to v11.2.0 [WIP] Upgrade Cypress Oct 3, 2023
@rhamilto rhamilto force-pushed the CONSOLE-3716 branch 2 times, most recently from fcf1ff3 to c61c7ee Compare October 3, 2023 18:01
Copy link
Member

@TheRealJon TheRealJon left a comment

Choose a reason for hiding this comment

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

Just a few observations. I don't fully understand why the ts config for the integration test package is weird. I remember trying to tinker with it at one point because VSCode kept telling me that 'cy' wasn't defined in the global scope, but I didn't have much luck with it. Let me know if you want to look at it together.

@RickJWagner RickJWagner removed their assignment Oct 9, 2023
Copy link

@RickJWagner RickJWagner left a comment

Choose a reason for hiding this comment

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

Looks good. Adding px-approved label.

@opayne1
Copy link
Contributor

opayne1 commented Oct 9, 2023

/label docs-approved

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Oct 9, 2023
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Oct 9, 2023

@rhamilto: This pull request references CONSOLE-3740 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but it targets "openshift-4.15" instead.

In response to this:

Based on my findings, there are a number of recommendations/observations:

As part of the upgrade from 8.5.0 >= 10.x, the existing cypress.json configs and test names need to be updated. Running cypress open with a >= 10.x version of Cypress installed provides a wizard that covers this process. I have done already done so for packages/integration-tests-cypress and packages/operator-lifecycle-manager/integration-tests-cypress in this PR. But the following configs and tests need updating:

  • packages/topology/integration-tests/cypress.json
  • packages/dev-console/integration-tests/cypress.json
  • packages/helm-plugin/integration-tests/cypress.json
  • packages/gitops-plugin/integration-tests /cypress.json
  • packages/knative-plugin/integration-tests/cypress.json
  • packages/pipelines-plugin/integration-tests /cypress.json
  • packages/shipwright-plugin/integration-tests/cypress.json
  • packages/webterminal-plugin/integration-tests/cypress.json
  • packages/ceph-storage-plugin/integration-tests-cypress/cypress-ceph.json (will be removed per @SanjalKatiyar)

The tests run significantly faster in Cypress >= 10.x. This exposes an issue with tests that use cy.visit where the console redirects to / if the console isn't fully loaded before Cypress starts testing. A workaround is to visit / first and then check the perspective is set to Administrator. This appears to give the console time to fully load. I've made these adjustments for packages/integration-tests-cypress and packages/operator-lifecycle-manager/integration-tests-cypress via global command (cy.initAdmin) I added.

I've also added cy.createProjectWithCLI and cy.deleteProjectWithCLI. It occurs to me we should use the CLI to create and delete projects where testing these functions isn't important to the test in order to reduce the run time of the tests, which is a task from https://issues.redhat.com/browse/CONSOLE-3718. cc: @TheRealJon

Notes on updated tests

Requires demo plugin be running locally:

  • app/demo-dynamic-plugin.cy.ts

Require monitoring plugin be running locally:

  • crud/other-routes.cy.ts
  • i18n/pseudolocalization.cy.ts
  • monitoring/monitoring.cy.ts

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

rhamilto referenced this pull request Oct 10, 2023
…in-Add-dashboard-card-with-chart-using-QueryBrowser-component

CONSOLE-3675: Dynamic Demo Plugin: Add dashboard card with chart using QueryBrowser component
@rhamilto
Copy link
Member Author

/retest

@rhamilto rhamilto changed the title [WIP] CONSOLE-3740: Upgrade Cypress CONSOLE-3740: Upgrade Cypress Oct 12, 2023
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 12, 2023
Copy link
Member

@TheRealJon TheRealJon left a comment

Choose a reason for hiding this comment

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

Just a few comments. Let me know your thoughts.

frontend/.eslintignore Show resolved Hide resolved
cy.byTestID('user-dropdown').click();
cy.byTestID('log-out').should('be.visible');
cy.byTestID('log-out').click({ force: true });
cy.visit('/');
Copy link
Member

Choose a reason for hiding this comment

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

We need some kind of assertion here to make sure we actually logged out.

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably, but this isn't functionally different than what it was doing before, so no change in behavior. Follow on?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think that's fine. I just worry that with sessions, we won't know if the logout failed.

Copy link
Member Author

Choose a reason for hiding this comment

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

So after playing with this, I don't think there is a way to actually test logout fully because of the way cy.session works since it's interecepting the credentials. Will leave it for now.

Copy link
Member

@TheRealJon TheRealJon left a comment

Choose a reason for hiding this comment

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

/lgtm

We can fix the logout test as a follow-on.

cy.byTestID('user-dropdown').click();
cy.byTestID('log-out').should('be.visible');
cy.byTestID('log-out').click({ force: true });
cy.visit('/');
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I think that's fine. I just worry that with sessions, we won't know if the logout failed.

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 12, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhamilto, TheRealJon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [TheRealJon,rhamilto]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rhamilto
Copy link
Member Author

Adding qe-approval label since this isn't customer facing.

/label qe-approval

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 12, 2023

@rhamilto: The label(s) /label qe-approval cannot be applied. These labels are supported: acknowledge-critical-fixes-only, platform/aws, platform/azure, platform/baremetal, platform/google, platform/libvirt, platform/openstack, ga, tide/merge-method-merge, tide/merge-method-rebase, tide/merge-method-squash, px-approved, docs-approved, qe-approved, downstream-change-needed, rebase/manual, approved, backport-risk-assessed, bugzilla/valid-bug, cherry-pick-approved, jira/valid-bug, staff-eng-approved. Is this label configured under labels -> additional_labels or labels -> restricted_labels in plugin.yaml?

In response to this:

Adding qe-approval label since this isn't customer facing.

/label qe-approval

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@rhamilto
Copy link
Member Author

/label qe-approved

typing is hard

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Oct 12, 2023
@openshift-ci-robot
Copy link
Contributor

openshift-ci-robot commented Oct 12, 2023

@rhamilto: This pull request references CONSOLE-3740 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.15.0" version, but it targets "openshift-4.15" instead.

In response to this:

Based on my findings, there are a number of recommendations/observations:

As part of the upgrade from 8.5.0 >= 10.x, the existing cypress.json configs and test names need to be updated. Running cypress open with a >= 10.x version of Cypress installed provides a wizard that covers this process. I have done already done so for packages/integration-tests-cypress and packages/operator-lifecycle-manager/integration-tests-cypress in this PR. But the following configs and tests need updating:

  • packages/topology/integration-tests/cypress.json
  • packages/dev-console/integration-tests/cypress.json
  • packages/helm-plugin/integration-tests/cypress.json
  • packages/gitops-plugin/integration-tests /cypress.json
  • packages/knative-plugin/integration-tests/cypress.json
  • packages/pipelines-plugin/integration-tests /cypress.json
  • packages/shipwright-plugin/integration-tests/cypress.json
  • packages/webterminal-plugin/integration-tests/cypress.json
  • packages/ceph-storage-plugin/integration-tests-cypress/cypress-ceph.json (will be removed per @SanjalKatiyar)

The tests run significantly faster in Cypress >= 10.x. This exposes an issue with tests that use cy.visit where the console redirects to / if the console isn't fully loaded before Cypress starts testing. A workaround is to visit / first and then check the perspective is set to Administrator. This appears to give the console time to fully load. I've made these adjustments for packages/integration-tests-cypress and packages/operator-lifecycle-manager/integration-tests-cypress via global command (cy.initAdmin) I added.

I've also added cy.createProjectWithCLI and cy.deleteProjectWithCLI. It occurs to me we should use the CLI to create and delete projects where testing these functions isn't important to the test in order to reduce the run time of the tests, which is a task from https://issues.redhat.com/browse/CONSOLE-3718. cc: @TheRealJon

Notes on updated tests

Requires demo plugin be running locally:

  • app/demo-dynamic-plugin.cy.ts

Require monitoring plugin be running locally:

  • crud/other-routes.cy.ts
  • i18n/pseudolocalization.cy.ts
  • monitoring/monitoring.cy.ts

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot
Copy link
Contributor

/retest-required

Remaining retests: 0 against base HEAD 7d79a03 and 2 for PR HEAD b269f98 in total

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 13, 2023

@rhamilto: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-ci openshift-ci bot merged commit 1083040 into openshift:master Oct 13, 2023
6 checks passed
@rhamilto rhamilto deleted the CONSOLE-3716 branch October 13, 2023 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/dev-console Related to dev-console component/olm Related to OLM component/topology Related to topology docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. kind/cypress Related to Cypress e2e integration testing lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants