From bfd593946852ec859052a61d10962f6f59b658b0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 24 Mar 2025 10:31:41 +0100 Subject: [PATCH] Bug 37273: Fix Cypress tests Signed-off-by: Jonathan Druart --- t/cypress/integration/ERM/Agreements_spec.ts | 31 ++++++++++---------- t/cypress/integration/ERM/Licenses_spec.ts | 30 ++++++++++--------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/t/cypress/integration/ERM/Agreements_spec.ts b/t/cypress/integration/ERM/Agreements_spec.ts index 1d6dd91a255..6bbcb2cdf38 100644 --- a/t/cypress/integration/ERM/Agreements_spec.ts +++ b/t/cypress/integration/ERM/Agreements_spec.ts @@ -534,13 +534,14 @@ describe("Agreement CRUD operations", () => { "get-agreement" ); cy.visit("/cgi-bin/koha/erm/agreements"); - let name_link = cy.get( - "#agreements_list table tbody tr:first td:first a" - ); - name_link.should( - "have.text", - agreement.name + " (#" + agreement.agreement_id + ")" - ); + let id_cell = cy.get("#agreements_list table tbody tr:first td:first"); + id_cell.contains(agreement.agreement_id); + + let name_link = cy + .get("#agreements_list table tbody tr:first td") + .eq(1) + .find("a"); + name_link.should("have.text", agreement.name); name_link.click(); cy.wait("@get-agreement"); cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! @@ -618,14 +619,14 @@ describe("Agreement CRUD operations", () => { cy.intercept("GET", "/api/v1/erm/agreements/*", agreement).as( "get-agreement" ); - cy.visit("/cgi-bin/koha/erm/agreements"); - let name_link = cy.get( - "#agreements_list table tbody tr:first td:first a" - ); - name_link.should( - "have.text", - agreement.name + " (#" + agreement.agreement_id + ")" - ); + let id_cell = cy.get("#agreements_list table tbody tr:first td:first"); + id_cell.contains(agreement.agreement_id); + + let name_link = cy + .get("#agreements_list table tbody tr:first td") + .eq(1) + .find("a"); + name_link.should("have.text", agreement.name); name_link.click(); cy.wait("@get-agreement"); cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! diff --git a/t/cypress/integration/ERM/Licenses_spec.ts b/t/cypress/integration/ERM/Licenses_spec.ts index 361dfa94bff..170d28e3eed 100644 --- a/t/cypress/integration/ERM/Licenses_spec.ts +++ b/t/cypress/integration/ERM/Licenses_spec.ts @@ -246,13 +246,14 @@ describe("License CRUD operations", () => { "get-license" ); cy.visit("/cgi-bin/koha/erm/licenses"); - let name_link = cy.get( - "#licenses_list table tbody tr:first td:first a" - ); - name_link.should( - "have.text", - license.name + " (#" + license.license_id + ")" - ); + let id_cell = cy.get("#licenses_list table tbody tr:first td:first"); + id_cell.contains(license.license_id); + + let name_link = cy + .get("#licenses_list table tbody tr:first td") + .eq(1) + .find("a"); + name_link.should("have.text", license.name); name_link.click(); cy.wait("@get-license"); cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! @@ -323,13 +324,14 @@ describe("License CRUD operations", () => { "get-license" ); cy.visit("/cgi-bin/koha/erm/licenses"); - let name_link = cy.get( - "#licenses_list table tbody tr:first td:first a" - ); - name_link.should( - "have.text", - license.name + " (#" + license.license_id + ")" - ); + let id_cell = cy.get("#licenses_list table tbody tr:first td:first"); + id_cell.contains(license.license_id); + + let name_link = cy + .get("#licenses_list table tbody tr:first td") + .eq(1) + .find("a"); + name_link.should("have.text", license.name); name_link.click(); cy.wait("@get-license"); cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! -- 2.34.1