Bugzilla – Attachment 171205 Details for
Bug 37513
Disable 'Delete' button if the record source cannot be deleted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37513: Fix and add more Cypress tests
Bug-37513-Fix-and-add-more-Cypress-tests.patch (text/plain), 5.28 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-09-09 15:08:56 UTC
(
hide
)
Description:
Bug 37513: Fix and add more Cypress tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-09-09 15:08:56 UTC
Size:
5.28 KB
patch
obsolete
>From b2b451e7167ef829dcac19726607fde3cb187e43 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 9 Sep 2024 11:11:39 -0300 >Subject: [PATCH] Bug 37513: Fix and add more Cypress tests > >--- > .../integration/Admin/RecordSources_spec.ts | 92 +++++++++++++++---- > 1 file changed, 74 insertions(+), 18 deletions(-) > >diff --git a/t/cypress/integration/Admin/RecordSources_spec.ts b/t/cypress/integration/Admin/RecordSources_spec.ts >index 298eb186120..90f13afc8ef 100644 >--- a/t/cypress/integration/Admin/RecordSources_spec.ts >+++ b/t/cypress/integration/Admin/RecordSources_spec.ts >@@ -64,9 +64,24 @@ describe("Record sources CRUD tests", () => { > cy.intercept("GET", "/api/v1/record_sources*", { > statusCode: 200, > body: [ >- { record_source_id: 1, name: "Source 1", can_be_edited: true }, >- { record_source_id: 2, name: "Source 2", can_be_edited: false }, >- { record_source_id: 3, name: "Source 3", can_be_edited: true }, >+ { >+ record_source_id: 1, >+ name: "Source 1", >+ can_be_edited: true, >+ usage_count: 0, >+ }, >+ { >+ record_source_id: 2, >+ name: "Source 2", >+ can_be_edited: false, >+ usage_count: 1, >+ }, >+ { >+ record_source_id: 3, >+ name: "Source 3", >+ can_be_edited: true, >+ usage_count: 0, >+ }, > ], > headers: { > "X-Base-Total-Count": "3", >@@ -76,25 +91,51 @@ describe("Record sources CRUD tests", () => { > cy.visit("/cgi-bin/koha/admin/record_sources"); > cy.get("#record_sources_list").contains("Showing 1 to 3 of 3 entries"); > >- // Test true => "Yes" >- let row_1 = cy.get(".dataTable > tbody > tr:first-child"); >- row_1.get("td:nth-child(3n+3)").contains("Yes"); >- // Test false => "No" >- let row_2 = cy.get(".dataTable > tbody > tr:nth-child(2n+2)"); >- row_2.get("td:nth-child(3n+3)").contains("No"); >+ cy.get(".dataTable > tbody > tr:first-child").within(() => { >+ // Test true => "Yes" >+ cy.get("td:nth-child(3n+3)").contains("Yes"); >+ // last column >+ cy.get("td:last-child").within(() => { >+ cy.contains("Edit"); >+ // usage_count = 0 then the delete button is displayed >+ cy.contains("Delete"); >+ }); >+ }); > >- // Action buttons displayed >- row_1.get("td:last-child").contains("Edit"); >- row_1.get("td:last-child").contains("Delete"); >+ cy.get(".dataTable > tbody > tr:nth-child(2)").within(() => { >+ // Test false => "No" >+ cy.get("td:nth-child(3n+3)").contains("No"); >+ // last column >+ cy.get("td:last-child").within(() => { >+ cy.contains("Edit"); >+ // usage_count > 0 then no delete button >+ cy.should("not.contain", "Delete"); >+ }); >+ }); > }); > > it("Edit", () => { > cy.intercept("GET", "/api/v1/record_sources*", { > statusCode: 200, > body: [ >- { record_source_id: 1, name: "Source 1", can_be_edited: true }, >- { record_source_id: 2, name: "Source 2", can_be_edited: false }, >- { record_source_id: 3, name: "Source 3", can_be_edited: true }, >+ { >+ record_source_id: 1, >+ name: "Source 1", >+ can_be_edited: true, >+ usage_count: 0, >+ }, >+ { >+ record_source_id: 2, >+ name: "Source 2", >+ can_be_edited: false, >+ usage_count: 1, >+ }, >+ { >+ record_source_id: 3, >+ name: "Source 3", >+ can_be_edited: true, >+ usage_count: 0, >+ }, > ], > headers: { > "X-Base-Total-Count": "3", >@@ -144,9 +185,24 @@ describe("Record sources CRUD tests", () => { > cy.intercept("GET", "/api/v1/record_sources*", { > statusCode: 200, > body: [ >- { record_source_id: 1, name: "Source 1", can_be_edited: true }, >- { record_source_id: 2, name: "Source 2", can_be_edited: false }, >- { record_source_id: 3, name: "Source 3", can_be_edited: true }, >+ { >+ record_source_id: 1, >+ name: "Source 1", >+ can_be_edited: true, >+ usage_count: 0, >+ }, >+ { >+ record_source_id: 2, >+ name: "Source 2", >+ can_be_edited: false, >+ usage_count: 0, >+ }, >+ { >+ record_source_id: 3, >+ name: "Source 3", >+ can_be_edited: true, >+ usage_count: 1, >+ }, > ], > headers: { > "X-Base-Total-Count": "3", >-- >2.46.0
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 37513
:
170475
|
170476
|
170477
|
170478
|
170479
|
170512
|
170513
|
170514
|
170515
|
170516
|
170544
|
170545
|
170546
|
170547
|
170548
| 171205 |
171236