Bug 34319 - Upgrade Cypress
Summary: Upgrade Cypress
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 34690
  Show dependency treegraph
 
Reported: 2023-07-20 09:49 UTC by Jonathan Druart
Modified: 2023-12-28 20:47 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00


Attachments
Bug 34319: Upgrade cypress 9.7.0 to 12.17.1 (6.68 KB, patch)
2023-07-20 09:54 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 34319: Upgrade cypress 9.7.0 to 12.17.2 (7.10 KB, patch)
2023-07-27 09:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 34319: Upgrade cypress 9.7.0 to 12.17.2 (7.17 KB, patch)
2023-07-27 09:57 UTC, Matt Blenkinsop
Details | Diff | Splinter Review
Bug 34319: Fix dialog_spec.ts (1.28 KB, patch)
2023-09-01 10:44 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 34319: (QA follow-up) Add cypress.config.ts to Makefile.PL mapping (956 bytes, patch)
2023-09-05 18:29 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 34319: Remove cypress.json from Makefile.PL (1.28 KB, patch)
2023-09-06 12:44 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2023-07-20 09:49:51 UTC
We are currently using 9.7.0. Since 10 the config file structure changed, and has been renamed cypress.json to cypress.config.ts

https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0

Also cypress-studio (used for bug 34076) is not working on 9.7.0.
Comment 1 Jonathan Druart 2023-07-20 09:54:46 UTC
Created attachment 153714 [details] [review]
Bug 34319: Upgrade cypress 9.7.0 to 12.17.1

We are currently using 9.7.0. Since 10 the config file structure changed, and has been renamed cypress.json to cypress.config.ts

https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0

Also cypress-studio (used for bug 34076) is not working on 9.7.0.

Test plan:
yarn install
yarn build
mv /root/.cache/Cypress/12.17.1/ /kohadevbox/Cypress/
perl /kohadevbox/misc4dev/run_tests.pl --run-cypress-tests-only

You should not get any failures from the tests.
Comment 2 Jonathan Druart 2023-07-20 09:55:50 UTC
Tomas, do we have something to trigger ktd in this situation? I don't think so, we will need to do it manually.
Comment 3 Tomás Cohen Arazi 2023-07-20 12:47:51 UTC
(In reply to Jonathan Druart from comment #2)
> Tomas, do we have something to trigger ktd in this situation? I don't think
> so, we will need to do it manually.

Right, we should do it in advance.
Comment 4 Matt Blenkinsop 2023-07-27 09:20:38 UTC
I'm getting an error on yarn build:

ERROR in /kohadevbox/koha/cypress.config.ts
17:8-20:9
[tsl] ERROR in /kohadevbox/koha/cypress.config.ts(17,9)
      TS2322: Type '{ devServer: { framework: string; bundler: string; }; }' is not assignable to type 'Partial<Omit<ResolvedConfigOptions, TestingType>>'.
  Object literal may only specify known properties, and 'devServer' does not exist in type 'Partial<Omit<ResolvedConfigOptions, TestingType>>'.
ts-loader-default_0c5a263502dc9404
Comment 5 Jonathan Druart 2023-07-27 09:23:01 UTC
Created attachment 153952 [details] [review]
Bug 34319: Upgrade cypress 9.7.0 to 12.17.2

We are currently using 9.7.0. Since 10 the config file structure changed, and has been renamed cypress.json to cypress.config.ts

https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0

Also cypress-studio (used for bug 34076) is not working on 9.7.0.

Test plan:
yarn install
yarn build
mv /root/.cache/Cypress/12.17.2/ /kohadevbox/Cypress/
perl /kohadevbox/misc4dev/run_tests.pl --run-cypress-tests-only

You should not get any failures from the tests.
Comment 6 Jonathan Druart 2023-07-27 09:24:16 UTC
It was missing the change from package.json (which I certainly dropped with yarn.lock before I submitted the first patch).
Comment 7 Matt Blenkinsop 2023-07-27 09:57:08 UTC
Created attachment 153954 [details] [review]
Bug 34319: Upgrade cypress 9.7.0 to 12.17.2

We are currently using 9.7.0. Since 10 the config file structure changed, and has been renamed cypress.json to cypress.config.ts

https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0

Also cypress-studio (used for bug 34076) is not working on 9.7.0.

Test plan:
yarn install
yarn build
mv /root/.cache/Cypress/12.17.2/ /kohadevbox/Cypress/
perl /kohadevbox/misc4dev/run_tests.pl --run-cypress-tests-only

You should not get any failures from the tests.

Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
Comment 8 Pedro Amorim 2023-09-01 10:44:15 UTC
Created attachment 155097 [details] [review]
Bug 34319: Fix dialog_spec.ts

Follow the cypress upgrade instructions in the previous patch
Run the tests, verify they fail
Apply this patch, run tests again, verify they now pass
Comment 9 Jonathan Druart 2023-09-01 11:11:21 UTC
Tests are passing for me without this patch.

Apply first patch only
# inside ktd
yarn install
yarn build
yarn cypress run --spec t/cypress/integration/ERM/Dialog_spec.ts

Cypress 12.17.4
Comment 10 Pedro Amorim 2023-09-01 11:25:09 UTC
(In reply to Jonathan Druart from comment #9)
> Tests are passing for me without this patch.
> 
> Apply first patch only
> # inside ktd
> yarn install
> yarn build
> yarn cypress run --spec t/cypress/integration/ERM/Dialog_spec.ts
> 
> Cypress 12.17.4

Make sure you have 0 packages in your local DB.
Restart yarn js:watch if it was already running.
Run again:
yarn cypress run --spec t/cypress/integration/ERM/Dialog_spec.ts

Fails for me everytime.

Alternatively, run cypress tests visually to make the issue obvious
yarn run cypress open
Comment 11 Jonathan Druart 2023-09-01 11:45:44 UTC
I have 0 package...
Comment 12 Jonathan Druart 2023-09-01 11:59:40 UTC
Comment on attachment 155097 [details] [review]
Bug 34319: Fix dialog_spec.ts

This is fixing a random failure. It should be moved to its own bug report.
Comment 13 Pedro Amorim 2023-09-01 12:54:36 UTC
Moved the random failure fix to bug 34690
Comment 14 Tomás Cohen Arazi 2023-09-05 14:53:43 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 15 Tomás Cohen Arazi 2023-09-05 15:02:10 UTC
I now triggered a manual KTD build:

https://gitlab.com/koha-community/koha-testing-docker/-/pipelines/993420482

Things worked great locally.
Comment 16 Tomás Cohen Arazi 2023-09-05 18:29:09 UTC
Created attachment 155234 [details] [review]
Bug 34319: (QA follow-up) Add cypress.config.ts to Makefile.PL mapping

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 17 Jonathan Druart 2023-09-06 12:42:54 UTC
(In reply to Tomás Cohen Arazi from comment #16)
> Created attachment 155234 [details] [review] [review]
> Bug 34319: (QA follow-up) Add cypress.config.ts to Makefile.PL mapping
> 
> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

But then I think we should remove cypress.json
Comment 18 Jonathan Druart 2023-09-06 12:44:22 UTC
Created attachment 155272 [details] [review]
Bug 34319: Remove cypress.json from Makefile.PL

And move cypress.config.ts with the others NONE
Comment 19 Tomás Cohen Arazi 2023-09-06 12:58:38 UTC
Follow-up pushed. Thanks Jonathan!
Comment 20 Fridolin Somers 2023-09-08 06:16:24 UTC
May we backport this one ?
Comment 21 Matt Blenkinsop 2023-09-26 13:25:35 UTC
I would recommend backporting this Fridolin, the cypress tests won't run without it
Comment 22 Jonathan Druart 2023-09-26 13:45:55 UTC
(In reply to Matt Blenkinsop from comment #21)
> I would recommend backporting this Fridolin, the cypress tests won't run
> without it

They should, if you are using the correct ktd's image.