diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue index 7395855511..c7d35b1648 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/ERM/Main.vue @@ -89,6 +89,7 @@ export default { client.config.get().then(result => { config.value = result; if (config.value.settings.ERMModule != 1) { + loaded(); return setError( $__( "The e-resource management module is disabled, turn on ERMModule to use it" diff --git a/t/cypress/integration/ERM/Main.ts b/t/cypress/integration/ERM/Main.ts new file mode 100644 index 0000000000..58dc5b90dc --- /dev/null +++ b/t/cypress/integration/ERM/Main.ts @@ -0,0 +1,39 @@ +describe("Main component - pref off", () => { + beforeEach(() => { + cy.login(); + cy.title().should("eq", "Koha staff interface"); + cy.intercept( + "GET", + "/api/v1/erm/config", + '{"settings":{"ERMModule":"0","ERMProviders":["local"]}}' + ); + }); + + it("Home", () => { + cy.visit("/cgi-bin/koha/erm/erm.pl"); + cy.get(".main .sidebar_menu").should("not.exist"); + cy.get(".main div[class='alert alert-warning']").contains( + "The e-resource management module is disabled, turn on ERMModule to use it" + ); + cy.get(".main div[class='alert alert-warning'] a").click(); + cy.url().should("match", /\/cgi-bin\/koha\/admin\/preferences.pl/); + }); +}); + +describe("Main component - pref on", () => { + beforeEach(() => { + cy.login(); + cy.title().should("eq", "Koha staff interface"); + cy.intercept( + "GET", + "/api/v1/erm/config", + '{"settings":{"ERMModule":"1","ERMProviders":["local"]}}' + ); + }); + + it("Home", () => { + cy.visit("/cgi-bin/koha/erm/erm.pl"); + cy.get(".main .sidebar_menu").should("exist"); + cy.get(".main div[class='alert alert-warning']").should("not.exist"); + }); +});