|
Lines 233-235
describe("Vendor CRUD operations", () => {
Link Here
|
| 233 |
.contains("deleted"); |
233 |
.contains("deleted"); |
| 234 |
}); |
234 |
}); |
| 235 |
}); |
235 |
}); |
| 236 |
- |
236 |
|
|
|
237 |
describe("Vendor module", () => { |
| 238 |
beforeEach(() => { |
| 239 |
cy.login(); |
| 240 |
cy.title().should("eq", "Koha staff interface"); |
| 241 |
|
| 242 |
cy.task("buildSampleObject", { |
| 243 |
object: "vendor", |
| 244 |
values: { active: 1 }, |
| 245 |
}) |
| 246 |
.then(generatedVendor => { |
| 247 |
delete generatedVendor.list_currency; |
| 248 |
delete generatedVendor.invoice_currency; |
| 249 |
return cy.task("insertObject", { |
| 250 |
type: "vendor", |
| 251 |
object: generatedVendor, |
| 252 |
}); |
| 253 |
}) |
| 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 () { |
| 279 |
cy.visit("/cgi-bin/koha/acquisition/vendors"); |
| 280 |
|
| 281 |
// table_id is currently 'DataTables_Table_0', and it should be fixed |
| 282 |
cy.get("#vendors_list table.dataTable") |
| 283 |
.invoke("attr", "id") |
| 284 |
.then(table_id => { |
| 285 |
cy.intercept("GET", "/api/v1/acquisitions/vendors*").as( |
| 286 |
"get-vendors" |
| 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 |
}); |
| 300 |
}); |
| 301 |
}); |