Bugzilla – Attachment 174531 Details for
Bug 37576
Add additional fields support to ERM agreements
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 37576: (follow-up) fix broken cypress tests
Bug-37576-follow-up-fix-broken-cypress-tests.patch (text/plain), 7.64 KB, created by
Jake Deery
on 2024-11-14 15:01:47 UTC
(
hide
)
Description:
Bug 37576: (follow-up) fix broken cypress tests
Filename:
MIME Type:
Creator:
Jake Deery
Created:
2024-11-14 15:01:47 UTC
Size:
7.64 KB
patch
obsolete
>From 957563c612e09172294ca1e487a8210267b08487 Mon Sep 17 00:00:00 2001 >From: Jake Deery <jake.deery@ptfs-europe.com> >Date: Thu, 14 Nov 2024 14:34:48 +0000 >Subject: [PATCH] Bug 37576: (follow-up) fix broken cypress tests > >This patch is intended to fix failing Cypress tests >by including the correct payload in get_agreement() >found in e2e.js, and by moving get_package to the >e2e.js with corrected payload also >--- > t/cypress/integration/ERM/Packages_spec.ts | 31 +---- > t/cypress/support/e2e.js | 141 +++++++++++++++++++++ > 2 files changed, 146 insertions(+), 26 deletions(-) > >diff --git a/t/cypress/integration/ERM/Packages_spec.ts b/t/cypress/integration/ERM/Packages_spec.ts >index 746b5b3bd11..fe8e9d1d232 100644 >--- a/t/cypress/integration/ERM/Packages_spec.ts >+++ b/t/cypress/integration/ERM/Packages_spec.ts >@@ -2,27 +2,6 @@ import { mount } from "@cypress/vue"; > const dayjs = require("dayjs"); /* Cannot use our calendar JS code, it's in an include file (!) > Also note that moment.js is deprecated */ > >-function get_package() { >- return { >- package_id: 1, >- name: "package 1", >- package_type: "complete", >- content_type: "Print", >- package_agreements: [ >- { >- agreement: { >- agreement_id: 2, >- description: "agreement description", >- name: "agreement name", >- }, >- agreement_id: 2, >- package_id: 1, >- }, >- ], >- resources_count: 0, >- }; >-} >- > describe("Package CRUD operations", () => { > beforeEach(() => { > cy.login(); >@@ -58,7 +37,7 @@ describe("Package CRUD operations", () => { > cy.get("#packages_list").contains("There are no packages defined"); > > // GET packages returns something >- let erm_package = get_package(); >+ let erm_package = cy.get_package(); > let packages = [erm_package]; > > cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { >@@ -88,7 +67,7 @@ describe("Package CRUD operations", () => { > cy.left_menu_active_item_is("Packages"); > > // Fill in the form for normal attributes >- let erm_package = get_package(); >+ let erm_package = cy.get_package(); > > cy.get("#packages_add").contains("Submit").click(); > cy.get("input:invalid,textarea:invalid,select:invalid").should( >@@ -146,7 +125,7 @@ describe("Package CRUD operations", () => { > }); > > it("Edit package", () => { >- let erm_package = get_package(); >+ let erm_package = cy.get_package(); > let packages = [erm_package]; > // Click the 'Edit' button from the list > cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { >@@ -205,7 +184,7 @@ describe("Package CRUD operations", () => { > }); > > it("Show package", () => { >- let erm_package = get_package(); >+ let erm_package = cy.get_package(); > let packages = [erm_package]; > // Click the "name" link from the list > cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { >@@ -277,7 +256,7 @@ describe("Package CRUD operations", () => { > }); > > it("Delete package", () => { >- let erm_package = get_package(); >+ let erm_package = cy.get_package(); > let packages = [erm_package]; > > // Click the 'Delete' button from the list >diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js >index 27d79e47c60..1f16b449779 100644 >--- a/t/cypress/support/e2e.js >+++ b/t/cypress/support/e2e.js >@@ -214,6 +214,147 @@ cy.get_agreement = () => { > uploaded_on: "2022-10-27T11:57:02+00:00", > }, > ], >+ extended_attributes: [ >+ { >+ field_id: 1, >+ id: "1", >+ record_id: "1", >+ value: "REF", >+ }, >+ { >+ field_id: 1, >+ id: "2", >+ record_id: "1", >+ value: "NFIC", >+ }, >+ { >+ field_id: 2, >+ id: "3", >+ record_id: "1", >+ value: "some text", >+ }, >+ { >+ field_id: 3, >+ id: "4", >+ record_id: "1", >+ value: "some repeatable text", >+ }, >+ { >+ field_id: 4, >+ id: "5", >+ record_id: "1", >+ value: "AF", >+ }, >+ ], >+ _strings: { >+ additional_field_values: [ >+ { >+ field_id: 1, >+ field_label: "AV Repeatable", >+ type: "av", >+ value_str: "Reference, Non-fiction", >+ }, >+ { >+ field_id: 2, >+ field_label: "Text non-repeatable", >+ type: "text", >+ value_str: "some text", >+ }, >+ { >+ field_id: 3, >+ field_label: "Text repeatable", >+ type: "text", >+ value_str: "some repeatable text", >+ }, >+ { >+ field_id: 4, >+ field_label: "AV Searchable", >+ type: "av", >+ value_str: "Afghanistan", >+ }, >+ ], >+ } >+ }; >+} >+ >+cy.get_package = () => { >+ return { >+ package_id: 1, >+ name: "package 1", >+ package_type: "complete", >+ content_type: "Print", >+ package_agreements: [ >+ { >+ agreement: { >+ agreement_id: 2, >+ description: "agreement description", >+ name: "agreement name", >+ }, >+ agreement_id: 2, >+ package_id: 1, >+ }, >+ ], >+ extended_attributes: [ >+ { >+ field_id: 1, >+ id: "1", >+ record_id: "1", >+ value: "REF", >+ }, >+ { >+ field_id: 1, >+ id: "2", >+ record_id: "1", >+ value: "NFIC", >+ }, >+ { >+ field_id: 2, >+ id: "3", >+ record_id: "1", >+ value: "some text", >+ }, >+ { >+ field_id: 3, >+ id: "4", >+ record_id: "1", >+ value: "some repeatable text", >+ }, >+ { >+ field_id: 4, >+ id: "5", >+ record_id: "1", >+ value: "AF", >+ }, >+ ], >+ _strings: { >+ additional_field_values: [ >+ { >+ field_id: 1, >+ field_label: "AV Repeatable", >+ type: "av", >+ value_str: "Reference, Non-fiction", >+ }, >+ { >+ field_id: 2, >+ field_label: "Text non-repeatable", >+ type: "text", >+ value_str: "some text", >+ }, >+ { >+ field_id: 3, >+ field_label: "Text repeatable", >+ type: "text", >+ value_str: "some repeatable text", >+ }, >+ { >+ field_id: 4, >+ field_label: "AV Searchable", >+ type: "av", >+ value_str: "Afghanistan", >+ }, >+ ], >+ }, >+ resources_count: 0, > }; > } > >-- >2.43.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 37576
:
171181
|
171268
|
171379
|
171397
|
173774
|
173775
|
173776
|
174530
| 174531 |
174532