diff --git a/t/cypress/integration/OPAC/SCO_spec.ts b/t/cypress/integration/OPAC/SCO_spec.ts
index 6709345a5b..bdde1ccc93 100644
--- a/t/cypress/integration/OPAC/SCO_spec.ts
+++ b/t/cypress/integration/OPAC/SCO_spec.ts
@@ -1,4 +1,50 @@
describe("SCO", () => {
+ // Sets a system preference via the intranet svc endpoint using only
+ // cy.request() — no browser navigation, so no cross-origin issues.
+ function setSyspref(variable: string, value: string) {
+ // Step 1: GET the login page to get an anonymous session + its CSRF token
+ cy.request("/cgi-bin/koha/mainpage.pl?logout.x=1").then(loginPage => {
+ const csrfForLogin = (loginPage.body as string).match(
+ / {
+ const csrfForSvc = (mainPage.body as string).match(
+ / {
cy.task("insertSampleBiblio", { item_count: 1 }).then(objects => {
cy.wrap(objects).as("objects");