Lines 64-72
describe("Record sources CRUD tests", () => {
Link Here
|
64 |
cy.intercept("GET", "/api/v1/record_sources*", { |
64 |
cy.intercept("GET", "/api/v1/record_sources*", { |
65 |
statusCode: 200, |
65 |
statusCode: 200, |
66 |
body: [ |
66 |
body: [ |
67 |
{ record_source_id: 1, name: "Source 1", can_be_edited: true }, |
67 |
{ |
68 |
{ record_source_id: 2, name: "Source 2", can_be_edited: false }, |
68 |
record_source_id: 1, |
69 |
{ record_source_id: 3, name: "Source 3", can_be_edited: true }, |
69 |
name: "Source 1", |
|
|
70 |
can_be_edited: true, |
71 |
usage_count: 0, |
72 |
}, |
73 |
{ |
74 |
record_source_id: 2, |
75 |
name: "Source 2", |
76 |
can_be_edited: false, |
77 |
usage_count: 1, |
78 |
}, |
79 |
{ |
80 |
record_source_id: 3, |
81 |
name: "Source 3", |
82 |
can_be_edited: true, |
83 |
usage_count: 0, |
84 |
}, |
70 |
], |
85 |
], |
71 |
headers: { |
86 |
headers: { |
72 |
"X-Base-Total-Count": "3", |
87 |
"X-Base-Total-Count": "3", |
Lines 76-100
describe("Record sources CRUD tests", () => {
Link Here
|
76 |
cy.visit("/cgi-bin/koha/admin/record_sources"); |
91 |
cy.visit("/cgi-bin/koha/admin/record_sources"); |
77 |
cy.get("#record_sources_list").contains("Showing 1 to 3 of 3 entries"); |
92 |
cy.get("#record_sources_list").contains("Showing 1 to 3 of 3 entries"); |
78 |
|
93 |
|
79 |
// Test true => "Yes" |
94 |
cy.get(".dataTable > tbody > tr:first-child").within(() => { |
80 |
let row_1 = cy.get(".dataTable > tbody > tr:first-child"); |
95 |
// Test true => "Yes" |
81 |
row_1.get("td:nth-child(3n+3)").contains("Yes"); |
96 |
cy.get("td:nth-child(3n+3)").contains("Yes"); |
82 |
// Test false => "No" |
97 |
// last column |
83 |
let row_2 = cy.get(".dataTable > tbody > tr:nth-child(2n+2)"); |
98 |
cy.get("td:last-child").within(() => { |
84 |
row_2.get("td:nth-child(3n+3)").contains("No"); |
99 |
cy.contains("Edit"); |
|
|
100 |
// usage_count = 0 then the delete button is displayed |
101 |
cy.contains("Delete"); |
102 |
}); |
103 |
}); |
85 |
|
104 |
|
86 |
// Action buttons displayed |
105 |
cy.get(".dataTable > tbody > tr:nth-child(2)").within(() => { |
87 |
row_1.get("td:last-child").contains("Edit"); |
106 |
// Test false => "No" |
88 |
row_1.get("td:last-child").contains("Delete"); |
107 |
cy.get("td:nth-child(3n+3)").contains("No"); |
|
|
108 |
// last column |
109 |
cy.get("td:last-child").within(() => { |
110 |
cy.contains("Edit"); |
111 |
// usage_count > 0 then no delete button |
112 |
cy.should("not.contain", "Delete"); |
113 |
}); |
114 |
}); |
89 |
}); |
115 |
}); |
90 |
|
116 |
|
91 |
it("Edit", () => { |
117 |
it("Edit", () => { |
92 |
cy.intercept("GET", "/api/v1/record_sources*", { |
118 |
cy.intercept("GET", "/api/v1/record_sources*", { |
93 |
statusCode: 200, |
119 |
statusCode: 200, |
94 |
body: [ |
120 |
body: [ |
95 |
{ record_source_id: 1, name: "Source 1", can_be_edited: true }, |
121 |
{ |
96 |
{ record_source_id: 2, name: "Source 2", can_be_edited: false }, |
122 |
record_source_id: 1, |
97 |
{ record_source_id: 3, name: "Source 3", can_be_edited: true }, |
123 |
name: "Source 1", |
|
|
124 |
can_be_edited: true, |
125 |
usage_count: 0, |
126 |
}, |
127 |
{ |
128 |
record_source_id: 2, |
129 |
name: "Source 2", |
130 |
can_be_edited: false, |
131 |
usage_count: 1, |
132 |
}, |
133 |
{ |
134 |
record_source_id: 3, |
135 |
name: "Source 3", |
136 |
can_be_edited: true, |
137 |
usage_count: 0, |
138 |
}, |
98 |
], |
139 |
], |
99 |
headers: { |
140 |
headers: { |
100 |
"X-Base-Total-Count": "3", |
141 |
"X-Base-Total-Count": "3", |
Lines 144-152
describe("Record sources CRUD tests", () => {
Link Here
|
144 |
cy.intercept("GET", "/api/v1/record_sources*", { |
185 |
cy.intercept("GET", "/api/v1/record_sources*", { |
145 |
statusCode: 200, |
186 |
statusCode: 200, |
146 |
body: [ |
187 |
body: [ |
147 |
{ record_source_id: 1, name: "Source 1", can_be_edited: true }, |
188 |
{ |
148 |
{ record_source_id: 2, name: "Source 2", can_be_edited: false }, |
189 |
record_source_id: 1, |
149 |
{ record_source_id: 3, name: "Source 3", can_be_edited: true }, |
190 |
name: "Source 1", |
|
|
191 |
can_be_edited: true, |
192 |
usage_count: 0, |
193 |
}, |
194 |
{ |
195 |
record_source_id: 2, |
196 |
name: "Source 2", |
197 |
can_be_edited: false, |
198 |
usage_count: 0, |
199 |
}, |
200 |
{ |
201 |
record_source_id: 3, |
202 |
name: "Source 3", |
203 |
can_be_edited: true, |
204 |
usage_count: 1, |
205 |
}, |
150 |
], |
206 |
], |
151 |
headers: { |
207 |
headers: { |
152 |
"X-Base-Total-Count": "3", |
208 |
"X-Base-Total-Count": "3", |
153 |
- |
|
|