Skip to content

Conversation

@torchiaf
Copy link
Member

@torchiaf torchiaf commented Dec 10, 2025

Summary

Fixes #16057

Occurred changes and/or fixed issues

This pull request introduces the new @rancher/cypress package, which modularizes and standardizes Cypress E2E test utilities, configuration, and page objects for Rancher Dashboard.
The changes include extracting a reusable Cypress base configuration, updating import paths for better compatibility, and adding documentation and packaging infrastructure for the new package. Additionally, several minor improvements and bug fixes are applied to the E2E test suite.

It also adds a GitHub Actions workflow (.github/workflows/release-cypress-pkg.yaml) for automated building and publishing of the Cypress package to npm on new release tags.

Please, take a look to the README.md file for a better insight.

Technical notes summary

Areas or cases that should be tested

Areas which could experience regressions

@yonasberhe23 @izaac not sure how to verify regressions in the Jenkins environment. Could you take a look ?

Tests

  • Build the new package locally
cd cypress
yarn install
yarn build-pkg
cd dist && yarn install && yarn link
  • Link the pkg in a consuming project (e.g. a new extension)
yarn link @rancher/cypress

# These commands are only for yarn linked packages - npx rancher-cypress cli is available when installing from npm.
./node_modules/@rancher/cypress/bin/cli.js init
./node_modules/@rancher/cypress/bin/cli.js open
  • Use the NPM version
yarn add @rancher/cypress --dev

npx rancher-cypress init
npx rancher-cypress open
  • Add some new tests, the POs and commands should be available in your project

Screenshot/Video

Checklist

  • The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • The PR has a Milestone
  • The PR template has been filled out
  • The PR has been self reviewed
  • The PR has a reviewer assigned
  • The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes
  • The PR has been reviewed in terms of Accessibility
  • The PR has considered, and if applicable tested with, the three Global Roles Admin, Standard User and User Base

@torchiaf torchiaf added this to the v2.14.0 milestone Dec 10, 2025
@torchiaf torchiaf force-pushed the feature/build-cypress-suite branch 16 times, most recently from e736f2b to 84ae4d9 Compare December 15, 2025 09:39
@torchiaf torchiaf force-pushed the feature/build-cypress-suite branch 5 times, most recently from def3e00 to dfd19a8 Compare December 15, 2025 11:47
@torchiaf torchiaf marked this pull request as ready for review December 15, 2025 13:33
@torchiaf torchiaf requested review from cnotv and nwmac December 15, 2025 13:47
@torchiaf torchiaf force-pushed the feature/build-cypress-suite branch from 73fd151 to e11b3e6 Compare December 15, 2025 14:06
@torchiaf torchiaf requested a review from cnotv December 16, 2025 10:46
@torchiaf
Copy link
Member Author

@cnotv I added some missing library and fixed minor issues in the template files, nothing impacting the building process though.

@torchiaf torchiaf force-pushed the feature/build-cypress-suite branch 2 times, most recently from 3edfbed to dc04bc9 Compare December 16, 2025 11:59
@torchiaf torchiaf force-pushed the feature/build-cypress-suite branch 4 times, most recently from 88d7f37 to 95886b9 Compare December 16, 2025 21:58
@torchiaf torchiaf force-pushed the feature/build-cypress-suite branch from 95886b9 to 55f3c22 Compare December 16, 2025 21:59
run: |
./scripts/check-e2e-tests-for-tags
check-cypress-build:
Copy link
Member Author

Choose a reason for hiding this comment

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

This will block the CI gates if there is a Typescript error in ./cypress dir.

run: yarn publish-pkg
env:
TAG: ${{ inputs.tag || github.ref_name }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend configuring trusted providers at this point, otherwise we will need to schedule token refreshes on a regular interval; tokens have a maximum lifespan of three months as of November/December.

In order to do this, we need to configure the package in npm:

https://docs.npmjs.com/trusted-publishers

And then ensure that we fetch tokens using oidc in our release workflow:

#16166

Copy link
Member Author

Choose a reason for hiding this comment

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

I pushed the changes, and @richard-cox assigned the trusted publisher to @rancher/cypress.
I tried to push a new version from a dev branch, but I got an authentication error, probably my workflow is not creating an OIDC token (which is required by npm publish now) as it's not running on master.

So, i would test again the release workflow after we merge the PR.

Copy link
Member

@rak-phillip rak-phillip Dec 19, 2025

Choose a reason for hiding this comment

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

If that doesn't work, we may need to include the line to update npm:

      # Ensure npm 11.5.1 or later is installed
      - name: Update npm
        run: npm install -g npm@latest

It appears to be missing from the workflow and will be required for the short-term.

@torchiaf torchiaf requested a review from rak-phillip December 17, 2025 12:09
run: yarn build-pkg

- name: Publish Cypress Package to npm
run: yarn publish-pkg
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 you miss --access public

Note that for legacy reasons scoped packages are by default published with an access set to restricted (aka "private packages"). This requires you to register for a paid npm plan. In case you simply wish to publish a public scoped package to the registry (for free), just add the --access public flag. This behavior can be enabled by default through the npmPublishAccess settings.

https://yarnpkg.com/cli/npm/publish#details

Copy link
Member Author

Choose a reason for hiding this comment

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

No, the flag is there:

PUBLISH_ARGS="--no-git-tag-version --access public --registry $NPM_REGISTRY"

https://github.com/torchiaf/dashboard/blob/9cb1ddb10e4ec608963de5524d589ce978b347df/cypress/scripts/publish.sh#L54

@torchiaf torchiaf requested review from aalves08 and cnotv December 18, 2025 15:48
Copy link
Member

@aalves08 aalves08 left a comment

Choose a reason for hiding this comment

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

LGTM

@torchiaf torchiaf merged commit 3a92073 into rancher:master Dec 18, 2025
61 of 63 checks passed
@yonasberhe23
Copy link
Contributor

@torchiaf the Jenkins Cypress config file (cypress/jenkins/cypress.config.jenkins.ts) is independent and doesn't import the modified base-config.ts or cypress.config.ts, so these changes won't affect our CI/CD pipeline.

@richard-cox richard-cox mentioned this pull request Dec 24, 2025
9 tasks
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.

Build and Publish @rancher/cypress npm package

5 participants