Lines 232-263
describe("Vendor CRUD operations", () => {
Link Here
|
232 |
.contains("Vendor") |
232 |
.contains("Vendor") |
233 |
.contains("deleted"); |
233 |
.contains("deleted"); |
234 |
}); |
234 |
}); |
|
|
235 |
}); |
235 |
|
236 |
|
236 |
it("receive should open in the same tab", () => { |
237 |
describe("Vendor module", () => { |
237 |
const vendor = cy.getVendor(); |
238 |
beforeEach(() => { |
238 |
vendor.baskets_count = 1; |
239 |
cy.login(); |
|
|
240 |
cy.title().should("eq", "Koha staff interface"); |
239 |
|
241 |
|
240 |
cy.intercept("GET", "/api/v1/acquisitions/vendors\?*", { |
242 |
cy.task("buildSampleObject", { |
241 |
statusCode: 200, |
243 |
object: "vendor", |
242 |
body: [vendor], |
244 |
values: { active: 1 }, |
243 |
headers: { |
245 |
}) |
244 |
"X-Base-Total-Count": "1", |
246 |
.then(generatedVendor => { |
245 |
"X-Total-Count": "1", |
247 |
delete generatedVendor.list_currency; |
246 |
}, |
248 |
delete generatedVendor.invoice_currency; |
247 |
}); |
249 |
return cy.task("insertObject", { |
248 |
cy.intercept( |
250 |
type: "vendor", |
249 |
"GET", |
251 |
object: generatedVendor, |
250 |
new RegExp("/api/v1/acquisitions/vendors/(?!config$).+"), |
252 |
}); |
251 |
vendor |
253 |
}) |
252 |
); |
254 |
.then(vendor => { |
|
|
255 |
cy.wrap(vendor).as("vendor"); |
256 |
return cy.task("buildSampleObject", { |
257 |
object: "basket", |
258 |
values: { vendor_id: vendor.id }, |
259 |
}); |
260 |
}) |
261 |
.then(generatedBasket => { |
262 |
return cy.task("insertObject", { |
263 |
type: "basket", |
264 |
object: generatedBasket, |
265 |
}); |
266 |
}) |
267 |
.then(basket => { |
268 |
cy.wrap(basket).as("basket"); |
269 |
}); |
270 |
}); |
271 |
|
272 |
afterEach(function () { |
273 |
cy.task("deleteSampleObjects", [ |
274 |
{ vendor: this.vendor, basket: this.basket }, |
275 |
]); |
276 |
}); |
277 |
|
278 |
it("receive should open in the same tab", function () { |
253 |
cy.visit("/cgi-bin/koha/acquisition/vendors"); |
279 |
cy.visit("/cgi-bin/koha/acquisition/vendors"); |
254 |
|
280 |
|
255 |
cy.get("#vendors_list table tbody tr:first") |
281 |
// table_id is currently 'DataTables_Table_0', and it should be fixed |
256 |
.contains("Receive shipments") |
282 |
cy.get("#vendors_list table.dataTable") |
257 |
.click(); |
283 |
.invoke("attr", "id") |
258 |
cy.url().should( |
284 |
.then(table_id => { |
259 |
"contain", |
285 |
cy.intercept("GET", "/api/v1/acquisitions/vendors*").as( |
260 |
"/cgi-bin/koha/acqui/parcels.pl?booksellerid=1" |
286 |
"get-vendors" |
261 |
); |
287 |
); |
|
|
288 |
cy.get(`#${table_id}_wrapper input.dt-input`).type( |
289 |
this.vendor.name |
290 |
); |
291 |
cy.wait("@get-vendors"); |
292 |
cy.get(`#${table_id} tbody tr:first`) |
293 |
.contains("Receive shipments") |
294 |
.click(); |
295 |
cy.url().should( |
296 |
"contain", |
297 |
`/cgi-bin/koha/acqui/parcels.pl?booksellerid=${this.vendor.id}` |
298 |
); |
299 |
}); |
262 |
}); |
300 |
}); |
263 |
}); |
301 |
}); |