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

chore(cypress): update to v13 #1466

Merged
merged 19 commits into from
Apr 25, 2024
Merged

chore(cypress): update to v13 #1466

merged 19 commits into from
Apr 25, 2024

Conversation

Mohammer5
Copy link
Contributor

@Mohammer5 Mohammer5 commented Mar 21, 2024

Description

We're still using cypress@^8, although our tooling has been upgraded to use v12 quite some time ago


Known issues

For some reason import '../common/index.js doesn't work. It does work after changing it to require('../common/index.js).
I can't explain it yet because other import statements work just fine.

(Issue has been adressed)


How to review

Most files haven't changed except for import statements, these can be ignored.
Out of the 325 touched files, only the following 49 files have changes other than import-related changes (list of files further down).
There are two reasons why I had to touch so many feature files:

  1. Cucumber actually doesn't allow duplicate step definitions, but in prior versions that rule wasn't enforced. Now it is.
  2. The new cypress-cucumber-preprocessor library does not export And or But, so I had to change all occurrences of And to Given/When/Then. (see Deprecate And and But functions for step definitions badeball/cypress-cucumber-preprocessor#821)
  3. The configuration changed dramatically (see Upgrade guide from TheBrainFamily/cypress-cucumber-preprocessor badeball/cypress-cucumber-preprocessor#689)

The config files and files I had to modify for the above reasons are:

  • .cypress-cucumber-preprocessorrc.json
  • .github/workflows/dhis2-preview-pr.yml
  • .github/workflows/dhis2-verify-lib.yml
  • collections/forms/i18n/en.pot
  • components/alert/src/alert-bar/features/api/hidden_callback.js
  • components/alert/src/alert-bar/features/api/index.js
  • components/alert/src/alert-bar/features/api/prop_message.js
  • components/alert/src/alert-bar/features/api/props_message.js
  • components/alert/src/alert-bar/features/api/props_permanent.js
  • components/alert/src/alert-bar/features/common/index.js
  • components/alert/src/alert-bar/features/hide/automatically.js
  • components/alert/src/alert-bar/features/hide/index.js
  • components/alert/src/alert-bar/features/hide/on_action.js
  • components/button/src/split-button/features/accepts_icon/index.js
  • components/calendar/src/features/supports_calendar_clear_button/supports_calendar_clear_button.js
  • components/calendar/src/features/supports_ethiopic_calendar/supports_ethiopic_calendar.js
  • components/calendar/src/features/supports_gregorian_calendar/supports_gregorian_calendar.js
  • components/calendar/src/features/supports_nepali_calendar/supports_nepali_calendar.js
  • components/header-bar/src/__e2e__/stories/common.js
  • components/header-bar/src/__e2e__/stories/modulesWithSpecialCharacters.js
  • components/header-bar/src/features/the_headerbar_can_display_online_status/the_headerbar_displays_online_status.js
  • components/header-bar/src/features/the_headerbar_contains_a_menu_to_all_apps/the_menu_is_closed_by_default.js
  • components/header-bar/src/features/the_headerbar_contains_a_profile_menu/the_user_can_log_out.js
  • components/header-bar/src/features/the_search_should_escape_regexp_character/the_user_searches_for_an_app_with_a_regex_character.js
  • components/organisation-unit-tree/src/__e2e__/common.js
  • components/organisation-unit-tree/src/__e2e__/get-organisation-unit-data.js
  • components/organisation-unit-tree/src/__e2e__/namespace.js
  • components/organisation-unit-tree/src/features/controlled_expanded/index.js
  • components/organisation-unit-tree/src/features/path_based_filtering/index.js
  • components/organisation-unit-tree/src/features/single_selection.feature
  • components/organisation-unit-tree/src/features/single_selection/index.js
  • components/organisation-unit-tree/src/features/sub_unit_as_root/index.js
  • components/select/src/multi-select/features/accepts_max_height/index.js
  • components/select/src/multi-select/features/allows_selecting/index.js
  • components/select/src/multi-select/features/can_be_disabled/index.js
  • components/select/src/single-select/features/accepts_max_height/index.js
  • components/select/src/single-select/features/duplicate_option_values/index.js
  • components/tooltip/src/features/scrolling_containers/index.js
  • components/transfer/src/features/disabled-transfer-buttons/index.js
  • components/transfer/src/features/reorder-with-buttons/index.js
  • components/transfer/src/features/transferring-items/index.js
  • cypress-cucumber-preprocessor.config.js
  • cypress.config.js
  • cypress.json
  • cypress/plugins/index.js
  • cypress/support/e2e.js
  • cypress/support/find.js
  • cypress/support/get.js
  • package.json

Checklist

  • [ ] API docs are generated
  • [ ] Tests were added
  • [ ] Storybook demos were added

None of the above is relevant for this PR

@Mohammer5 Mohammer5 requested a review from a team as a code owner March 21, 2024 09:12
@Mohammer5 Mohammer5 force-pushed the update-cypress-to-v12 branch 6 times, most recently from eea976f to 9638bc7 Compare March 21, 2024 16:55
Copy link

cypress bot commented Mar 21, 2024

Passing run #3339 ↗︎

0 584 0 0 Flakiness 0

Details:

Merge pull request #1466 from dhis2/update-cypress-to-v12
Project: ui Commit: 12b3de0178
Status: Passed Duration: 08:28 💡
Started: Apr 25, 2024 6:22 AM Ended: Apr 25, 2024 6:31 AM

Review all test suite changes for PR #1466 ↗︎

@Mohammer5 Mohammer5 force-pushed the update-cypress-to-v12 branch from 9638bc7 to 7cecb00 Compare March 25, 2024 01:11
@dhis2-bot
Copy link
Contributor

dhis2-bot commented Mar 25, 2024

🚀 Deployed on https://pr-1466--dhis2-ui.netlify.app

@dhis2-bot dhis2-bot temporarily deployed to netlify March 25, 2024 01:15 Inactive
@ghost ghost mentioned this pull request Apr 2, 2024
@ghost
Copy link

ghost commented Apr 3, 2024

See also this PR btw, where I also upgraded to cypress v12: dhis2/scheduler-app#484

@dhis2-bot dhis2-bot temporarily deployed to netlify April 8, 2024 00:25 Inactive
@Mohammer5 Mohammer5 force-pushed the update-cypress-to-v12 branch from c0b9509 to 30ab769 Compare April 18, 2024 06:51
@dhis2-bot dhis2-bot temporarily deployed to netlify April 18, 2024 06:55 Inactive
@ghost ghost self-requested a review April 22, 2024 08:57
cypress.config.js Outdated Show resolved Hide resolved
cypress.config.js Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
Copy link
Collaborator

@kabaros kabaros left a comment

Choose a reason for hiding this comment

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

it looks good to me, I think Ismay's points are the most important to address, especially upgrading to v13 instead since it shouldn't be a lot of extra effort, and no point doing all of this and still be a version behind.

In the PR description, I would just add a link to badeball/cypress-cucumber-preprocessor#689 and badeball/cypress-cucumber-preprocessor#821 to give a bit of context to why the changes were necessary, for anyone passing by this PR after us.

}

Cypress.Commands.overwrite('find', find)
Cypress.Commands.overwriteQuery(
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you know why did we create this overwrite in the first place? seems a bit obscure/non-standard .. are we actively relying on it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is an old and also used to be in our utility libraries. We then decided that this is not a good approach and ditched it. It's still in this lib though and could (should) be removed. But that's outside of the scope of this PR

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll create a ticket for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -28,30 +28,32 @@
"scripts": {
"setup": "./scripts/setup.js",
"build": "./scripts/build-world.sh",
"build:legacy": "NODE_OPTIONS=--openssl-legacy-provider ./scripts/build-world.sh",
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need to keep a separate :legacy step in practice? What's the implication on consumers if we update the main steps with NODE_OPTIONS=... and make it clear we support node 20+ LTS (with a breaking change)

If anything, for me, it's the original ones that need a :legacy suffix since they're needed for legacy out of life versions of node

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is just temporary and will be removed once we merge the storybook PR


- uses: c-hive/gha-yarn-cache@v1
- run: |
yarn install --frozen-lockfile
yarn setup
NODE_OPTIONS=--openssl-legacy-provider yarn setup
Copy link
Collaborator

Choose a reason for hiding this comment

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

wouldn't it be more consistent to add NODE_OPTIONS=--openssl-legacy-provider as a an env variable applying to all the steps? and we get rid of it, once webpack/storybook is upgraded

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See comment above

@dhis2-bot dhis2-bot temporarily deployed to netlify April 23, 2024 03:35 Inactive
@Mohammer5 Mohammer5 force-pushed the update-cypress-to-v12 branch 2 times, most recently from cf8351e to e390c5b Compare April 24, 2024 02:13
Copy link
Collaborator

@kabaros kabaros left a comment

Choose a reason for hiding this comment

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

it looks good to me - happy for it to be merged once the remaining tests are updated, then can tackle story book after.

@Mohammer5 Mohammer5 changed the title chore(cypress): update to v12 chore(cypress): update to v13 Apr 25, 2024
@Mohammer5 Mohammer5 force-pushed the update-cypress-to-v12 branch from 988a4fd to 8b47655 Compare April 25, 2024 01:50
@Mohammer5 Mohammer5 force-pushed the update-cypress-to-v12 branch from 1363472 to e1d1c1e Compare April 25, 2024 02:47
@dhis2-bot dhis2-bot temporarily deployed to netlify April 25, 2024 02:51 Inactive
@Mohammer5 Mohammer5 merged commit 12b3de0 into master Apr 25, 2024
13 checks passed
@Mohammer5 Mohammer5 deleted the update-cypress-to-v12 branch April 25, 2024 06:15
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 9.4.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants