Bugzilla – Attachment 173290 Details for
Bug 35287
Add additional fields support to ERM licenses
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35287: Fix tests
Bug-35287-Fix-tests.patch (text/plain), 10.28 KB, created by
Pedro Amorim
on 2024-10-24 16:00:55 UTC
(
hide
)
Description:
Bug 35287: Fix tests
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2024-10-24 16:00:55 UTC
Size:
10.28 KB
patch
obsolete
>From eee5f986853f20601821affa1a902c62d2d33d1a Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@ptfs-europe.com> >Date: Thu, 24 Oct 2024 16:00:20 +0000 >Subject: [PATCH] Bug 35287: Fix tests > >Have a single point go get_license to be used by both Licenses_spec.ts and AdditionalFields_spec.ts > >Test plan, apply patch: >$ yarn js:build >$ cypress run --spec t/cypress/integration/AdditionalFields_spec.ts >$ cypress run --spec t/cypress/integration/Licenses_spec.ts >--- > .../integration/AdditionalFields_spec.ts | 91 +------------------ > t/cypress/integration/ERM/Licenses_spec.ts | 35 +------ > t/cypress/support/e2e.js | 86 ++++++++++++++++++ > 3 files changed, 94 insertions(+), 118 deletions(-) > >diff --git a/t/cypress/integration/AdditionalFields_spec.ts b/t/cypress/integration/AdditionalFields_spec.ts >index 9a7885aa5d..a334df4688 100644 >--- a/t/cypress/integration/AdditionalFields_spec.ts >+++ b/t/cypress/integration/AdditionalFields_spec.ts >@@ -37,91 +37,6 @@ function get_no_additional_fields_license() { > }, > }; > } >-function get_license() { >- return { >- license_id: 1, >- name: "license 1", >- description: "my first license", >- type: "local", >- status: "active", >- started_on: dates["today_iso"], >- ended_on: dates["tomorrow_iso"], >- user_roles: [], >- vendor_id: 1, >- vendor: [cy.get_vendors_to_relate()[0]], >- documents: [ >- { >- license_id: 1, >- file_description: "file description", >- file_name: "file.json", >- notes: "file notes", >- physical_location: "file physical location", >- uri: "file uri", >- 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", >- }, >- ], >- }, >- }; >-} > > function get_licenses_additional_fields() { > return [ >@@ -253,7 +168,7 @@ describe("Additional Fields operations", () => { > }); > > it("Additional Fields display - Table (licenses)", () => { >- let license = get_license(); >+ let license = cy.get_license(); > let licenses = [license]; > let license_additional_fields = get_licenses_additional_fields(); > let av_cats = get_av_cats(); >@@ -296,7 +211,7 @@ describe("Additional Fields operations", () => { > > it("Additional Fields display - Show (licenses)", () => { > let empty_license = get_no_additional_fields_license(); >- let license = get_license(); >+ let license = cy.get_license(); > let licenses = [license]; > let vendors = cy.get_vendors_to_relate(); > let license_additional_fields = get_licenses_additional_fields(); >@@ -529,7 +444,7 @@ describe("Additional Fields operations", () => { > }); > > it("Additional Fields entry - Edit (licenses)", () => { >- let license = get_license(); >+ let license = cy.get_license(); > let licenses = [license]; > let vendors = cy.get_vendors_to_relate(); > let license_additional_fields = get_licenses_additional_fields(); >diff --git a/t/cypress/integration/ERM/Licenses_spec.ts b/t/cypress/integration/ERM/Licenses_spec.ts >index ae189b640e..f712b528cd 100644 >--- a/t/cypress/integration/ERM/Licenses_spec.ts >+++ b/t/cypress/integration/ERM/Licenses_spec.ts >@@ -8,31 +8,6 @@ const dates = { > tomorrow_iso: dayjs().add(1, "day").format("YYYY-MM-DD"), > tomorrow_us: dayjs().add(1, "day").format("MM/DD/YYYY"), > }; >-function get_license() { >- return { >- license_id: 1, >- name: "license 1", >- description: "my first license", >- type: "local", >- status: "active", >- started_on: dates["today_iso"], >- ended_on: dates["tomorrow_iso"], >- user_roles: [], >- vendor_id: 1, >- vendor: [cy.get_vendors_to_relate()[0]], >- documents: [ >- { >- license_id: 1, >- file_description: "file description", >- file_name: "file.json", >- notes: "file notes", >- physical_location: "file physical location", >- uri: "file uri", >- uploaded_on: "2022-10-27T11:57:02+00:00", >- }, >- ], >- }; >-} > > describe("License CRUD operations", () => { > beforeEach(() => { >@@ -62,7 +37,7 @@ describe("License CRUD operations", () => { > cy.get("#licenses_list").contains("There are no licenses defined"); > > // GET licenses returns something >- let license = get_license(); >+ let license = cy.get_license(); > let licenses = [license]; > > cy.intercept("GET", "/api/v1/erm/licenses*", { >@@ -79,7 +54,7 @@ describe("License CRUD operations", () => { > }); > > it("Add license", () => { >- let license = get_license(); >+ let license = cy.get_license(); > let vendors = cy.get_vendors_to_relate(); > //Intercept vendors request > cy.intercept("GET", "/api/v1/acquisitions/vendors*", { >@@ -174,7 +149,7 @@ describe("License CRUD operations", () => { > }); > > it("Edit license", () => { >- let license = get_license(); >+ let license = cy.get_license(); > let licenses = [license]; > let vendors = cy.get_vendors_to_relate(); > >@@ -256,7 +231,7 @@ describe("License CRUD operations", () => { > }); > > it("Show license", () => { >- let license = get_license(); >+ let license = cy.get_license(); > let licenses = [license]; > // Click the "name" link from the list > cy.intercept("GET", "/api/v1/erm/licenses*", { >@@ -286,7 +261,7 @@ describe("License CRUD operations", () => { > }); > > it("Delete license", () => { >- let license = get_license(); >+ let license = cy.get_license(); > let licenses = [license]; > > // Click the 'Delete' button from the list >diff --git a/t/cypress/support/e2e.js b/t/cypress/support/e2e.js >index c0d0d2d6f7..27d79e47c6 100644 >--- a/t/cypress/support/e2e.js >+++ b/t/cypress/support/e2e.js >@@ -53,6 +53,92 @@ const dates = { > tomorrow_us: dayjs().add(1, "day").format("MM/DD/YYYY"), > } > >+cy.get_license = () => { >+ return { >+ license_id: 1, >+ name: "license 1", >+ description: "my first license", >+ type: "local", >+ status: "active", >+ started_on: dates["today_iso"], >+ ended_on: dates["tomorrow_iso"], >+ user_roles: [], >+ vendor_id: 1, >+ vendor: [cy.get_vendors_to_relate()[0]], >+ documents: [ >+ { >+ license_id: 1, >+ file_description: "file description", >+ file_name: "file.json", >+ notes: "file notes", >+ physical_location: "file physical location", >+ uri: "file uri", >+ 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_agreement = () => { > let licenses = cy.get_licenses_to_relate(); > return { >-- >2.39.5
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 35287
:
158725
|
158726
|
158727
|
158728
|
158729
|
158730
|
158731
|
158732
|
158733
|
158734
|
159634
|
159635
|
159636
|
159637
|
159638
|
159639
|
159640
|
159641
|
159642
|
159643
|
165451
|
165637
|
165638
|
165639
|
165640
|
165641
|
165642
|
165643
|
165644
|
165645
|
165646
|
165647
|
167681
|
169728
|
169729
|
169730
|
169731
|
169732
|
169733
|
169734
|
169735
|
169736
|
169737
|
170448
|
170753
|
172850
|
172851
|
172852
|
172853
|
172854
|
172855
|
172856
|
172857
|
172858
|
172860
|
172861
|
173022
|
173102
|
173103
|
173104
|
173105
|
173106
|
173107
|
173108
|
173109
|
173110
|
173111
|
173112
|
173113
| 173290