Bugzilla – Attachment 158123 Details for
Bug 35201
Cypress tests for the Preservation module are failing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35201: (bug 30708 follow-up) Fix Preservation tests
Bug-35201-bug-30708-follow-up-Fix-Preservation-tes.patch (text/plain), 6.85 KB, created by
Jonathan Druart
on 2023-10-31 14:28:42 UTC
(
hide
)
Description:
Bug 35201: (bug 30708 follow-up) Fix Preservation tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-10-31 14:28:42 UTC
Size:
6.85 KB
patch
obsolete
>From 338421fe79bdbf248c38c59bfeb6a96225714414 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 31 Oct 2023 15:27:25 +0100 >Subject: [PATCH] Bug 35201: (bug 30708 follow-up) Fix Preservation tests > >We didn't mock the config given the last changes >--- > .../prog/js/vue/routes/preservation.js | 2 +- > t/cypress/integration/Preservation/Trains.ts | 28 +++++++-------- > .../integration/Preservation/WaitingList.ts | 34 +++++++++---------- > 3 files changed, 30 insertions(+), 34 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js >index cb75d07ce1c..ac9df94e8f7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/routes/preservation.js >@@ -97,7 +97,7 @@ export const routes = [ > }, > { > path: "/cgi-bin/koha/preservation/waiting-list", >- title: $__("Waiting List"), >+ title: $__("Waiting list"), > icon: "fa fa-recycle", > is_end_node: true, > children: [ >diff --git a/t/cypress/integration/Preservation/Trains.ts b/t/cypress/integration/Preservation/Trains.ts >index 7c2a440fb70..6dda1f78a3d 100644 >--- a/t/cypress/integration/Preservation/Trains.ts >+++ b/t/cypress/integration/Preservation/Trains.ts >@@ -208,19 +208,10 @@ describe("Trains", () => { > cy.title().should("eq", "Koha staff interface"); > cy.intercept( > "GET", >- "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationModule", >- '{"value":"1"}' >- ); >- cy.intercept( >- "GET", >- "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanWaitingListIn", >- '{"value":"24"}' >- ); >- cy.intercept( >- "GET", >- "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanDefaultTrainIn", >- '{"value":"42"}' >+ "/api/v1/preservation/config", >+ '{"permissions":{"manage_sysprefs":"1"},"settings":{"enabled":"1","not_for_loan_default_train_in":"42","not_for_loan_waiting_list_in": "24"}}' > ); >+ > cy.intercept( > "GET", > "/api/v1/authorised_value_categories/NOT_LOAN/authorised_values", >@@ -277,7 +268,7 @@ describe("Trains", () => { > ); > > // GET trains returns empty list >- cy.intercept("GET", "/api/v1/*", []); >+ cy.intercept("GET", "/api/v1/preservation/trains*", []); > cy.visit("/cgi-bin/koha/preservation/trains"); > cy.get("#trains_list").contains("There are no trains defined"); > >@@ -345,7 +336,15 @@ describe("Trains", () => { > let train = get_train(); > let processings = get_processings(); > cy.intercept("GET", "/api/v1/preservation/trains/*", train); >- cy.intercept("GET", "/api/v1/preservation/trains", [train]); >+ cy.intercept("GET", "/api/v1/preservation/trains*", { >+ statusCode: 200, >+ body: [train], >+ headers: { >+ "X-Base-Total-Count": "1", >+ "X-Total-Count": "1", >+ }, >+ }); >+ > cy.intercept("GET", "/api/v1/preservation/processings*", processings); > cy.visit("/cgi-bin/koha/preservation/trains"); > cy.get("#trains_list table tbody tr:first").contains("Edit").click(); >@@ -361,7 +360,6 @@ describe("Trains", () => { > // Submit the form, get 500 > cy.intercept("PUT", "/api/v1/preservation/trains/*", { > statusCode: 500, >- error: "Something went wrong", > }); > cy.get("#trains_add").contains("Submit").click(); > cy.get("main div[class='dialog alert']").contains( >diff --git a/t/cypress/integration/Preservation/WaitingList.ts b/t/cypress/integration/Preservation/WaitingList.ts >index e5c956198f5..3c12003b372 100644 >--- a/t/cypress/integration/Preservation/WaitingList.ts >+++ b/t/cypress/integration/Preservation/WaitingList.ts >@@ -21,32 +21,31 @@ function get_items() { > }, > ]; > } >+let config = { >+ permissions: { manage_sysprefs: "1" }, >+ settings: { >+ enabled: "1", >+ not_for_loan_default_train_in: "42", >+ not_for_loan_waiting_list_in: "24", >+ }, >+}; > describe("WaitingList", () => { > beforeEach(() => { > cy.login(); > cy.title().should("eq", "Koha staff interface"); > cy.intercept( > "GET", >- "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationModule", >- '{"value":"1"}' >- ); >- cy.intercept( >- "GET", >- "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanWaitingListIn", >- '{"value":"24"}' >- ); >- cy.intercept( >- "GET", >- "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanDefaultTrainIn", >- '{"value":"42"}' >+ "/api/v1/preservation/config", >+ JSON.stringify(config) > ); > }); > > it("List", () => { >+ config.settings.not_for_loan_waiting_list_in = ""; > cy.intercept( > "GET", >- "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanWaitingListIn", >- '{"value":""}' >+ "/api/v1/preservation/config", >+ JSON.stringify(config) > ); > cy.visit("/cgi-bin/koha/preservation/home.pl"); > cy.intercept("GET", "/api/v1/preservation/waiting-list/items*", []); >@@ -55,10 +54,11 @@ describe("WaitingList", () => { > "You need to configure this module first." > ); > >+ config.settings.not_for_loan_waiting_list_in = "42"; > cy.intercept( > "GET", >- "/cgi-bin/koha/svc/config/systempreferences/?pref=PreservationNotForLoanWaitingListIn", >- '{"value":"42"}' >+ "/api/v1/preservation/config", >+ JSON.stringify(config) > ); > cy.visit("/cgi-bin/koha/preservation/home.pl"); > cy.intercept("GET", "/api/v1/preservation/waiting-list/items*", []); >@@ -73,7 +73,6 @@ describe("WaitingList", () => { > cy.visit("/cgi-bin/koha/preservation/waiting-list"); > cy.intercept("POST", "/api/v1/preservation/waiting-list/items", { > statusCode: 500, >- error: "Something went wrong", > }); > cy.get("#waiting-list").contains("Add to waiting list").click(); > cy.get("#barcode_list").type("bc_1\nbc_2\nbc_3"); >@@ -117,7 +116,6 @@ describe("WaitingList", () => { > // Submit the form, get 500 > cy.intercept("DELETE", "/api/v1/preservation/waiting-list/items/*", { > statusCode: 500, >- error: "Something went wrong", > }); > cy.get("#waiting-list table tbody tr:first").contains("Remove").click(); > cy.contains("Yes, remove").click(); >-- >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 35201
:
158123
|
158124
|
158135
|
158136