Bugzilla – Attachment 150514 Details for
Bug 33625
Enforce formatting on vue .js and .ts files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33625: Pretty .js files for vue
Bug-33625-Pretty-js-files-for-vue.patch (text/plain), 66.85 KB, created by
Martin Renvoize (ashimema)
on 2023-05-02 11:07:34 UTC
(
hide
)
Description:
Bug 33625: Pretty .js files for vue
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2023-05-02 11:07:34 UTC
Size:
66.85 KB
patch
obsolete
>From 0cf6c21e073f618e8ed7578967d4a2335ddcc61a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 2 May 2023 10:32:37 +0200 >Subject: [PATCH] Bug 33625: Pretty .js files for vue > >Test plan: >= Koha = >Apply the first patch, prove xt/vue_tidy.t and notice the failure >Apply this patch, now it passes > >= QA test = >Apply the change to the merge request linked with this qa-test-tools' issue: >https://gitlab.com/koha-community/qa-test-tools/-/issues/62 >inside your ktd container (at /kohadevbox/qa-test-tools/) >Edit a .js within koha-tmpl/intranet-tmpl/prog/js/vue and a .ts file >(cypress test) with something not pretty >Commit and run the QA script >=> It's failing! >Pretty the change, commit again, run the QA script >=> It's happy! > >= KTD - git hook = >Go to the merge request linked with this ktd's issue: >https://gitlab.com/koha-community/koha-testing-docker/-/issues/374 >Copy the modified git hook to .git/hooks/ktd/pre-commit >Edit a .js within koha-tmpl/intranet-tmpl/prog/js/vue and a .ts file >(cypress test) with something not pretty >Commit >=> Notice that the commit content is pretty! > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > .../prog/js/vue/composables/datatables.js | 2 +- > .../js/vue/fetch/acquisition-api-client.js | 2 +- > .../prog/js/vue/fetch/authorised-values.js | 14 +- > .../prog/js/vue/fetch/erm-api-client.js | 54 ++-- > .../prog/js/vue/fetch/http-client.js | 58 ++-- > .../prog/js/vue/fetch/patron-api-client.js | 2 +- > .../fetch/system-preferences-api-client.js | 2 +- > .../intranet-tmpl/prog/js/vue/messages.js | 2 +- > .../prog/js/vue/stores/authorised-values.js | 4 +- > .../intranet-tmpl/prog/js/vue/stores/main.js | 50 ++-- > .../prog/js/vue/stores/vendors.js | 12 +- > t/cypress/integration/ERM/Agreements_spec.ts | 131 ++++++--- > t/cypress/integration/ERM/Dialog_spec.ts | 16 +- > t/cypress/integration/ERM/Licenses_spec.ts | 72 +++-- > t/cypress/integration/ERM/Packages_spec.ts | 35 ++- > t/cypress/integration/ERM/Searchbar_spec.ts | 33 ++- > t/cypress/integration/ERM/Titles_spec.ts | 265 ++++++++++++------ > 17 files changed, 469 insertions(+), 285 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/datatables.js >index b150021d43..af29353793 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/composables/datatables.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/composables/datatables.js >@@ -13,7 +13,7 @@ export function useDataTable(table_id) { > export function build_url_params(filters) { > return Object.entries(filters) > .map(([k, v]) => (v ? k + "=" + v : undefined)) >- .filter((e) => e !== undefined) >+ .filter(e => e !== undefined) > .join("&"); > } > export function build_url(base_url, filters) { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js >index edd2137355..4a4553506e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/acquisition-api-client.js >@@ -9,7 +9,7 @@ export class AcquisitionAPIClient extends HttpClient { > > get vendors() { > return { >- getAll: (query) => >+ getAll: query => > this.get({ > endpoint: "vendors?" + (query || "_per_page=-1"), > headers: { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values.js >index bd3887af53..e502ac7046 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/authorised-values.js >@@ -9,16 +9,18 @@ export class AVAPIClient extends HttpClient { > > get values() { > return { >- getCategoriesWithValues: (cat_array) => >+ getCategoriesWithValues: cat_array => > this.get({ >- endpoint: "?q={\"me.category_name\":["+(cat_array.join(", "))+"]}", >+ endpoint: >+ '?q={"me.category_name":[' + >+ cat_array.join(", ") + >+ "]}", > headers: { >- "x-koha-embed": >- "authorised_values", >+ "x-koha-embed": "authorised_values", > }, >- }), >+ }), > }; > } > } > >-export default AVAPIClient; >\ No newline at end of file >+export default AVAPIClient; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js >index a78810bb4e..cff7decbea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/erm-api-client.js >@@ -9,7 +9,7 @@ export class ERMAPIClient extends HttpClient { > > get agreements() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "agreements/" + id, > headers: { >@@ -17,15 +17,15 @@ export class ERMAPIClient extends HttpClient { > "periods,user_roles,user_roles.patron,agreement_licenses,agreement_licenses.license,agreement_relationships,agreement_relationships.related_agreement,documents,agreement_packages,agreement_packages.package,vendor", > }, > }), >- getAll: (query) => >+ getAll: query => > this.get({ > endpoint: "agreements?" + (query || "_per_page=-1"), > }), >- delete: (id) => >+ delete: id => > this.delete({ > endpoint: "agreements/" + id, > }), >- create: (agreement) => >+ create: agreement => > this.post({ > endpoint: "agreements", > body: agreement, >@@ -50,7 +50,7 @@ export class ERMAPIClient extends HttpClient { > > get licenses() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "licenses/" + id, > headers: { >@@ -58,18 +58,18 @@ export class ERMAPIClient extends HttpClient { > "user_roles,user_roles.patron,vendor,documents", > }, > }), >- getAll: (query) => >+ getAll: query => > this.get({ > endpoint: "licenses?" + (query || "_per_page=-1"), > headers: { > "x-koha-embed": "vendor", > }, > }), >- delete: (id) => >+ delete: id => > this.delete({ > endpoint: "licenses/" + id, > }), >- create: (license) => >+ create: license => > this.post({ > endpoint: "licenses", > body: license, >@@ -79,7 +79,7 @@ export class ERMAPIClient extends HttpClient { > endpoint: "licenses/" + id, > body: license, > }), >- count: (query = {}) => >+ count: (query = {}) => > this.count({ > endpoint: > "licenses?" + >@@ -94,7 +94,7 @@ export class ERMAPIClient extends HttpClient { > > get localPackages() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "eholdings/local/packages/" + id, > headers: { >@@ -102,7 +102,7 @@ export class ERMAPIClient extends HttpClient { > "package_agreements,package_agreements.agreement,resources+count,vendor", > }, > }), >- getAll: (query) => >+ getAll: query => > this.get({ > endpoint: > "eholdings/local/packages?" + (query || "_per_page=-1"), >@@ -110,11 +110,11 @@ export class ERMAPIClient extends HttpClient { > "x-koha-embed": "resources+count,vendor.name", > }, > }), >- delete: (id) => >+ delete: id => > this.delete({ > endpoint: "eholdings/local/packages/" + id, > }), >- create: (local_package) => >+ create: local_package => > this.post({ > endpoint: "eholdings/local/packages", > body: local_package, >@@ -139,22 +139,23 @@ export class ERMAPIClient extends HttpClient { > > get localTitles() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "eholdings/local/titles/" + id, > headers: { > "x-koha-embed": "resources,resources.package", > }, > }), >- getAll: (query) => >+ getAll: query => > this.get({ >- endpoint: "eholdings/local/titles?" + (query || "_per_page=-1"), >+ endpoint: >+ "eholdings/local/titles?" + (query || "_per_page=-1"), > }), >- delete: (id) => >+ delete: id => > this.delete({ > endpoint: "eholdings/local/titles/" + id, > }), >- create: (local_package) => >+ create: local_package => > this.post({ > endpoint: "eholdings/local/titles", > body: local_package, >@@ -174,7 +175,7 @@ export class ERMAPIClient extends HttpClient { > ...(query && { q: JSON.stringify(query) }), > }), > }), >- import: (body) => >+ import: body => > this.post({ > endpoint: "eholdings/local/titles/import", > body, >@@ -184,7 +185,7 @@ export class ERMAPIClient extends HttpClient { > > get localResources() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "eholdings/local/resources/" + id, > headers: { >@@ -196,7 +197,7 @@ export class ERMAPIClient extends HttpClient { > > get EBSCOPackages() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "eholdings/ebsco/packages/" + id, > headers: { >@@ -204,7 +205,7 @@ export class ERMAPIClient extends HttpClient { > "package_agreements,package_agreements.agreement,resources+count,vendor", > }, > }), >- getAll: (query) => >+ getAll: query => > this.get({ > endpoint: > "eholdings/ebsco/packages/" + >@@ -224,24 +225,25 @@ export class ERMAPIClient extends HttpClient { > > get EBSCOTitles() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "eholdings/ebsco/titles/" + id, > headers: { > "x-koha-embed": "resources,resources.package", > }, > }), >- getAll: (query) => >+ getAll: query => > this.get({ > endpoint: >- "eholdings/local/ebsco/titles" + (query || "_per_page=-1"), >+ "eholdings/local/ebsco/titles" + >+ (query || "_per_page=-1"), > }), > }; > } > > get EBSCOResources() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "eholdings/ebsco/resources/" + id, > headers: { >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js >index ac999e9f9a..8ac76f04da 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/http-client.js >@@ -13,30 +13,31 @@ class HttpClient { > headers = {}, > options = {}, > return_response = false, >- mark_submitting = false, >+ mark_submitting = false > ) { > let res, error; >- if ( mark_submitting) submitting() >+ if (mark_submitting) submitting(); > await fetch(this._baseURL + endpoint, { > ...options, > headers: { ...this._headers, ...headers }, > }) >- .then((response) => this.checkError(response, return_response)) >+ .then(response => this.checkError(response, return_response)) > .then( >- (result) => { >+ result => { > res = result; > }, >- (err) => { >+ err => { > error = err; > setError(err.toString()); > } > ) >- .catch((err) => { >+ .catch(err => { > error = err; > setError(err); >- }).then(() => { >- if (mark_submitting) submitted()}) >- ; >+ }) >+ .then(() => { >+ if (mark_submitting) submitted(); >+ }); > > if (error) throw Error(error); > >@@ -56,11 +57,17 @@ class HttpClient { > ? params.body > : JSON.stringify(params.body) > : undefined; >- return this._fetchJSON(params.endpoint, params.headers, { >- ...params.options, >- body, >- method: "POST", >- }, false, true); >+ return this._fetchJSON( >+ params.endpoint, >+ params.headers, >+ { >+ ...params.options, >+ body, >+ method: "POST", >+ }, >+ false, >+ true >+ ); > } > > put(params = {}) { >@@ -69,11 +76,17 @@ class HttpClient { > ? params.body > : JSON.stringify(params.body) > : undefined; >- return this._fetchJSON(params.endpoint, params.headers, { >- ...params.options, >- body, >- method: "PUT", >- }, false, true); >+ return this._fetchJSON( >+ params.endpoint, >+ params.headers, >+ { >+ ...params.options, >+ body, >+ method: "PUT", >+ }, >+ false, >+ true >+ ); > } > > delete(params = {}) { >@@ -85,19 +98,20 @@ class HttpClient { > ...params.options, > method: "DELETE", > }, >- true, true >+ true, >+ true > ); > } > > count(params = {}) { > let res; > return this._fetchJSON(params.endpoint, params.headers, {}, 1).then( >- (response) => { >+ response => { > if (response) { > return response.headers.get("X-Total-Count"); > } > }, >- (error) => { >+ error => { > setError(error.toString()); > } > ); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/patron-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/patron-api-client.js >index 2e57e1ea49..4c39e977fd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/patron-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/patron-api-client.js >@@ -9,7 +9,7 @@ export class PatronAPIClient extends HttpClient { > > get patrons() { > return { >- get: (id) => >+ get: id => > this.get({ > endpoint: "patrons/" + id, > }), >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >index 9e08afe8cf..9cfcabf08f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/fetch/system-preferences-api-client.js >@@ -9,7 +9,7 @@ export class SysprefAPIClient extends HttpClient { > > get sysprefs() { > return { >- get: (variable) => >+ get: variable => > this.get({ > endpoint: "/?pref=" + variable, > }), >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js b/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js >index 7c94ff0103..af30480605 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/messages.js >@@ -41,4 +41,4 @@ export const loaded = function () { > const mainStore = useMainStore(); > const { loaded } = mainStore; > loaded(); >-}; >\ No newline at end of file >+}; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/authorised-values.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/authorised-values.js >index fc4573344e..1792958f42 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/authorised-values.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/authorised-values.js >@@ -47,11 +47,11 @@ export const useAVStore = defineStore("authorised_values", { > ); > return; > } >- let o = this[arr_name].find((e) => e.value == av); >+ let o = this[arr_name].find(e => e.value == av); > return o ? o.description : av; > }, > map_av_dt_filter(arr_name) { >- return this[arr_name].map((e) => { >+ return this[arr_name].map(e => { > e["_id"] = e["value"]; > e["_str"] = e["description"]; > return e; >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >index 6a3f290032..c212a5301c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/main.js >@@ -19,31 +19,35 @@ export const useMainStore = defineStore("main", { > this._warning = null; > this._message = message; > this._confirmation = null; >- this.displayed_already = displayed; /* Will be displayed on the next view */ >+ this.displayed_already = >+ displayed; /* Will be displayed on the next view */ > }, > setError(error, displayed = true) { > this._error = error; > this._warning = null; > this._message = null; > this._confirmation = null; >- this.displayed_already = displayed; /* Is displayed on the current view */ >+ this.displayed_already = >+ displayed; /* Is displayed on the current view */ > }, > setWarning(warning, displayed = true) { > this._error = null; > this._warning = warning; > this._message = null; > this._confirmation = null; >- this.displayed_already = displayed; /* Is displayed on the current view */ >+ this.displayed_already = >+ displayed; /* Is displayed on the current view */ > }, >- setConfirmationDialog(confirmation, accept_callback, displayed = true){ >- if(accept_callback) { >+ setConfirmationDialog(confirmation, accept_callback, displayed = true) { >+ if (accept_callback) { > this._accept_callback = async () => { >- await accept_callback() >- this.removeConfirmationMessages() >- } >+ await accept_callback(); >+ this.removeConfirmationMessages(); >+ }; > } > this._confirmation = confirmation; >- this.displayed_already = displayed; /* Is displayed on the current view */ >+ this.displayed_already = >+ displayed; /* Is displayed on the current view */ > }, > removeMessages() { > if (this.displayed_already) { >@@ -55,44 +59,44 @@ export const useMainStore = defineStore("main", { > } > this.displayed_already = true; > }, >- removeConfirmationMessages(){ >+ removeConfirmationMessages() { > this._confirmation = null; > this._accept_callback = null; > }, >- submitting(){ >+ submitting() { > this._is_submitting = true; > }, >- submitted(){ >+ submitted() { > this._is_submitting = false; > }, >- loading(){ >+ loading() { > this._is_loading = true; > }, >- loaded(){ >+ loaded() { > this._is_loading = false; > }, > }, > getters: { > error() { >- return this._error >+ return this._error; > }, > warning() { >- return this._warning >+ return this._warning; > }, > message() { >- return this._message >+ return this._message; > }, > confirmation() { >- return this._confirmation >+ return this._confirmation; > }, > accept_callback() { >- return this._accept_callback >+ return this._accept_callback; > }, >- is_submitting(){ >- return this._is_submitting >+ is_submitting() { >+ return this._is_submitting; > }, >- is_loading(){ >- return this._is_loading >+ is_loading() { >+ return this._is_loading; > }, > }, > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/vendors.js b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/vendors.js >index f860786bc8..3f8fdfdfc2 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/vue/stores/vendors.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/vue/stores/vendors.js >@@ -1,7 +1,7 @@ >-import { defineStore } from 'pinia' >+import { defineStore } from "pinia"; > >-export const useVendorStore = defineStore('vendors', { >- state: () => ({ >- vendors: [], >- }), >-}) >\ No newline at end of file >+export const useVendorStore = defineStore("vendors", { >+ state: () => ({ >+ vendors: [], >+ }), >+}); >diff --git a/t/cypress/integration/ERM/Agreements_spec.ts b/t/cypress/integration/ERM/Agreements_spec.ts >index 52f3a370ce..e8a2eacff9 100644 >--- a/t/cypress/integration/ERM/Agreements_spec.ts >+++ b/t/cypress/integration/ERM/Agreements_spec.ts >@@ -43,13 +43,13 @@ function get_agreement() { > license_id: 1, > name: "license name", > status: "expired", >- type: "alliance" >+ type: "alliance", > }, >- license_id:1, >+ license_id: 1, > notes: "license notes", > physical_location: "cupboard", > status: "controlling", >- uri: "license uri" >+ uri: "license uri", > }, > { > agreement_id: 1, >@@ -59,39 +59,39 @@ function get_agreement() { > license_id: 2, > name: "second license name", > status: "expired", >- type: "alliance" >+ type: "alliance", > }, >- license_id:2, >+ license_id: 2, > notes: "second license notes", > physical_location: "cupboard", > status: "future", >- uri: "license uri" >- } >+ uri: "license uri", >+ }, > ], > agreement_relationships: [ > { > agreement_id: 1, >- notes: 'related agreement notes', >+ notes: "related agreement notes", > related_agreement: { > agreement_id: 2, > description: "agreement description", >- name: "agreement name" >+ name: "agreement name", > }, > related_agreement_id: 2, >- relationship: "supersedes" >- } >+ relationship: "supersedes", >+ }, > ], > agreement_packages: [], > documents: [ > { >- agreement_id:1, >+ agreement_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" >- } >+ uploaded_on: "2022-10-27T11:57:02+00:00", >+ }, > ], > }; > } >@@ -101,27 +101,35 @@ function get_licenses_to_relate() { > { > license_id: 1, > description: "a license", >- name: "first license name" >+ name: "first license name", > }, > { > license_id: 2, > description: "a second license", >- name: "second license name" >+ name: "second license name", > }, > { > license_id: 3, > description: "a third license", >- name: "third license name" >+ name: "third license name", > }, >- ] >+ ]; > } > > describe("Agreement CRUD operations", () => { > beforeEach(() => { > cy.login(); > cy.title().should("eq", "Koha staff interface"); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}'); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}'); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", >+ '{"value":"1"}' >+ ); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", >+ '{"value":"local"}' >+ ); > }); > > it("List agreements", () => { >@@ -265,12 +273,18 @@ describe("Agreement CRUD operations", () => { > // Add new document > cy.get("#documents").contains("Add new document").click(); > cy.get("#document_0 input[id=file_0]").click(); >- cy.get('#document_0 input[id=file_0]').selectFile('t/cypress/fixtures/file.json'); >+ cy.get("#document_0 input[id=file_0]").selectFile( >+ "t/cypress/fixtures/file.json" >+ ); > cy.get("#document_0 .file_information span").contains("file.json"); >- cy.get('#document_0 input[id=file_description_0]').type('file description'); >- cy.get('#document_0 input[id=physical_location_0]').type('file physical location'); >- cy.get('#document_0 input[id=uri_0]').type('file URI'); >- cy.get('#document_0 input[id=notes_0]').type('file notes'); >+ cy.get("#document_0 input[id=file_description_0]").type( >+ "file description" >+ ); >+ cy.get("#document_0 input[id=physical_location_0]").type( >+ "file physical location" >+ ); >+ cy.get("#document_0 input[id=uri_0]").type("file URI"); >+ cy.get("#document_0 input[id=notes_0]").type("file notes"); > > // Submit the form, get 500 > cy.intercept("POST", "/api/v1/erm/agreements", { >@@ -310,7 +324,9 @@ describe("Agreement CRUD operations", () => { > cy.get("#agreement_license_0 #license_id_0 .vs__search").type( > related_license.license.name > ); >- cy.get("#agreement_license_0 #license_id_0 .vs__dropdown-menu li").eq(0).click( { force: true } ); //click first license suggestion >+ cy.get("#agreement_license_0 #license_id_0 .vs__dropdown-menu li") >+ .eq(0) >+ .click({ force: true }); //click first license suggestion > cy.get("#agreement_license_0 #license_status_0 .vs__search").type( > related_license.status + "{enter}", > { force: true } >@@ -319,7 +335,9 @@ describe("Agreement CRUD operations", () => { > related_license.physical_location + "{enter}", > { force: true } > ); >- cy.get("#agreement_license_0 #license_notes_0").type(related_license.notes); >+ cy.get("#agreement_license_0 #license_notes_0").type( >+ related_license.notes >+ ); > cy.get("#agreement_license_0 #license_uri_0").type(related_license.uri); > > // Add new related agreement >@@ -329,17 +347,24 @@ describe("Agreement CRUD operations", () => { > body: cy.get_agreements_to_relate(), > }); > cy.visit("/cgi-bin/koha/erm/agreements/add"); >- cy.get("#agreement_relationships").contains("Add new related agreement").click(); >+ cy.get("#agreement_relationships") >+ .contains("Add new related agreement") >+ .click(); > cy.get("#related_agreement_0").contains("Related agreement 1"); > cy.get("#related_agreement_0 #related_agreement_id_0 .vs__search").type( > related_agreement.related_agreement.name > ); >- cy.get("#related_agreement_0 #related_agreement_id_0 .vs__dropdown-menu li").eq(0).click( { force: true } ); //click first agreement suggestion >- cy.get("#related_agreement_0 #related_agreement_notes_0").type(related_agreement.notes); >- cy.get("#related_agreement_0 #related_agreement_relationship_0 .vs__search").type( >- related_agreement.relationship + "{enter}", >- { force: true } >+ cy.get( >+ "#related_agreement_0 #related_agreement_id_0 .vs__dropdown-menu li" >+ ) >+ .eq(0) >+ .click({ force: true }); //click first agreement suggestion >+ cy.get("#related_agreement_0 #related_agreement_notes_0").type( >+ related_agreement.notes > ); >+ cy.get( >+ "#related_agreement_0 #related_agreement_relationship_0 .vs__search" >+ ).type(related_agreement.relationship + "{enter}", { force: true }); > }); > > it("Edit agreement", () => { >@@ -352,10 +377,10 @@ describe("Agreement CRUD operations", () => { > { > method: "GET", > url: "/api/v1/erm/agreements*", >- times: 1 >+ times: 1, > }, > { >- body: agreements >+ body: agreements, > } > ); > >@@ -414,13 +439,19 @@ describe("Agreement CRUD operations", () => { > cy.get("#notes_1").should("have.value", "this is a note"); > > //Test related content >- cy.get("#agreement_license_0 #license_id_0 .vs__selected").contains("first license name"); >- cy.get("#agreement_license_1 #license_id_1 .vs__selected").contains("second license name"); >- cy.get("#document_0 .file_information span").contains("file.json" ); >- cy.get("#related_agreement_0 #related_agreement_id_0 .vs__selected").contains("agreement name"); >+ cy.get("#agreement_license_0 #license_id_0 .vs__selected").contains( >+ "first license name" >+ ); >+ cy.get("#agreement_license_1 #license_id_1 .vs__selected").contains( >+ "second license name" >+ ); >+ cy.get("#document_0 .file_information span").contains("file.json"); >+ cy.get( >+ "#related_agreement_0 #related_agreement_id_0 .vs__selected" >+ ).contains("agreement name"); > > // Submit the form, get 500 >- cy.intercept("PUT", "/api/v1/erm/agreements/*", (req) => { >+ cy.intercept("PUT", "/api/v1/erm/agreements/*", req => { > req.reply({ > statusCode: 500, > error: "Something went wrong", >@@ -501,7 +532,9 @@ describe("Agreement CRUD operations", () => { > cy.get("#agreements_list table tbody tr:first") > .contains("Delete") > .click(); >- cy.get(".dialog.alert.confirmation h1").contains("remove this agreement"); >+ cy.get(".dialog.alert.confirmation h1").contains( >+ "remove this agreement" >+ ); > cy.contains(agreement.name); > > // Accept the confirmation dialog, get 500 >@@ -522,9 +555,13 @@ describe("Agreement CRUD operations", () => { > cy.get("#agreements_list table tbody tr:first") > .contains("Delete") > .click(); >- cy.get(".dialog.alert.confirmation h1").contains("remove this agreement"); >+ cy.get(".dialog.alert.confirmation h1").contains( >+ "remove this agreement" >+ ); > cy.contains("Yes, delete").click(); >- cy.get("main div[class='dialog message']").contains("Agreement").contains("deleted"); >+ cy.get("main div[class='dialog message']") >+ .contains("Agreement") >+ .contains("deleted"); > > // Delete from show > // Click the "name" link from the list >@@ -554,11 +591,13 @@ describe("Agreement CRUD operations", () => { > "Agreement #" + agreement.agreement_id > ); > >- cy.get('#agreements_show .action_links .fa-trash').click(); >- cy.get(".dialog.alert.confirmation h1").contains("remove this agreement"); >+ cy.get("#agreements_show .action_links .fa-trash").click(); >+ cy.get(".dialog.alert.confirmation h1").contains( >+ "remove this agreement" >+ ); > cy.contains("Yes, delete").click(); > > //Make sure we return to list after deleting from show >- cy.get("#agreements_list table tbody tr:first") >+ cy.get("#agreements_list table tbody tr:first"); > }); > }); >diff --git a/t/cypress/integration/ERM/Dialog_spec.ts b/t/cypress/integration/ERM/Dialog_spec.ts >index 79665cb7a9..3333218651 100644 >--- a/t/cypress/integration/ERM/Dialog_spec.ts >+++ b/t/cypress/integration/ERM/Dialog_spec.ts >@@ -25,8 +25,16 @@ describe("Dialog operations", () => { > beforeEach(() => { > cy.login(); > cy.title().should("eq", "Koha staff interface"); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}'); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}'); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", >+ '{"value":"1"}' >+ ); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", >+ '{"value":"local"}' >+ ); > }); > > it("There are no ... defined", () => { >@@ -58,7 +66,9 @@ describe("Dialog operations", () => { > cy.intercept("GET", "/api/v1/erm/agreements*", []); > cy.get("#navmenulist").contains("Agreements").click(); > // Info messages should be cleared when view is changed >- cy.get("main div[class='dialog message']").contains("There are no agreements defined"); >+ cy.get("main div[class='dialog message']").contains( >+ "There are no agreements defined" >+ ); > cy.get("main div[class='dialog message']").should("have.length", 1); > }); > >diff --git a/t/cypress/integration/ERM/Licenses_spec.ts b/t/cypress/integration/ERM/Licenses_spec.ts >index 5ba6dfd231..6d79f89633 100644 >--- a/t/cypress/integration/ERM/Licenses_spec.ts >+++ b/t/cypress/integration/ERM/Licenses_spec.ts >@@ -20,14 +20,14 @@ function get_license() { > user_roles: [], > documents: [ > { >- license_id:1, >+ 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" >- } >+ uploaded_on: "2022-10-27T11:57:02+00:00", >+ }, > ], > }; > } >@@ -36,8 +36,16 @@ describe("License CRUD operations", () => { > beforeEach(() => { > cy.login(); > cy.title().should("eq", "Koha staff interface"); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}'); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}'); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", >+ '{"value":"1"}' >+ ); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", >+ '{"value":"local"}' >+ ); > }); > > it("List license", () => { >@@ -91,8 +99,12 @@ describe("License CRUD operations", () => { > cy.get("#license_name").type(license.name); > cy.get("#license_description").type(license.description); > cy.get("#licenses_add").contains("Submit").click(); >- cy.get("#license_type .vs__search").type(license.type + '{enter}',{force:true}); >- cy.get("#license_status .vs__search").type(license.status + '{enter}',{force:true}); >+ cy.get("#license_type .vs__search").type(license.type + "{enter}", { >+ force: true, >+ }); >+ cy.get("#license_status .vs__search").type(license.status + "{enter}", { >+ force: true, >+ }); > > cy.get("#started_on+input").click(); > cy.get(".flatpickr-calendar") >@@ -110,12 +122,18 @@ describe("License CRUD operations", () => { > // Add new document > cy.get("#documents").contains("Add new document").click(); > cy.get("#document_0 input[id=file_0]").click(); >- cy.get('#document_0 input[id=file_0]').selectFile('t/cypress/fixtures/file.json'); >+ cy.get("#document_0 input[id=file_0]").selectFile( >+ "t/cypress/fixtures/file.json" >+ ); > cy.get("#document_0 .file_information span").contains("file.json"); >- cy.get('#document_0 input[id=file_description_0]').type('file description'); >- cy.get('#document_0 input[id=physical_location_0]').type('file physical location'); >- cy.get('#document_0 input[id=uri_0]').type('file URI'); >- cy.get('#document_0 input[id=notes_0]').type('file notes'); >+ cy.get("#document_0 input[id=file_description_0]").type( >+ "file description" >+ ); >+ cy.get("#document_0 input[id=physical_location_0]").type( >+ "file physical location" >+ ); >+ cy.get("#document_0 input[id=uri_0]").type("file URI"); >+ cy.get("#document_0 input[id=notes_0]").type("file notes"); > > // Submit the form, get 500 > cy.intercept("POST", "/api/v1/erm/licenses", { >@@ -133,9 +151,7 @@ describe("License CRUD operations", () => { > body: license, > }); > cy.get("#licenses_add").contains("Submit").click(); >- cy.get("main div[class='dialog message']").contains( >- "License created" >- ); >+ cy.get("main div[class='dialog message']").contains("License created"); > }); > > it("Edit license", () => { >@@ -154,9 +170,7 @@ describe("License CRUD operations", () => { > "get-license" > ); > cy.visit("/cgi-bin/koha/erm/licenses"); >- cy.get("#licenses_list table tbody tr:first") >- .contains("Edit") >- .click(); >+ cy.get("#licenses_list table tbody tr:first").contains("Edit").click(); > cy.wait("@get-license"); > cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! > cy.get("#licenses_add h2").contains("Edit license"); >@@ -173,7 +187,7 @@ describe("License CRUD operations", () => { > cy.get("#ended_on").invoke("val").should("eq", dates["tomorrow_iso"]); > > // Test related document >- cy.get("#document_0 .file_information span").contains("file.json" ); >+ cy.get("#document_0 .file_information span").contains("file.json"); > > // Submit the form, get 500 > cy.intercept("PUT", "/api/v1/erm/licenses/*", { >@@ -191,9 +205,7 @@ describe("License CRUD operations", () => { > body: license, > }); > cy.get("#licenses_add").contains("Submit").click(); >- cy.get("main div[class='dialog message']").contains( >- "License updated" >- ); >+ cy.get("main div[class='dialog message']").contains("License updated"); > }); > > it("Show license", () => { >@@ -222,9 +234,7 @@ describe("License CRUD operations", () => { > name_link.click(); > cy.wait("@get-license"); > cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! >- cy.get("#licenses_show h2").contains( >- "License #" + license.license_id >- ); >+ cy.get("#licenses_show h2").contains("License #" + license.license_id); > }); > > it("Delete license", () => { >@@ -269,7 +279,9 @@ describe("License CRUD operations", () => { > .click(); > cy.get(".dialog.alert.confirmation h1").contains("remove this license"); > cy.contains("Yes, delete").click(); >- cy.get("main div[class='dialog message']").contains("License").contains("deleted"); >+ cy.get("main div[class='dialog message']") >+ .contains("License") >+ .contains("deleted"); > > // Delete from show > // Click the "name" link from the list >@@ -295,15 +307,13 @@ describe("License CRUD operations", () => { > name_link.click(); > cy.wait("@get-license"); > cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! >- cy.get("#licenses_show h2").contains( >- "License #" + license.license_id >- ); >+ cy.get("#licenses_show h2").contains("License #" + license.license_id); > >- cy.get('#licenses_show .action_links .fa-trash').click(); >+ cy.get("#licenses_show .action_links .fa-trash").click(); > cy.get(".dialog.alert.confirmation h1").contains("remove this license"); > cy.contains("Yes, delete").click(); > > //Make sure we return to list after deleting from show >- cy.get("#licenses_list table tbody tr:first") >+ cy.get("#licenses_list table tbody tr:first"); > }); > }); >diff --git a/t/cypress/integration/ERM/Packages_spec.ts b/t/cypress/integration/ERM/Packages_spec.ts >index 58ea00323c..172e9ecf6b 100644 >--- a/t/cypress/integration/ERM/Packages_spec.ts >+++ b/t/cypress/integration/ERM/Packages_spec.ts >@@ -13,11 +13,11 @@ function get_package() { > agreement: { > agreement_id: 2, > description: "agreement description", >- name: "agreement name" >+ name: "agreement name", > }, > agreement_id: 2, >- package_id: 1 >- } >+ package_id: 1, >+ }, > ], > resources_count: 0, > }; >@@ -27,8 +27,16 @@ describe("Package CRUD operations", () => { > beforeEach(() => { > cy.login(); > cy.title().should("eq", "Koha staff interface"); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}'); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}'); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", >+ '{"value":"1"}' >+ ); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", >+ '{"value":"local"}' >+ ); > }); > > it("List package", () => { >@@ -77,7 +85,6 @@ describe("Package CRUD operations", () => { > }); > > it("Add package", () => { >- > cy.intercept("GET", "/api/v1/erm/agreements*", []); > > // Click the button in the toolbar >@@ -137,7 +144,9 @@ describe("Package CRUD operations", () => { > cy.get("#agreement_id_0 .vs__search").type( > related_agreement.agreement.name > ); >- cy.get("#agreement_id_0 .vs__dropdown-menu li").eq(0).click( { force: true } ); //click first agreement suggestion >+ cy.get("#agreement_id_0 .vs__dropdown-menu li") >+ .eq(0) >+ .click({ force: true }); //click first agreement suggestion > }); > > it("Edit package", () => { >@@ -174,7 +183,9 @@ describe("Package CRUD operations", () => { > cy.get("#package_content_type .vs__selected").contains("Print"); > > //Test related content >- cy.get("#package_agreement_0 #agreement_id_0 .vs__selected").contains("second agreement name"); >+ cy.get("#package_agreement_0 #agreement_id_0 .vs__selected").contains( >+ "second agreement name" >+ ); > > // Submit the form, get 500 > cy.intercept("PUT", "/api/v1/erm/eholdings/local/packages/*", { >@@ -311,7 +322,9 @@ describe("Package CRUD operations", () => { > .click(); > cy.get(".dialog.alert.confirmation h1").contains("remove this package"); > cy.contains("Yes, delete").click(); >- cy.get("main div[class='dialog message']").contains("Local package").contains("deleted"); >+ cy.get("main div[class='dialog message']") >+ .contains("Local package") >+ .contains("deleted"); > > // Delete from show > // Click the "name" link from the list >@@ -343,11 +356,11 @@ describe("Package CRUD operations", () => { > "Package #" + erm_package.package_id > ); > >- cy.get('#packages_show .action_links .fa-trash').click(); >+ cy.get("#packages_show .action_links .fa-trash").click(); > cy.get(".dialog.alert.confirmation h1").contains("remove this package"); > cy.contains("Yes, delete").click(); > > //Make sure we return to list after deleting from show >- cy.get("#packages_list table tbody tr:first") >+ cy.get("#packages_list table tbody tr:first"); > }); > }); >diff --git a/t/cypress/integration/ERM/Searchbar_spec.ts b/t/cypress/integration/ERM/Searchbar_spec.ts >index 21bcc181f6..65277c535c 100644 >--- a/t/cypress/integration/ERM/Searchbar_spec.ts >+++ b/t/cypress/integration/ERM/Searchbar_spec.ts >@@ -1,32 +1,39 @@ > describe("Searchbar header changes", () => { >- > beforeEach(() => { > cy.login(); > cy.title().should("eq", "Koha staff interface"); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}'); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}'); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", >+ '{"value":"1"}' >+ ); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", >+ '{"value":"local"}' >+ ); > }); > > it("Default option is agreements", () => { > cy.visit("/cgi-bin/koha/erm/erm.pl"); >- cy.get("#agreement_search_tab").parent().should("have.class", "active") >+ cy.get("#agreement_search_tab").parent().should("have.class", "active"); > > cy.visit("/cgi-bin/koha/erm/agreements"); >- cy.get("#agreement_search_tab").parent().should("have.class", "active") >- }) >+ cy.get("#agreement_search_tab").parent().should("have.class", "active"); >+ }); > > it("Default option also applies to licenses", () => { > cy.visit("/cgi-bin/koha/erm/license"); >- cy.get("#agreement_search_tab").parent().should("have.class", "active") >- }) >+ cy.get("#agreement_search_tab").parent().should("have.class", "active"); >+ }); > > it("Should change to packages when in local packages", () => { > cy.visit("/cgi-bin/koha/erm/eholdings/local/packages"); >- cy.get("#package_search_tab").parent().should("have.class", "active") >- }) >+ cy.get("#package_search_tab").parent().should("have.class", "active"); >+ }); > > it("Should change to titles when in local titles", () => { > cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); >- cy.get("#title_search_tab").parent().should("have.class", "active") >- }) >-}) >+ cy.get("#title_search_tab").parent().should("have.class", "active"); >+ }); >+}); >diff --git a/t/cypress/integration/ERM/Titles_spec.ts b/t/cypress/integration/ERM/Titles_spec.ts >index 56aa71dcf3..d08b350d31 100644 >--- a/t/cypress/integration/ERM/Titles_spec.ts >+++ b/t/cypress/integration/ERM/Titles_spec.ts >@@ -7,22 +7,30 @@ function get_packages_to_relate() { > { > package_id: 1, > description: "a package", >- name: "first package name" >+ name: "first package name", > }, > { > package_id: 2, > description: "a second package", >- name: "second package name" >- } >- ] >+ name: "second package name", >+ }, >+ ]; > } > > describe("Title CRUD operations", () => { > beforeEach(() => { > cy.login(); > cy.title().should("eq", "Koha staff interface"); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", '{"value":"1"}'); >- cy.intercept("GET", "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", '{"value":"local"}'); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMModule", >+ '{"value":"1"}' >+ ); >+ cy.intercept( >+ "GET", >+ "/cgi-bin/koha/svc/config/systempreferences/?pref=ERMProviders", >+ '{"value":"local"}' >+ ); > }); > > it("Import titles", () => { >@@ -32,19 +40,19 @@ describe("Title CRUD operations", () => { > // Create a list in case none exists > cy.visit("/cgi-bin/koha/virtualshelves/shelves.pl"); > cy.contains("New list").click(); >- cy.get("#shelfname").type('list name'); >+ cy.get("#shelfname").type("list name"); > cy.contains("Save").click(); > > // First attempt to import list has no packages > cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { > statusCode: 200, >- body: [] >+ body: [], > }).as("get-empty-packages"); > cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); > cy.wait(500); > cy.get("#toolbar a").contains("Import from list").click(); > cy.get("h2").contains("Import from a list"); >- cy.get("#package_list .vs__selected").should('not.exist'); >+ cy.get("#package_list .vs__selected").should("not.exist"); > > // Make sure packages are returned > cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { >@@ -59,10 +67,12 @@ describe("Title CRUD operations", () => { > // Prepare background job response to the POST > cy.intercept("POST", "/api/v1/erm/eholdings/local/titles/import", { > statusCode: 200, >- body: {job_id: 1}, >+ body: { job_id: 1 }, > }).as("get-job-response"); > cy.get("#list_list tbody tr:first td a").contains("Import").click(); >- cy.get("main div[class='dialog message']").contains("Import in progress, see job #1"); >+ cy.get("main div[class='dialog message']").contains( >+ "Import in progress, see job #1" >+ ); > }); > > it("List title", () => { >@@ -106,15 +116,16 @@ describe("Title CRUD operations", () => { > }); > > it("Add title", () => { >- >- cy.intercept({ >- method: "GET", >- url: "/api/v1/erm/eholdings/local/packages*", >- times: 1 >- }, >- { >- body: [], >- }); >+ cy.intercept( >+ { >+ method: "GET", >+ url: "/api/v1/erm/eholdings/local/packages*", >+ times: 1, >+ }, >+ { >+ body: [], >+ } >+ ); > > // Click the button in the toolbar > cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); >@@ -133,12 +144,24 @@ describe("Title CRUD operations", () => { > cy.get("#title_publication_title").type(erm_title.publication_title); > cy.get("#title_print_identifier").type(erm_title.print_identifier); > cy.get("#title_online_identifier").type(erm_title.online_identifier); >- cy.get("#title_date_first_issue_online").type(erm_title.date_first_issue_online); >- cy.get("#title_num_first_vol_online").type(erm_title.num_first_vol_online); >- cy.get("#title_num_first_issue_online").type(erm_title.num_first_issue_online); >- cy.get("#title_date_last_issue_online").type(erm_title.date_last_issue_online); >- cy.get("#title_num_last_vol_online").type(erm_title.num_last_vol_online); >- cy.get("#title_num_last_issue_online").type(erm_title.num_last_issue_online); >+ cy.get("#title_date_first_issue_online").type( >+ erm_title.date_first_issue_online >+ ); >+ cy.get("#title_num_first_vol_online").type( >+ erm_title.num_first_vol_online >+ ); >+ cy.get("#title_num_first_issue_online").type( >+ erm_title.num_first_issue_online >+ ); >+ cy.get("#title_date_last_issue_online").type( >+ erm_title.date_last_issue_online >+ ); >+ cy.get("#title_num_last_vol_online").type( >+ erm_title.num_last_vol_online >+ ); >+ cy.get("#title_num_last_issue_online").type( >+ erm_title.num_last_issue_online >+ ); > cy.get("#title_title_url").type(erm_title.title_url); > cy.get("#title_first_author").type(erm_title.first_author); > cy.get("#title_embargo_info").type(erm_title.embargo_info); >@@ -149,18 +172,24 @@ describe("Title CRUD operations", () => { > erm_title.publication_type + "{enter}", > { force: true } > ); >- cy.get("#title_date_monograph_published_print").type(erm_title.date_monograph_published_print); >- cy.get("#title_date_monograph_published_online").type(erm_title.date_monograph_published_online); >+ cy.get("#title_date_monograph_published_print").type( >+ erm_title.date_monograph_published_print >+ ); >+ cy.get("#title_date_monograph_published_online").type( >+ erm_title.date_monograph_published_online >+ ); > cy.get("#title_monograph_volume").type(erm_title.monograph_volume); > cy.get("#title_monograph_edition").type(erm_title.monograph_edition); > cy.get("#title_first_editor").type(erm_title.first_editor); >- cy.get("#title_parent_publication_title_id").type(erm_title.parent_publication_title_id); >- cy.get("#title_preceeding_publication_title_id").type(erm_title.preceeding_publication_title_id); >+ cy.get("#title_parent_publication_title_id").type( >+ erm_title.parent_publication_title_id >+ ); >+ cy.get("#title_preceeding_publication_title_id").type( >+ erm_title.preceeding_publication_title_id >+ ); > cy.get("#title_access_type").type(erm_title.access_type); > >- cy.get("#resources").contains( >- "There are no packages created yet" >- ); >+ cy.get("#resources").contains("There are no packages created yet"); > > // Submit the form, get 500 > cy.intercept("POST", "/api/v1/erm/eholdings/local/titles", { >@@ -185,14 +214,16 @@ describe("Title CRUD operations", () => { > cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { > statusCode: 200, > body: get_packages_to_relate(), >- }).as('get-related-packages'); >+ }).as("get-related-packages"); > cy.visit("/cgi-bin/koha/erm/eholdings/local/titles/add"); > cy.get("#resources").contains("Add to another package").click(); > cy.get("#resources").contains("Package 1"); > cy.get("#resources #resource_package_id_0 .vs__search").type( > related_package.package.name > ); >- cy.get("#resources #resource_package_id_0 .vs__dropdown-menu li").eq(0).click( { force: true } ); //click first package suggestion >+ cy.get("#resources #resource_package_id_0 .vs__dropdown-menu li") >+ .eq(0) >+ .click({ force: true }); //click first package suggestion > }); > > it("Edit title", () => { >@@ -217,7 +248,7 @@ describe("Title CRUD operations", () => { > cy.intercept("GET", "/api/v1/erm/eholdings/local/packages*", { > statusCode: 200, > body: get_packages_to_relate(), >- }).as('get-related-packages'); >+ }).as("get-related-packages"); > > cy.get("#titles_list table tbody tr:first").contains("Edit").click(); > cy.wait("@get-title"); >@@ -225,33 +256,98 @@ describe("Title CRUD operations", () => { > cy.get("#titles_add h2").contains("Edit title"); > > // Form has been correctly filled in >- cy.get("#title_publication_title").should("have.value", erm_title.publication_title); >- cy.get("#title_print_identifier").should("have.value", erm_title.print_identifier); >- cy.get("#title_online_identifier").should("have.value", erm_title.online_identifier); >- cy.get("#title_date_first_issue_online").should("have.value", erm_title.date_first_issue_online); >- cy.get("#title_num_first_vol_online").should("have.value", erm_title.num_first_vol_online); >- cy.get("#title_num_first_issue_online").should("have.value", erm_title.num_first_issue_online); >- cy.get("#title_date_last_issue_online").should("have.value", erm_title.date_last_issue_online); >- cy.get("#title_num_last_vol_online").should("have.value", erm_title.num_last_vol_online); >- cy.get("#title_num_last_issue_online").should("have.value", erm_title.num_last_issue_online); >+ cy.get("#title_publication_title").should( >+ "have.value", >+ erm_title.publication_title >+ ); >+ cy.get("#title_print_identifier").should( >+ "have.value", >+ erm_title.print_identifier >+ ); >+ cy.get("#title_online_identifier").should( >+ "have.value", >+ erm_title.online_identifier >+ ); >+ cy.get("#title_date_first_issue_online").should( >+ "have.value", >+ erm_title.date_first_issue_online >+ ); >+ cy.get("#title_num_first_vol_online").should( >+ "have.value", >+ erm_title.num_first_vol_online >+ ); >+ cy.get("#title_num_first_issue_online").should( >+ "have.value", >+ erm_title.num_first_issue_online >+ ); >+ cy.get("#title_date_last_issue_online").should( >+ "have.value", >+ erm_title.date_last_issue_online >+ ); >+ cy.get("#title_num_last_vol_online").should( >+ "have.value", >+ erm_title.num_last_vol_online >+ ); >+ cy.get("#title_num_last_issue_online").should( >+ "have.value", >+ erm_title.num_last_issue_online >+ ); > cy.get("#title_title_url").should("have.value", erm_title.title_url); >- cy.get("#title_first_author").should("have.value", erm_title.first_author); >- cy.get("#title_embargo_info").should("have.value", erm_title.embargo_info); >- cy.get("#title_coverage_depth").should("have.value", erm_title.coverage_depth); >+ cy.get("#title_first_author").should( >+ "have.value", >+ erm_title.first_author >+ ); >+ cy.get("#title_embargo_info").should( >+ "have.value", >+ erm_title.embargo_info >+ ); >+ cy.get("#title_coverage_depth").should( >+ "have.value", >+ erm_title.coverage_depth >+ ); > cy.get("#title_notes").should("have.value", erm_title.notes); >- cy.get("#title_publisher_name").should("have.value", erm_title.publisher_name); >- cy.get("#title_publication_type .vs__selected").contains('Journal'); >- cy.get("#title_date_monograph_published_print").should("have.value", erm_title.date_monograph_published_print); >- cy.get("#title_date_monograph_published_online").should("have.value", erm_title.date_monograph_published_online); >- cy.get("#title_monograph_volume").should("have.value", erm_title.monograph_volume); >- cy.get("#title_monograph_edition").should("have.value", erm_title.monograph_edition); >- cy.get("#title_first_editor").should("have.value", erm_title.first_editor); >- cy.get("#title_parent_publication_title_id").should("have.value", erm_title.parent_publication_title_id); >- cy.get("#title_preceeding_publication_title_id").should("have.value", erm_title.preceeding_publication_title_id); >- cy.get("#title_access_type").should("have.value", erm_title.access_type); >+ cy.get("#title_publisher_name").should( >+ "have.value", >+ erm_title.publisher_name >+ ); >+ cy.get("#title_publication_type .vs__selected").contains("Journal"); >+ cy.get("#title_date_monograph_published_print").should( >+ "have.value", >+ erm_title.date_monograph_published_print >+ ); >+ cy.get("#title_date_monograph_published_online").should( >+ "have.value", >+ erm_title.date_monograph_published_online >+ ); >+ cy.get("#title_monograph_volume").should( >+ "have.value", >+ erm_title.monograph_volume >+ ); >+ cy.get("#title_monograph_edition").should( >+ "have.value", >+ erm_title.monograph_edition >+ ); >+ cy.get("#title_first_editor").should( >+ "have.value", >+ erm_title.first_editor >+ ); >+ cy.get("#title_parent_publication_title_id").should( >+ "have.value", >+ erm_title.parent_publication_title_id >+ ); >+ cy.get("#title_preceeding_publication_title_id").should( >+ "have.value", >+ erm_title.preceeding_publication_title_id >+ ); >+ cy.get("#title_access_type").should( >+ "have.value", >+ erm_title.access_type >+ ); > > //Test related content >- cy.get("#resources #resource_package_id_0 .vs__selected").contains("package name"); >+ cy.get("#resources #resource_package_id_0 .vs__selected").contains( >+ "package name" >+ ); > > // Submit the form, get 500 > cy.intercept("PUT", "/api/v1/erm/eholdings/local/titles/*", { >@@ -289,27 +385,23 @@ describe("Title CRUD operations", () => { > { > method: "GET", > url: "/api/v1/erm/eholdings/local/titles/*", >- times: 1 >+ times: 1, > }, > { > body: { > publication_title: "publication title", > resources: [], > title_id: 1, >- } >+ }, > } > ).as("get-title"); > cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); >- let title_link = cy.get( >- "#titles_list table tbody tr:first td:first a" >- ); >+ let title_link = cy.get("#titles_list table tbody tr:first td:first a"); > title_link.should( > "have.text", > erm_title.publication_title + " (#" + erm_title.title_id + ")" > ); >- cy.get( >- "#titles_list table tbody tr:first td:first a" >- ).click(); >+ cy.get("#titles_list table tbody tr:first td:first a").click(); > cy.wait("@get-title"); > cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! > cy.get("#eholdings_title_show h2").contains( >@@ -336,11 +428,12 @@ describe("Title CRUD operations", () => { > // cy.get("#package_list tbody tr:first td a").contains("first package name").click(); > cy.intercept( > "GET", >- "/api/v1/erm/eholdings/local/resources/"+related_package.resource_id, >+ "/api/v1/erm/eholdings/local/resources/" + >+ related_package.resource_id, > related_package > ).as("get-related-package"); > cy.get("table#package_list").contains("first package name").click(); >- cy.contains("Resource #"+related_package.resource_id); >+ cy.contains("Resource #" + related_package.resource_id); > cy.contains(related_package.package.name); > }); > >@@ -357,16 +450,10 @@ describe("Title CRUD operations", () => { > "X-Total-Count": "1", > }, > }); >- cy.intercept( >- "GET", >- "/api/v1/erm/eholdings/local/titles/*", >- erm_title >- ); >+ cy.intercept("GET", "/api/v1/erm/eholdings/local/titles/*", erm_title); > cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); > >- cy.get("#titles_list table tbody tr:first") >- .contains("Delete") >- .click(); >+ cy.get("#titles_list table tbody tr:first").contains("Delete").click(); > cy.get(".dialog.alert.confirmation h1").contains("remove this title"); > cy.contains(erm_title.publication_title); > >@@ -385,12 +472,12 @@ describe("Title CRUD operations", () => { > statusCode: 204, > body: null, > }); >- cy.get("#titles_list table tbody tr:first") >- .contains("Delete") >- .click(); >+ cy.get("#titles_list table tbody tr:first").contains("Delete").click(); > cy.get(".dialog.alert.confirmation h1").contains("remove this title"); > cy.contains("Yes, delete").click(); >- cy.get("main div[class='dialog message']").contains("Local title").contains("deleted"); >+ cy.get("main div[class='dialog message']") >+ .contains("Local title") >+ .contains("deleted"); > > // Delete from show > // Click the "name" link from the list >@@ -407,38 +494,34 @@ describe("Title CRUD operations", () => { > { > method: "GET", > url: "/api/v1/erm/eholdings/local/titles/*", >- times: 1 >+ times: 1, > }, > { > body: { > publication_title: "publication title", > resources: [], > title_id: 1, >- } >+ }, > } > ).as("get-title"); > cy.visit("/cgi-bin/koha/erm/eholdings/local/titles"); >- let title_link = cy.get( >- "#titles_list table tbody tr:first td:first a" >- ); >+ let title_link = cy.get("#titles_list table tbody tr:first td:first a"); > title_link.should( > "have.text", > erm_title.publication_title + " (#" + erm_title.title_id + ")" > ); >- cy.get( >- "#titles_list table tbody tr:first td:first a" >- ).click(); >+ cy.get("#titles_list table tbody tr:first td:first a").click(); > cy.wait("@get-title"); > cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! > cy.get("#eholdings_title_show h2").contains( > "Title #" + erm_title.title_id > ); > >- cy.get('#eholdings_title_show .action_links .fa-trash').click(); >+ cy.get("#eholdings_title_show .action_links .fa-trash").click(); > cy.get(".dialog.alert.confirmation h1").contains("remove this title"); > cy.contains("Yes, delete").click(); > > //Make sure we return to list after deleting from show >- cy.get("#titles_list table tbody tr:first") >+ cy.get("#titles_list table tbody tr:first"); > }); > }); >-- >2.40.1
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 33625
:
150508
|
150509
|
150513
| 150514 |
151331
|
151332