Bugzilla – Attachment 184332 Details for
Bug 40174
Add a way to cleanly insert data in DB from Cypress tests
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40174: Require RESTBasicAuth turned ON
Bug-40174-Require-RESTBasicAuth-turned-ON.patch (text/plain), 2.36 KB, created by
Martin Renvoize (ashimema)
on 2025-07-18 11:21:58 UTC
(
hide
)
Description:
Bug 40174: Require RESTBasicAuth turned ON
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-07-18 11:21:58 UTC
Size:
2.36 KB
patch
obsolete
>From 285b6ddd20c7eecde5b4e797a1f91ee5d9cd362c Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 11 Jul 2025 11:29:13 +0200 >Subject: [PATCH] Bug 40174: Require RESTBasicAuth turned ON >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >From MM thread https://chat.koha-community.org/koha-community/pl/aptoodssm7gu8x491onfgxs1xr > >Cypress tests need RESTBasicAuth - Iâm stuck in a chicken-and-egg problem being eaten by its own tail... >I need advice. Some Cypress tests need RESTBasicAuth, but it's disabled by default. >My plan was to turn it on globally (ie. set before any tests, and reset to its original value after) >but we cannot right now: >Update in DB could work, but its cached >Call the svc script won't work, as we are not logged in yet (and this script require the session cookie) > >so, I have a lot of solutions, but not sure which one to pick >* have a "flush cache" route (smells the rabbit hole) >* login to get the cookie, set the syspref via the svc script, logout (ugly, and will slower the cypress tests) >* require the pref on for cypress tests >* ? > >I would opt now for the third option, turn it on in Jenkins when we run the cypress tests. And explode for devs when the pref is not set. >What do you think? > >If we push this as it, Jenkins is going to fail. >We need to restructure how Jenkins is running the Cypress tests anyway: >we need a dedicated job to run them all. We will turn ON the syspref for >this job. > >Signed-off-by: Matt Blenkinsop <matt.blenkinsop@openfifth.co.uk> >Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> >--- > t/cypress/support/e2e.js | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > >diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js >index 40265d607bf..b4f07fda5c5 100644 >--- a/t/cypress/support/e2e.js >+++ b/t/cypress/support/e2e.js >@@ -1916,3 +1916,15 @@ Cypress.Commands.add("mock_table_settings", (settings, table_settings_var) => { > cy.wrap(table_settings.columns).as("columns"); > }); > }); >+ >+before(() => { >+ cy.task("query", { >+ sql: "SELECT value FROM systempreferences WHERE variable='RESTBasicAuth'", >+ }).then(value => { >+ if (value[0].value !== "1") { >+ throw new Error( >+ "Cypress tests tests require 'RESTBasicAuth'. Skipping suite." >+ ); >+ } >+ }); >+}); >-- >2.50.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 40174
:
183372
|
183373
|
183374
|
183851
|
183929
|
183978
|
183980
|
183981
|
184103
|
184104
|
184105
|
184106
|
184107
|
184108
|
184195
|
184327
|
184328
|
184329
|
184330
|
184331
| 184332 |
184333