Bugzilla – Attachment 188982 Details for
Bug 39320
Create a 'landing page' for ERM
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39320: (QA follow-up): Simplify widget tests
Bug-39320-QA-follow-up-Simplify-widget-tests.patch (text/plain), 7.94 KB, created by
Pedro Amorim
on 2025-11-03 16:18:04 UTC
(
hide
)
Description:
Bug 39320: (QA follow-up): Simplify widget tests
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-11-03 16:18:04 UTC
Size:
7.94 KB
patch
obsolete
>From 2ebe4359b91f52cfde2db1042a11b76945c40405 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Mon, 3 Nov 2025 16:16:29 +0000 >Subject: [PATCH] Bug 39320: (QA follow-up): Simplify widget tests > >This simplifies the tests, only visiting the homepage once and not navigating outside of it. > >This must pass 10/10: >for i in {1..10}; do cypress run --spec t/cypress/integration/ERM/ModuleDashboard_spec.ts; done > >Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk> >--- > .../integration/ERM/ModuleDashboard_spec.ts | 123 ++++++++---------- > t/cypress/support/e2e.js | 22 ++-- > 2 files changed, 67 insertions(+), 78 deletions(-) > >diff --git a/t/cypress/integration/ERM/ModuleDashboard_spec.ts b/t/cypress/integration/ERM/ModuleDashboard_spec.ts >index 06baa502e99..82f3b72c0d1 100644 >--- a/t/cypress/integration/ERM/ModuleDashboard_spec.ts >+++ b/t/cypress/integration/ERM/ModuleDashboard_spec.ts >@@ -43,9 +43,14 @@ describe("ERM Module Dashboard", () => { > }, > }).as("getDataProvidersCount"); > >+ cy.intercept("GET", "/api/v1/erm/usage_data_providers/1", { >+ statusCode: 200, >+ body: cy.get_usage_data_provider(), >+ }).as("getDataProvider"); >+ > cy.intercept( > "GET", >- "/api/v1/erm/default_usage_reports", >+ "/api/v1/erm/default_usage_reports*", > cy.get_eusage_reports() > ).as("getReports"); > >@@ -123,15 +128,60 @@ describe("ERM Module Dashboard", () => { > }).as("get-ERM-av-cats-values"); > }); > >- it("Counts", () => { >+ it("Run eUsage report empty", () => { >+ cy.intercept("GET", "/api/v1/erm/default_usage_reports", []).as( >+ "emptyReports" >+ ); > cy.visit("/cgi-bin/koha/erm/erm.pl"); > > //Display >+ cy.get(".widget#ERMRunUsageReport .widget-content").should( >+ "contain", >+ "Loading..." >+ ); >+ >+ cy.wait("@getLicenses"); >+ cy.wait("@getJobs"); >+ cy.wait("@emptyReports"); > cy.wait("@getAgreementsCount"); > cy.wait("@getLicenses"); > cy.wait("@getPackagesCount"); > cy.wait("@getTitlesCount"); > cy.wait("@getDataProvidersCount"); >+ >+ cy.get(".widget#ERMRunUsageReport .widget-content").should( >+ "contain", >+ "No saved eUsage reports are available to run." >+ ); >+ cy.get(".widget#ERMRunUsageReport .widget-content") >+ .find("a") >+ .should("have.attr", "href", "/cgi-bin/koha/erm/eusage/reports") >+ .contains("Create a report"); >+ }); >+ >+ it("ERM dashboard widgets", () => { >+ cy.visit("/cgi-bin/koha/erm/erm.pl"); >+ >+ //ERMLicensesNeedingAction loading >+ cy.get(".widget#ERMLicensesNeedingAction .widget-content").should( >+ "contain", >+ "Loading..." >+ ); >+ //ERMLatestSUSHIJobs loading >+ cy.get(".widget#ERMLatestSUSHIJobs .widget-content").should( >+ "contain", >+ "Loading..." >+ ); >+ cy.wait("@getLicenses"); >+ cy.wait("@getJobs"); >+ cy.wait("@getReports"); >+ cy.wait("@getAgreementsCount"); >+ cy.wait("@getLicenses"); >+ cy.wait("@getPackagesCount"); >+ cy.wait("@getTitlesCount"); >+ cy.wait("@getDataProvidersCount"); >+ >+ //ERMCounts > cy.get(".widget#ERMCounts .widget-content").contains("1 agreement"); > cy.get(".widget#ERMCounts .widget-content").contains("5 licenses"); > cy.get(".widget#ERMCounts .widget-content").contains( >@@ -206,34 +256,8 @@ describe("ERM Module Dashboard", () => { > .children() > .first() > .should("have.id", "ERMCounts"); >- }); >- >- it("Run eUsage report empty", () => { >- cy.intercept("GET", "/api/v1/erm/default_usage_reports", []).as( >- "emptyReports" >- ); >- cy.visit("/cgi-bin/koha/erm/erm.pl"); >- >- //Display >- cy.get(".widget#ERMRunUsageReport .widget-content").should( >- "contain", >- "Loading..." >- ); >- cy.wait("@emptyReports"); >- cy.get(".widget#ERMRunUsageReport .widget-content").should( >- "contain", >- "No saved eUsage reports are available to run." >- ); >- cy.get(".widget#ERMRunUsageReport .widget-content") >- .find("a") >- .should("have.attr", "href", "/cgi-bin/koha/erm/eusage/reports") >- .contains("Create a report"); >- }); >- >- it("Run eUsage report: exists", () => { >- cy.visit("/cgi-bin/koha/erm/erm.pl"); >- cy.wait("@getReports"); > >+ //ERMRunUsageReport > cy.get(".widget#ERMRunUsageReport .widget-content") > .find(".v-select") > .should("exist"); >@@ -252,17 +276,6 @@ describe("ERM Module Dashboard", () => { > .find("button") > .contains("Run") > .should("not.be.disabled"); >- cy.get( >- ".widget#ERMRunUsageReport .widget-content button.btn-primary" >- ).click(); >- cy.url().should("match", /erm\/eusage\/reports\/viewer/); >- >- cy.intercept( >- "GET", >- "/api/v1/erm/default_usage_reports", >- cy.get_eusage_reports() >- ); >- cy.visit("/cgi-bin/koha/erm/erm.pl"); > > //Move > cy.get( >@@ -298,17 +311,8 @@ describe("ERM Module Dashboard", () => { > .children() > .first() > .should("have.id", "ERMRunUsageReport"); >- }); > >- it("Licenses needing action", () => { >- cy.visit("/cgi-bin/koha/erm/erm.pl"); >- >- //Display >- cy.get(".widget#ERMLicensesNeedingAction .widget-content").should( >- "contain", >- "Loading..." >- ); >- cy.wait("@getLicenses"); >+ // ERMLicensesNeedingAction > cy.get( > ".widget#ERMLicensesNeedingAction .widget-content table tbody tr:first" > ).contains("license 1"); >@@ -367,30 +371,15 @@ describe("ERM Module Dashboard", () => { > .children() > .first() > .should("have.id", "ERMLicensesNeedingAction"); >- }); > >- it("Latest SUSHI Counter jobs", () => { >- cy.visit("/cgi-bin/koha/erm/erm.pl"); >- >- //Display >- cy.get(".widget#ERMLatestSUSHIJobs .widget-content").should( >- "contain", >- "Loading..." >- ); >- cy.wait("@getJobs"); >+ //ERMLatestSUSHIJobs > cy.get( > ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:first" > ).contains("Finished"); > > cy.get( > ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:nth-child(2)" >- ) >- .contains("Wiley Online Library") >- .click(); >- >- cy.url().should("match", /erm\/eusage\/usage_data_providers/); >- >- cy.visit("/cgi-bin/koha/erm/erm.pl"); >+ ).contains("Wiley Online Library"); > > cy.get( > ".widget#ERMLatestSUSHIJobs .widget-content table tbody tr td:nth-child(5)" >diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js >index 2567bdb26a1..af263283ce2 100644 >--- a/t/cypress/support/e2e.js >+++ b/t/cypress/support/e2e.js >@@ -1973,14 +1973,14 @@ Cypress.Commands.add("mock_table_settings", (settings, table_settings_var) => { > }); > }); > >-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." >- ); >- } >- }); >-}); >+// 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.39.5
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 39320
:
187513
|
187514
|
187515
|
187516
|
187517
|
187518
|
187519
|
187520
|
187521
|
187522
|
187563
|
187568
|
187635
|
187636
|
187637
|
187638
|
187639
|
187640
|
187641
|
187642
|
187643
|
187644
|
187645
|
188094
|
188095
|
188096
|
188097
|
188098
|
188099
|
188100
|
188101
|
188102
|
188103
|
188104
|
188151
|
188279
|
188280
|
188281
|
188282
|
188283
|
188284
|
188285
|
188312
|
188315
|
188372
|
188375
|
188376
|
188637
|
188638
|
188639
|
188640
|
188641
|
188830
|
188831
|
188832
|
188833
|
188834
|
188835
|
188836
|
188837
|
188838
|
188839
|
188840
|
188841
|
188842
|
188843
|
188844
|
188845
|
188846
|
188847
|
188848
|
188849
|
188850
|
188851
|
188852
|
188853
|
188854
|
188855
|
188856
|
188857
|
188858
|
188859
|
188860
|
188861
|
188862
|
188863
|
188864
|
188885
|
188886
|
188887
|
188888
|
188889
|
188890
|
188891
|
188892
|
188893
|
188894
|
188895
|
188896
|
188897
|
188898
|
188899
|
188900
|
188901
|
188902
|
188903
|
188904
|
188905
|
188906
|
188907
|
188908
|
188909
|
188910
|
188911
|
188912
|
188913
|
188914
|
188915
|
188916
|
188917
|
188918
|
188919
|
188932
|
188938
|
188939
|
188940
|
188941
|
188942
|
188943
|
188944
|
188945
|
188946
|
188947
|
188948
|
188949
|
188950
|
188951
|
188952
|
188953
|
188954
|
188955
|
188956
|
188957
|
188958
|
188959
|
188960
|
188961
|
188962
|
188963
|
188964
|
188965
|
188966
|
188967
|
188968
|
188969
|
188970
|
188971
|
188972
|
188973
|
188974
|
188980
|
188981
|
188982
|
188987