Bug 37917

Summary: RecordSources_spec.ts is failing randomly
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: Test SuiteAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: RESOLVED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, lucas, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.11.00
Circulation function:
Bug Depends on:    
Bug Blocks: 38049    
Attachments: Bug 37917: Add some wait time for the intercepted request responses

Description Katrin Fischer 2024-09-13 13:38:03 UTC
t/cypress/integration/Admin/RecordSources_spec.ts

  Record sources CRUD tests
    ✓ Add (6169ms)
    1) List
    ✓ Edit (1720ms)
    ✓ Delete (1658ms)


  4 passing (16s)
  1 failing

  1) Record sources CRUD tests
       List:
     TypeError: The following error originated from your application code, not from Cypress. It was caused by an unhandled promise rejection.

  > $(...).tooltip is not a function

When Cypress detects uncaught errors originating from your application it will automatically fail the current test.

This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.

https://on.cypress.io/uncaught-exception-from-application
      at Proxy.beforeMount (webpack://koha/./koha-tmpl/intranet-tmpl/prog/js/vue/components/KohaTable.vue?../node_modules/vue-loader/dist/index.js??ruleSet%5B1%5D.rules%5B5%5D.use%5B0%5D:142:11)
      at eval (webpack://koha/../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?:2849:40)
      at callWithErrorHandling (webpack://koha/../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?:284:22)
      at callWithAsyncErrorHandling (webpack://koha/../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?:293:21)
      at hook.__weh.hook.__weh (webpack://koha/../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?:2823:29)
      at invokeArrayFns (webpack://koha/../node_modules/@vue/shared/dist/shared.esm-bundler.js?:625:15)
      at ReactiveEffect.componentUpdateFn [as fn] (webpack://koha/../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?:5688:80)
      at ReactiveEffect.run (webpack://koha/../node_modules/@vue/reactivity/dist/reactivity.esm-bundler.js?:225:25)
      at instance.update (webpack://koha/../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?:5844:56)
      at setupRenderEffect (webpack://koha/../node_modules/@vue/runtime-core/dist/runtime-core.esm-bundler.js?:5858:9)
Comment 1 Tomás Cohen Arazi (tcohen) 2024-09-13 13:53:29 UTC
Created attachment 171461 [details] [review]
Bug 37917: Add some wait time for the intercepted request responses

This patch introduces the `cy.wait(500)` we use in several other Cypress
tests when an (intercepted) API request is made. This is very important
when tables are being rendered as DataTables is particularly bulky and
prone to take longer to finish loading the components if the CPU load is
a bit high.

I wasn't able to reproduce the problem very often, but you can test
yourself:

1. Run:
   $ ktd --shell
  k$ run_cypress --spec t/cypress/integration/Admin/RecordSources_spec.ts
2. Run it many times
=> FAIL: At some point it fails, you can overload your computer to try
3. Apply the patch
4. Repeat 2
=> SUCCESS: No failures :-D
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Katrin Fischer 2024-09-13 14:12:08 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 3 Jonathan Druart 2024-10-01 09:37:59 UTC
Can we get review before push on this kind of patches please?