-
Notifications
You must be signed in to change notification settings - Fork 302
Build and publish Cypress suite #16140
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
Build and publish Cypress suite #16140
Conversation
e736f2b to
84ae4d9
Compare
def3e00 to
dfd19a8
Compare
73fd151 to
e11b3e6
Compare
Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
|
@cnotv I added some missing library and fixed minor issues in the template files, nothing impacting the building process though. |
3edfbed to
dc04bc9
Compare
Signed-off-by: Francesco Torchia <[email protected]>
88d7f37 to
95886b9
Compare
Signed-off-by: Francesco Torchia <[email protected]>
95886b9 to
55f3c22
Compare
| run: | | ||
| ./scripts/check-e2e-tests-for-tags | ||
| check-cypress-build: |
There was a problem hiding this comment.
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 }} |
There was a problem hiding this comment.
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:
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Signed-off-by: Francesco Torchia <[email protected]>
Signed-off-by: Francesco Torchia <[email protected]>
| run: yarn build-pkg | ||
|
|
||
| - name: Publish Cypress Package to npm | ||
| run: yarn publish-pkg |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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"
aalves08
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@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. |
Summary
Fixes #16057
Occurred changes and/or fixed issues
This pull request introduces the new
@rancher/cypresspackage, 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
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 openScreenshot/Video
Checklist
Admin,Standard UserandUser Base