Bugzilla – Attachment 183972 Details for
Bug 40346
Allow Cypress to test OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40346: Introduce loginOpac and visitOpac - Cypress
Bug-40346-Introduce-loginOpac-and-visitOpac---Cypr.patch (text/plain), 2.30 KB, created by
Jonathan Druart
on 2025-07-11 07:19:40 UTC
(
hide
)
Description:
Bug 40346: Introduce loginOpac and visitOpac - Cypress
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-07-11 07:19:40 UTC
Size:
2.30 KB
patch
obsolete
>From c5a88e3a92ac069127d6b7a7caf15de2a5600d05 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 10 Jul 2025 22:05:57 +0200 >Subject: [PATCH] Bug 40346: Introduce loginOpac and visitOpac - Cypress > >To be able to test the OPAC interface we need to add those 2 new >commands >--- > cypress.config.ts | 9 +++++---- > t/cypress/support/e2e.js | 19 +++++++++++++++++++ > 2 files changed, 24 insertions(+), 4 deletions(-) > >diff --git a/cypress.config.ts b/cypress.config.ts >index fd17efc7857..fed6e7b97b4 100644 >--- a/cypress.config.ts >+++ b/cypress.config.ts >@@ -15,9 +15,10 @@ export default defineConfig({ > baseUrl: "http://localhost:8081", > specPattern: "t/cypress/integration/**/*.*", > supportFile: "t/cypress/support/e2e.js", >- }, >- env: { >- apiUsername: "koha", >- apiPassword: "koha", >+ env: { >+ opacBaseUrl: process.env.KOHA_OPAC_URL || "http://localhost:8080", >+ apiUsername: "koha", >+ apiPassword: "koha", >+ }, > }, > }); >diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js >index 40265d607bf..ae58126313f 100644 >--- a/t/cypress/support/e2e.js >+++ b/t/cypress/support/e2e.js >@@ -32,6 +32,10 @@ function get_fallback_login_value(param) { > : Cypress.env(env_var); > } > >+Cypress.Commands.add("visitOpac", path => { >+ cy.visit(Cypress.env("opacBaseUrl") + path); >+}); >+ > Cypress.Commands.add("login", (username, password) => { > var user = > typeof username === "undefined" >@@ -47,6 +51,21 @@ Cypress.Commands.add("login", (username, password) => { > cy.get("#submit-button").click(); > }); > >+Cypress.Commands.add("loginOpac", (username, password) => { >+ var user = >+ typeof username === "undefined" >+ ? get_fallback_login_value("username") >+ : username; >+ var pass = >+ typeof password === "undefined" >+ ? get_fallback_login_value("password") >+ : password; >+ cy.visitOpac("/cgi-bin/koha/opac-main.pl?logout.x=1"); >+ cy.get("#userid").type(user); >+ cy.get("#password").type(pass); >+ cy.get("#auth .action").contains("Log in").click(); >+}); >+ > Cypress.Commands.add("left_menu_active_item_is", label => { > cy.get(".sidebar_menu a.current:not(.disabled)") > .should("have.length", 1) >-- >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 40346
: 183972 |
183973
|
183982