Bugzilla – Attachment 186401 Details for
Bug 40809
JS warning should make Cypress tests fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40809: Fail Cypress tests on JS warnings
Bug-40809-Fail-Cypress-tests-on-JS-warnings.patch (text/plain), 1.23 KB, created by
Jonathan Druart
on 2025-09-15 12:25:42 UTC
(
hide
)
Description:
Bug 40809: Fail Cypress tests on JS warnings
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-09-15 12:25:42 UTC
Size:
1.23 KB
patch
obsolete
>From 5cc1279b4b1895c4cc103fa721f601880137071a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 15 Sep 2025 14:23:25 +0200 >Subject: [PATCH] Bug 40809: Fail Cypress tests on JS warnings > >Currently JS warnings during Cypress tests are ignored. >This change intercepts console warnings in the browser and if any occurs >the test failed > >This helps catch potential issues and ensures that warnings are not >silently ignored during test runs. >--- > t/cypress/support/e2e.js | 9 +++++++++ > 1 file changed, 9 insertions(+) > >diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js >index bcffe74d50b..b395ad1e2e3 100644 >--- a/t/cypress/support/e2e.js >+++ b/t/cypress/support/e2e.js >@@ -24,6 +24,15 @@ > // -- This will overwrite an existing command -- > // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) > >+// Error on JS warnings >+Cypress.on("window:before:load", win => { >+ win.console.warn = (...args) => { >+ if (args[0] && typeof args[0] === "string") { >+ throw new Error(`JS Warning detected: ${args[0]}`); >+ } >+ }; >+}); >+ > function get_fallback_login_value(param) { > var env_var = param == "username" ? "KOHA_USER" : "KOHA_PASS"; > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40809
: 186401