diff --git a/Koha/SIP2/Object.pm b/Koha/SIP2/Object.pm index 860cf6aa2f..c142df073f 100644 --- a/Koha/SIP2/Object.pm +++ b/Koha/SIP2/Object.pm @@ -57,13 +57,15 @@ sub delete { return $self->SUPER::delete; } -# sub _update_config_timestamp { -# my $timestamp = DateTime->now; +sub _update_config_timestamp { + return 1; -# my $config_timestamp = Koha::SIP2::ServerParams->find( { key => 'config_timestamp' } ) -# || Koha::SIP2::ServerParam->new( { key => 'config_timestamp' } ); -# $config_timestamp->value( DateTime->now->epoch )->store; -# } + # my $timestamp = DateTime->now; + + # my $config_timestamp = Koha::SIP2::ServerParams->find( { key => 'config_timestamp' } ) + # || Koha::SIP2::ServerParam->new( { key => 'config_timestamp' } ); + # $config_timestamp->value( DateTime->now->epoch )->store; +} 1; diff --git a/api/v1/swagger/paths/sip2_accounts.yaml b/api/v1/swagger/paths/sip2_accounts.yaml index d9f0250191..8c785f22b9 100644 --- a/api/v1/swagger/paths/sip2_accounts.yaml +++ b/api/v1/swagger/paths/sip2_accounts.yaml @@ -147,6 +147,7 @@ items: type: string enum: + - institution - custom_item_fields - item_fields - custom_patron_fields diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/cash-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/cash-api-client.js index 80b3ee0b5f..9f47159454 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/cash-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/cash-api-client.js @@ -1,4 +1,4 @@ -export class CataloguingAPIClient { +export class CashAPIClient { constructor(HttpClient) { this.httpClient = new HttpClient({ baseURL: "/api/v1/", @@ -8,7 +8,7 @@ export class CataloguingAPIClient { get cash_registers() { return { getAll: (query, params, headers) => - this.getAll({ + this.httpClient.getAll({ endpoint: "cash_registers", query, params, diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/item-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/item-api-client.js index 5fd210e5b8..c4a31f0fed 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/item-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/item-api-client.js @@ -20,7 +20,7 @@ export class ItemAPIClient { get item_types() { return { getAll: (query, params, headers) => - this.getAll({ + this.httpClient.getAll({ endpoint: "item_types", query, params, diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/patron-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/patron-api-client.js index c2760a8466..4ddaed0cfc 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/patron-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/patron-api-client.js @@ -1,7 +1,7 @@ export class PatronAPIClient { constructor(HttpClient) { this.httpClient = new HttpClient({ - baseURL: "/api/v1/patrons/", + baseURL: "/api/v1/", }); } @@ -9,15 +9,15 @@ export class PatronAPIClient { return { get: id => this.httpClient.get({ - endpoint: id, + endpoint: "patrons/" + id, }), }; } - get patron_categories() { + get categories() { return { getAll: (query, params, headers) => - this.getAll({ + this.httpClient.getAll({ endpoint: "patron_categories", query, params, diff --git a/koha-tmpl/intranet-tmpl/prog/js/fetch/sip2-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/fetch/sip2-api-client.js index 3d0711c452..2950f81c86 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/fetch/sip2-api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/fetch/sip2-api-client.js @@ -8,29 +8,29 @@ export class SIP2APIClient { get institutions() { return { get: id => - this.get({ + this.httpClient.get({ endpoint: "institutions/" + id, }), getAll: params => - this.getAll({ + this.httpClient.getAll({ endpoint: "institutions", }), delete: id => - this.delete({ + this.httpClient.delete({ endpoint: "institutions/" + id, }), create: institution => - this.post({ + this.httpClient.post({ endpoint: "institutions", body: institution, }), update: (institution, id) => - this.put({ + this.httpClient.put({ endpoint: "institutions/" + id, body: institution, }), count: (query = {}) => - this.count({ + this.httpClient.count({ endpoint: "institutions?" + new URLSearchParams({ @@ -45,33 +45,33 @@ export class SIP2APIClient { get accounts() { return { get: id => - this.get({ + this.httpClient.get({ endpoint: "accounts/" + id, headers: { "x-koha-embed": - "custom_item_fields,item_fields,custom_patron_fields,patron_attributes,screen_msg_regexs,sort_bin_mappings,system_preference_overrides", + "institution,custom_item_fields,item_fields,custom_patron_fields,patron_attributes,screen_msg_regexs,sort_bin_mappings,system_preference_overrides", }, }), getAll: params => - this.getAll({ + this.httpClient.getAll({ endpoint: "accounts", }), delete: id => - this.delete({ + this.httpClient.delete({ endpoint: "accounts/" + id, }), create: account => - this.post({ + this.httpClient.post({ endpoint: "accounts", body: account, }), update: (account, id) => - this.put({ + this.httpClient.put({ endpoint: "accounts/" + id, body: account, }), count: (query = {}) => - this.count({ + this.httpClient.count({ endpoint: "accounts?" + new URLSearchParams({ @@ -86,29 +86,29 @@ export class SIP2APIClient { get listeners() { return { get: id => - this.get({ + this.httpClient.get({ endpoint: "listeners/" + id, }), getAll: params => - this.getAll({ + this.httpClient.getAll({ endpoint: "listeners", }), delete: id => - this.delete({ + this.httpClient.delete({ endpoint: "listeners/" + id, }), create: listener => - this.post({ + this.httpClient.post({ endpoint: "listeners", body: listener, }), update: (listener, id) => - this.put({ + this.httpClient.put({ endpoint: "listeners/" + id, body: listener, }), count: (query = {}) => - this.count({ + this.httpClient.count({ endpoint: "listeners?" + new URLSearchParams({ @@ -123,11 +123,11 @@ export class SIP2APIClient { get serverparams() { return { getAll: params => - this.getAll({ + this.httpClient.getAll({ endpoint: "serverparams", }), updateAll: body => - this.patch({ + this.httpClient.patch({ endpoint: "serverparams", body: body, }), @@ -137,29 +137,29 @@ export class SIP2APIClient { get system_preference_overrides() { return { get: id => - this.get({ + this.httpClient.get({ endpoint: "system_preference_overrides/" + id, }), getAll: params => - this.getAll({ + this.httpClient.getAll({ endpoint: "system_preference_overrides", }), delete: id => - this.delete({ + this.httpClient.delete({ endpoint: "system_preference_overrides/" + id, }), create: system_preference_override => - this.post({ + this.httpClient.post({ endpoint: "system_preference_overrides", body: system_preference_override, }), update: (system_preference_override, id) => - this.put({ + this.httpClient.put({ endpoint: "system_preference_overrides/" + id, body: system_preference_override, }), count: (query = {}) => - this.count({ + this.httpClient.count({ endpoint: "system_preference_overrides?" + new URLSearchParams({ diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/Main.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/Main.vue index a654d47172..271c33715e 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/Main.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/Main.vue @@ -21,9 +21,9 @@ diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue index d69ae73cc4..ecd80d2938 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2InstitutionResource.vue @@ -1,34 +1,49 @@ + + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2SystemPreferenceOverrideResource.vue b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2SystemPreferenceOverrideResource.vue index 840d4d8a97..cfc92fc341 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2SystemPreferenceOverrideResource.vue +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/components/SIP2/SIP2SystemPreferenceOverrideResource.vue @@ -1,87 +1,70 @@ + diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js index 3adc914420..2906a9c296 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/api-client.js @@ -9,7 +9,7 @@ import CashAPIClient from "@fetch/cash-api-client"; import ItemAPIClient from "@fetch/item-api-client"; import RecordSourcesAPIClient from "@fetch/record-sources-api-client"; import SysprefAPIClient from "@fetch/system-preferences-api-client"; -import SIP2APIClient from "@fetch/ssip2-api-client"; +import SIP2APIClient from "@fetch/sip2-api-client"; import PreservationAPIClient from "@fetch/preservation-api-client"; export const APIClient = { diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/sip2.ts b/koha-tmpl/intranet-tmpl/prog/js/vue/modules/sip2.ts index c12a3fb08f..86777a1afe 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/modules/sip2.ts +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/modules/sip2.ts @@ -21,7 +21,6 @@ import { routes as routesDef } from "../routes/sip2"; import { useMainStore } from "../stores/main"; import { useVendorStore } from "../stores/vendors"; -import { useAVStore } from "../stores/authorised-values"; import { useSIP2Store } from "../stores/sip2"; import { useNavigationStore } from "../stores/navigation"; import i18n from "../i18n"; @@ -29,7 +28,6 @@ import i18n from "../i18n"; const pinia = createPinia(); const mainStore = useMainStore(pinia); -const AVStore = useAVStore(pinia); const navigationStore = useNavigationStore(pinia); const routes = navigationStore.setRoutes(routesDef); @@ -51,7 +49,6 @@ const rootComponent = app app.config.unwrapInjectedRef = true; app.provide("vendorStore", useVendorStore(pinia)); app.provide("mainStore", mainStore); -app.provide("AVStore", AVStore); app.provide("navigationStore", navigationStore); const SIP2Store = useSIP2Store(pinia); app.provide("SIP2Store", SIP2Store); diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/sip2.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/sip2.js index f662d17c42..1c9d59826d 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/sip2.js +++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/sip2.js @@ -1,7 +1,6 @@ import { defineStore } from "pinia"; import { reactive, toRefs } from "vue"; import { withAuthorisedValueActions } from "../composables/authorisedValues"; -import { $__ } from "@koha-vue/i18n"; export const useSIP2Store = defineStore("erm", () => { const store = reactive({ diff --git a/t/cypress/integration/SIP2/Accounts.ts b/t/cypress/integration/SIP2/Accounts.ts index 9eea610371..94e29a3926 100644 --- a/t/cypress/integration/SIP2/Accounts.ts +++ b/t/cypress/integration/SIP2/Accounts.ts @@ -87,7 +87,7 @@ describe("Accounts", () => { error: "Something went wrong", }); cy.visit("/cgi-bin/koha/sip2/sip2.pl"); - cy.get("#navmenulist").contains("Accounts").click(); + cy.get(".sidebar_menu").contains("Accounts").click(); cy.get("main div[class='alert alert-warning']").contains( /Something went wrong/ ); @@ -95,7 +95,7 @@ describe("Accounts", () => { // GET accounts returns empty list cy.intercept("GET", "/api/v1/sip2/accounts*", []); cy.visit("/cgi-bin/koha/sip2/accounts"); - cy.get("#account_list").contains("There are no accounts defined"); + cy.get("#accounts_list").contains("There are no accounts defined"); // GET accounts returns something let account = get_account(); @@ -111,7 +111,7 @@ describe("Accounts", () => { }); cy.intercept("GET", "/api/v1/sip2/accounts/*", account); cy.visit("/cgi-bin/koha/sip2/accounts/"); - cy.get("#account_list").contains("Showing 1 to 1 of 1 entries"); + cy.get("#accounts_list").contains("Showing 1 to 1 of 1 entries"); }); it("Add account", () => { @@ -132,14 +132,14 @@ describe("Accounts", () => { // Click the button in the toolbar cy.visit("/cgi-bin/koha/sip2/accounts"); cy.contains("New account").click(); - cy.get("#account_add h2").contains("New account"); + cy.get("#accounts_add h2").contains("New account"); cy.left_menu_active_item_is("Accounts"); // Fill in the form for normal attributes - cy.get("#account_add").contains("Submit").click(); + cy.get("#accounts_add").contains("Submit").click(); cy.get("input:invalid,textarea:invalid,select:invalid").should( "have.length", - 2 + 3 ); cy.get("#login_id").type(account.login_id); cy.get("#login_password").type(account.login_password); @@ -196,13 +196,13 @@ describe("Accounts", () => { // relationshipWidgets cy.contains("Add new custom patron field").click(); - cy.get("#account_add").contains("Submit").click(); + cy.get("#accounts_add").contains("Submit").click(); cy.get("input:invalid,textarea:invalid,select:invalid").should( "have.length", 2 ); - // Add new periods + // Add new custom patron fields cy.contains("Add new custom patron field").click(); cy.get("#custom_patron_fields_relationship > fieldset").should( "have.length", @@ -211,8 +211,12 @@ describe("Accounts", () => { cy.contains("a", "Remove this custom patron field").click(); - cy.get("#custom_patron_fields_0 #field").type("test"); - cy.get("#custom_patron_fields_0 #template").type("test"); + cy.get("#custom_patron_fields_0 #custom_patron_fields_field_0").type( + "test" + ); + cy.get("#custom_patron_fields_0 #custom_patron_fields_template_0").type( + "test" + ); cy.get(".accordion-item").each($el => { cy.wrap($el).children(".collapse").should("have.class", "show"); @@ -234,7 +238,7 @@ describe("Accounts", () => { cy.intercept("POST", "/api/v1/sip2/accounts", { statusCode: 500, }); - cy.get("#account_add").contains("Submit").click(); + cy.get("#accounts_add").contains("Submit").click(); cy.get("main div[class='alert alert-warning']").contains( "Something went wrong: Error: Internal Server Error" @@ -245,7 +249,7 @@ describe("Accounts", () => { statusCode: 201, body: account, }); - cy.get("#account_add").contains("Submit").click(); + cy.get("#accounts_add").contains("Submit").click(); cy.get("main div[class='alert alert-info']").contains( "Account created" ); @@ -273,10 +277,9 @@ describe("Accounts", () => { ); // Click the 'Edit' button from the list - cy.get("#account_list table tbody tr:first").contains("Edit").click(); + cy.get("#accounts_list table tbody tr:first").contains("Edit").click(); cy.wait("@get-account"); - cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! - cy.get("#account_add h2").contains("Edit account"); + cy.get("#accounts_add h2").contains("Edit account"); cy.left_menu_active_item_is("Accounts"); // Form has been correctly filled in @@ -301,11 +304,10 @@ describe("Accounts", () => { statusCode: 500, delay: 1000, }); - }); - cy.get("#account_add").contains("Submit").click(); - + }).as("edit-account"); + cy.get("#accounts_add").contains("Submit").click(); cy.get("main div[class='modal_centered']").contains("Submitting..."); - cy.wait(1000); + cy.wait("@edit-account"); cy.get("main div[class='alert alert-warning']").contains( "Something went wrong: Error: Internal Server Error" ); @@ -315,7 +317,7 @@ describe("Accounts", () => { statusCode: 200, body: account, }); - cy.get("#account_add").contains("Submit").click(); + cy.get("#accounts_add").contains("Submit").click(); cy.get("main div[class='alert alert-info']").contains( "Account updated" ); @@ -332,20 +334,19 @@ describe("Accounts", () => { "X-Base-Total-Count": "1", "X-Total-Count": "1", }, - }); + }).as("get-accounts"); cy.intercept("GET", "/api/v1/sip2/accounts/*", account).as( "get-account" ); cy.visit("/cgi-bin/koha/sip2/accounts"); - let name_link = cy.get("#account_list table tbody tr:first td:first a"); - name_link.should( - "have.text", - account.login_id + " (#" + account.sip_account_id + ")" + cy.wait("@get-accounts"); + let name_link = cy.get( + "#accounts_list table tbody tr:first td:first a" ); + name_link.should("have.text", account.login_id); name_link.click(); cy.wait("@get-account"); - cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! - cy.get("#account_show h2").contains( + cy.get("#accounts_show h2").contains( "Account #" + account.sip_account_id ); cy.left_menu_active_item_is("Accounts"); @@ -364,11 +365,13 @@ describe("Accounts", () => { "X-Base-Total-Count": "1", "X-Total-Count": "1", }, - }); + }).as("get-accounts"); cy.intercept("GET", "/api/v1/sip2/accounts/*", account); cy.visit("/cgi-bin/koha/sip2/accounts"); - cy.get("#account_list table tbody tr:first").contains("Delete").click(); + cy.get("#accounts_list table tbody tr:first") + .contains("Delete") + .click(); cy.get(".alert-warning.confirmation h1").contains( "remove this account" ); @@ -388,7 +391,9 @@ describe("Accounts", () => { statusCode: 204, body: null, }); - cy.get("#account_list table tbody tr:first").contains("Delete").click(); + cy.get("#accounts_list table tbody tr:first") + .contains("Delete") + .click(); cy.get(".alert-warning.confirmation h1").contains( "remove this account" ); @@ -399,37 +404,28 @@ describe("Accounts", () => { // Delete from show // Click the "name" link from the list - cy.intercept("GET", "/api/v1/sip2/accounts*", { - statusCode: 200, - body: accounts, - headers: { - "X-Base-Total-Count": "1", - "X-Total-Count": "1", - }, - }); + cy.visit("/cgi-bin/koha/sip2/accounts"); + cy.wait("@get-accounts"); cy.intercept("GET", "/api/v1/sip2/accounts/*", account).as( "get-account" ); - cy.visit("/cgi-bin/koha/sip2/accounts"); - let name_link = cy.get("#account_list table tbody tr:first td:first a"); - name_link.should( - "have.text", - account.login_id + " (#" + account.sip_account_id + ")" + let name_link = cy.get( + "#accounts_list table tbody tr:first td:first a" ); + name_link.should("have.text", account.login_id); name_link.click(); cy.wait("@get-account"); - cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! - cy.get("#account_show h2").contains( + cy.get("#accounts_show h2").contains( "Account #" + account.sip_account_id ); - cy.get("#account_show #toolbar").contains("Delete").click(); + cy.get("#accounts_show #toolbar").contains("Delete").click(); cy.get(".alert-warning.confirmation h1").contains( "remove this account" ); cy.contains("Yes, delete").click(); //Make sure we return to list after deleting from show - cy.get("#account_list table tbody tr:first"); + cy.get("#accounts_list table tbody tr:first"); }); }); diff --git a/t/cypress/integration/SIP2/Institutions.ts b/t/cypress/integration/SIP2/Institutions.ts index 390c3fa66a..8f56b332d7 100644 --- a/t/cypress/integration/SIP2/Institutions.ts +++ b/t/cypress/integration/SIP2/Institutions.ts @@ -13,7 +13,7 @@ describe("Institutions", () => { error: "Something went wrong", }); cy.visit("/cgi-bin/koha/sip2/sip2.pl"); - cy.get("#navmenulist").contains("Institutions").click(); + cy.get(".sidebar_menu").contains("Institutions").click(); cy.get("main div[class='alert alert-warning']").contains( /Something went wrong/ ); @@ -21,7 +21,7 @@ describe("Institutions", () => { // GET institutions returns empty list cy.intercept("GET", "/api/v1/sip2/institutions*", []); cy.visit("/cgi-bin/koha/sip2/institutions"); - cy.get("#institution_list").contains( + cy.get("#institutions_list").contains( "There are no institutions defined" ); @@ -39,7 +39,7 @@ describe("Institutions", () => { }); cy.intercept("GET", "/api/v1/sip2/institutions/*", institution); cy.visit("/cgi-bin/koha/sip2/institutions/"); - cy.get("#institution_list").contains("Showing 1 to 1 of 1 entries"); + cy.get("#institutions_list").contains("Showing 1 to 1 of 1 entries"); }); it("Add institution", () => { @@ -53,14 +53,14 @@ describe("Institutions", () => { // Click the button in the toolbar cy.visit("/cgi-bin/koha/sip2/institutions"); cy.contains("New institution").click(); - cy.get("#institution_add h2").contains("New institution"); + cy.get("#institutions_add h2").contains("New institution"); cy.left_menu_active_item_is("Institutions"); // Fill in the form for normal attributes - cy.get("#institution_add").contains("Submit").click(); + cy.get("#institutions_add").contains("Submit").click(); cy.get("input:invalid,textarea:invalid,select:invalid").should( "have.length", - 2 + 1 ); cy.get("#name").type(institution.name); cy.get("#implementation").type(institution.implementation); @@ -81,7 +81,7 @@ describe("Institutions", () => { cy.intercept("POST", "/api/v1/sip2/institutions", { statusCode: 500, }); - cy.get("#institution_add").contains("Submit").click(); + cy.get("#institutions_add").contains("Submit").click(); cy.get("main div[class='alert alert-warning']").contains( "Something went wrong: Error: Internal Server Error" @@ -92,7 +92,7 @@ describe("Institutions", () => { statusCode: 201, body: institution, }); - cy.get("#institution_add").contains("Submit").click(); + cy.get("#institutions_add").contains("Submit").click(); cy.get("main div[class='alert alert-info']").contains( "Institution created" ); @@ -120,12 +120,11 @@ describe("Institutions", () => { ); // Click the 'Edit' button from the list - cy.get("#institution_list table tbody tr:first") + cy.get("#institutions_list table tbody tr:first") .contains("Edit") .click(); cy.wait("@get-institution"); - cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! - cy.get("#institution_add h2").contains("Edit institution"); + cy.get("#institutions_add h2").contains("Edit institution"); cy.left_menu_active_item_is("Institutions"); // Form has been correctly filled in @@ -151,7 +150,7 @@ describe("Institutions", () => { delay: 1000, }); }); - cy.get("#institution_add").contains("Submit").click(); + cy.get("#institutions_add").contains("Submit").click(); cy.get("main div[class='modal_centered']").contains("Submitting..."); cy.wait(1000); @@ -164,7 +163,7 @@ describe("Institutions", () => { statusCode: 200, body: institution, }); - cy.get("#institution_add").contains("Submit").click(); + cy.get("#institutions_add").contains("Submit").click(); cy.get("main div[class='alert alert-info']").contains( "Institution updated" ); @@ -187,16 +186,12 @@ describe("Institutions", () => { ); cy.visit("/cgi-bin/koha/sip2/institutions"); let name_link = cy.get( - "#institution_list table tbody tr:first td:first a" - ); - name_link.should( - "have.text", - institution.name + " (#" + institution.sip_institution_id + ")" + "#institutions_list table tbody tr:first td:first a" ); + name_link.should("have.text", institution.name); name_link.click(); cy.wait("@get-institution"); - cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! - cy.get("#institution_show h2").contains( + cy.get("#institutions_show h2").contains( "Institution #" + institution.sip_institution_id ); cy.left_menu_active_item_is("Institutions"); @@ -219,7 +214,7 @@ describe("Institutions", () => { cy.intercept("GET", "/api/v1/sip2/institutions/*", institution); cy.visit("/cgi-bin/koha/sip2/institutions"); - cy.get("#institution_list table tbody tr:first") + cy.get("#institutions_list table tbody tr:first") .contains("Delete") .click(); cy.get(".alert-warning.confirmation h1").contains( @@ -241,7 +236,7 @@ describe("Institutions", () => { statusCode: 204, body: null, }); - cy.get("#institution_list table tbody tr:first") + cy.get("#institutions_list table tbody tr:first") .contains("Delete") .click(); cy.get(".alert-warning.confirmation h1").contains( @@ -267,26 +262,22 @@ describe("Institutions", () => { ); cy.visit("/cgi-bin/koha/sip2/institutions"); let name_link = cy.get( - "#institution_list table tbody tr:first td:first a" - ); - name_link.should( - "have.text", - institution.name + " (#" + institution.sip_institution_id + ")" + "#institutions_list table tbody tr:first td:first a" ); + name_link.should("have.text", institution.name); name_link.click(); cy.wait("@get-institution"); - cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! - cy.get("#institution_show h2").contains( + cy.get("#institutions_show h2").contains( "Institution #" + institution.sip_institution_id ); - cy.get("#institution_show #toolbar").contains("Delete").click(); + cy.get("#institutions_show #toolbar").contains("Delete").click(); cy.get(".alert-warning.confirmation h1").contains( "remove this institution" ); cy.contains("Yes, delete").click(); //Make sure we return to list after deleting from show - cy.get("#institution_list table tbody tr:first"); + cy.get("#institutions_list table tbody tr:first"); }); }); diff --git a/t/cypress/integration/SIP2/SystemPreferenceOverrides.ts b/t/cypress/integration/SIP2/SystemPreferenceOverrides.ts index 220f14da7f..6955b0faf3 100644 --- a/t/cypress/integration/SIP2/SystemPreferenceOverrides.ts +++ b/t/cypress/integration/SIP2/SystemPreferenceOverrides.ts @@ -21,7 +21,7 @@ describe("SystemPreferenceOverrides", () => { error: "Something went wrong", }); cy.visit("/cgi-bin/koha/sip2/sip2.pl"); - cy.get("#navmenulist").contains("System preference overrides").click(); + cy.get(".sidebar_menu").contains("System preference overrides").click(); cy.get("main div[class='alert alert-warning']").contains( /Something went wrong/ ); @@ -29,7 +29,7 @@ describe("SystemPreferenceOverrides", () => { // GET system_preference_overrides returns empty list cy.intercept("GET", "/api/v1/sip2/system_preference_overrides*", []); cy.visit("/cgi-bin/koha/sip2/system_preference_overrides"); - cy.get("#system_preference_override_list").contains( + cy.get("#system_preference_overrides_list").contains( "There are no system preference overrides defined" ); @@ -51,7 +51,7 @@ describe("SystemPreferenceOverrides", () => { system_preference_overrides ); cy.visit("/cgi-bin/koha/sip2/system_preference_overrides/"); - cy.get("#system_preference_override_list").contains( + cy.get("#system_preference_overrides_list").contains( "Showing 1 to 1 of 1 entries" ); }); @@ -67,13 +67,13 @@ describe("SystemPreferenceOverrides", () => { // Click the button in the toolbar cy.visit("/cgi-bin/koha/sip2/system_preference_overrides"); cy.contains("New system preference override").click(); - cy.get("#system_preference_override_add h2").contains( + cy.get("#system_preference_overrides_add h2").contains( "New system preference override" ); cy.left_menu_active_item_is("System preference overrides"); // Fill in the form for normal attributes - cy.get("#system_preference_override_add").contains("Submit").click(); + cy.get("#system_preference_overrides_add").contains("Submit").click(); cy.get("input:invalid,textarea:invalid,select:invalid").should( "have.length", 2 @@ -85,7 +85,7 @@ describe("SystemPreferenceOverrides", () => { cy.intercept("POST", "/api/v1/sip2/system_preference_overrides", { statusCode: 500, }); - cy.get("#system_preference_override_add").contains("Submit").click(); + cy.get("#system_preference_overrides_add").contains("Submit").click(); cy.get("main div[class='alert alert-warning']").contains( "Something went wrong: Error: Internal Server Error" @@ -96,7 +96,7 @@ describe("SystemPreferenceOverrides", () => { statusCode: 201, body: system_preference_override, }); - cy.get("#system_preference_override_add").contains("Submit").click(); + cy.get("#system_preference_overrides_add").contains("Submit").click(); cy.get("main div[class='alert alert-info']").contains( "System preference override created" ); @@ -126,12 +126,12 @@ describe("SystemPreferenceOverrides", () => { ).as("get-system_preference_overrides"); // Click the 'Edit' button from the list - cy.get("#system_preference_override_list table tbody tr:first") + cy.get("#system_preference_overrides_list table tbody tr:first") .contains("Edit") .click(); cy.wait("@get-system_preference_overrides"); cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! - cy.get("#system_preference_override_add h2").contains( + cy.get("#system_preference_overrides_add h2").contains( "Edit system preference override" ); cy.left_menu_active_item_is("System preference overrides"); @@ -157,7 +157,7 @@ describe("SystemPreferenceOverrides", () => { }); } ); - cy.get("#system_preference_override_add").contains("Submit").click(); + cy.get("#system_preference_overrides_add").contains("Submit").click(); cy.get("main div[class='modal_centered']").contains("Submitting..."); cy.wait(1000); @@ -170,7 +170,7 @@ describe("SystemPreferenceOverrides", () => { statusCode: 200, body: system_preference_overrides, }); - cy.get("#system_preference_override_add").contains("Submit").click(); + cy.get("#system_preference_overrides_add").contains("Submit").click(); cy.get("main div[class='alert alert-info']").contains( "System preference override updated" ); @@ -197,7 +197,7 @@ describe("SystemPreferenceOverrides", () => { ); cy.visit("/cgi-bin/koha/sip2/system_preference_overrides"); - cy.get("#system_preference_override_list table tbody tr:first") + cy.get("#system_preference_overrides_list table tbody tr:first") .contains("Delete") .click(); cy.get(".alert-warning.confirmation h1").contains( @@ -219,7 +219,7 @@ describe("SystemPreferenceOverrides", () => { statusCode: 204, body: null, }); - cy.get("#system_preference_override_list table tbody tr:first") + cy.get("#system_preference_overrides_list table tbody tr:first") .contains("Delete") .click(); cy.get(".alert-warning.confirmation h1").contains(