describe("circ/overduewfines", function () {
const languages = ['en', 'es-ES', 'fr-FR', 'de-DE', 'el-GR', 'zh-Hant-TW'];
languages.forEach((lang) => {
describe(`in ${lang}`, () => {
beforeEach(function(){
// If previous test failed, skip this one
if (Cypress.env("TEST_FAILED")) {
this.skip();
}
cy.query("DELETE FROM accountlines;")
cy.query("DELETE FROM account_offsets;")
cy.query("DELETE FROM issues;")
cy.query("INSERT INTO issues (`borrowernumber`,`itemnumber`,`date_due`,`branchcode`,`issuedate`) VALUES ('45','47', CONCAT(DATE_SUB(CURDATE(), INTERVAL 5 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 15 DAY)), ('5','630', CONCAT(DATE_SUB(CURDATE(), INTERVAL 7 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 17 DAY)), ('5','279', CONCAT(DATE_SUB(CURDATE(), INTERVAL 7 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 17 DAY)), ('23','153', CONCAT(DATE_SUB(CURDATE(), INTERVAL 3 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 13 DAY)), ('28','34', CONCAT(DATE_SUB(CURDATE(), INTERVAL 18 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 28 DAY)), ('28','65', CONCAT(DATE_SUB(CURDATE(), INTERVAL 18 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 28 DAY)), ('31','562', CONCAT(DATE_SUB(CURDATE(), INTERVAL 19 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 29 DAY)), ('31','262', CONCAT(DATE_SUB(CURDATE(), INTERVAL 19 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 29 DAY)), ('31','35', CONCAT(DATE_SUB(CURDATE(), INTERVAL 19 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 29 DAY));")
cy.query("INSERT INTO accountlines (`issue_id`,`borrowernumber`,`itemnumber`,`date`,`amount`,`description`,`debit_type_code`,`status`,`amountoutstanding`,`interface`) VALUES ((SELECT issue_id FROM issues WHERE borrowernumber = '45' AND itemnumber = '47'),'45','47',NOW(),'1.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '47'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '45' AND itemnumber = '47')),'OVERDUE','UNRETURNED','1.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '5' AND itemnumber = '630'),'5','630',NOW(),'1.500000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '630'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '5' AND itemnumber = '630')),'OVERDUE','UNRETURNED','1.500000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '5' AND itemnumber = '279'),'5','279',NOW(),'1.500000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '279'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '5' AND itemnumber = '279')),'OVERDUE','UNRETURNED','1.500000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '23' AND itemnumber = '153'),'23','153',NOW(),'0.750000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '153'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '23' AND itemnumber = '153')),'OVERDUE','UNRETURNED','0.750000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '28' AND itemnumber = '34'),'28','34',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '34'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '28' AND itemnumber = '34')),'OVERDUE','UNRETURNED','4.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '28' AND itemnumber = '65'),'28','65',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '65'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '28' AND itemnumber = '65')),'OVERDUE','UNRETURNED','4.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '31' AND itemnumber = '562'),'31','562',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '562'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '31' AND itemnumber = '562')),'OVERDUE','UNRETURNED','4.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '31' AND itemnumber = '262'),'31','262',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '262'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '31' AND itemnumber = '262')),'OVERDUE','UNRETURNED','4.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '31' AND itemnumber = '35'),'31','35',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '35'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '31' AND itemnumber = '35')),'OVERDUE','UNRETURNED','4.000000','cron');")
cy.query("INSERT INTO account_offsets (`debit_id`,`type`,`amount`,`created_on`) VALUES ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '45' AND itemnumber = '47' AND amount = '1.000000'),'CREATE','1.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '5' AND itemnumber = '630' AND amount = '1.500000'),'CREATE','1.500000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '5' AND itemnumber = '279' AND amount = '1.500000'),'CREATE','1.500000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '23' AND itemnumber = '153' AND amount = '0.750000'),'CREATE','0.750000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '28' AND itemnumber = '34' AND amount = '4.000000'),'CREATE','4.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '28' AND itemnumber = '65' AND amount = '4.000000'),'CREATE','4.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '31' AND itemnumber = '562' AND amount = '4.000000'),'CREATE','4.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '31' AND itemnumber = '262' AND amount = '4.000000'),'CREATE','4.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '31' AND itemnumber = '35' AND amount = '4.000000'),'CREATE','4.000000', NOW());")
cy.login();
/* No specific padding defined */
cy.set_cookie_lang(lang);
});
it("overduewfines", function () {
cy.visit("/cgi-bin/koha/circ/branchoverdues.pl");
cy.waitForPageLoad();
cy.visit("/cgi-bin/koha/circ/set-library.pl");
cy.waitForPageLoad();
cy.get("#set-library-branch").select("MPL", {force: true});
cy.get("input.btn-primary[type='submit']").click();
cy.visit("/cgi-bin/koha/circ/branchoverdues.pl");
cy.waitForPageLoad();
cy.get("main").should('be.visible').screenshot("overduewfines");
});
});
});
afterEach(function () {
cy.query("DELETE FROM accountlines;")
cy.query("DELETE FROM account_offsets;")
cy.query("DELETE FROM issues;")
Cypress.env('PADDING_BEFORE_SCREENSHOT', undefined);
if (this.currentTest.state === 'failed') {
Cypress.env("TEST_FAILED", true);
}
});
});
Spec data
Page
circ/branchoverdues.pl
Interface
staff
Element selector
main
Missing selector
setup
sql DELETE FROM accountlines;
sql DELETE FROM account_offsets;
sql DELETE FROM issues;
sql INSERT INTO issues (`borrowernumber`,`itemnumber`,`date_due`,`branchcode`,`issuedate`) VALUES ('45','47', CONCAT(DATE_SUB(CURDATE(), INTERVAL 5 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 15 DAY)), ('5','630', CONCAT(DATE_SUB(CURDATE(), INTERVAL 7 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 17 DAY)), ('5','279', CONCAT(DATE_SUB(CURDATE(), INTERVAL 7 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 17 DAY)), ('23','153', CONCAT(DATE_SUB(CURDATE(), INTERVAL 3 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 13 DAY)), ('28','34', CONCAT(DATE_SUB(CURDATE(), INTERVAL 18 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 28 DAY)), ('28','65', CONCAT(DATE_SUB(CURDATE(), INTERVAL 18 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 28 DAY)), ('31','562', CONCAT(DATE_SUB(CURDATE(), INTERVAL 19 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 29 DAY)), ('31','262', CONCAT(DATE_SUB(CURDATE(), INTERVAL 19 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 29 DAY)), ('31','35', CONCAT(DATE_SUB(CURDATE(), INTERVAL 19 DAY), ' 23:59:00'),'MPL', DATE_SUB(NOW(), INTERVAL 29 DAY));
sql INSERT INTO accountlines (`issue_id`,`borrowernumber`,`itemnumber`,`date`,`amount`,`description`,`debit_type_code`,`status`,`amountoutstanding`,`interface`) VALUES ((SELECT issue_id FROM issues WHERE borrowernumber = '45' AND itemnumber = '47'),'45','47',NOW(),'1.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '47'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '45' AND itemnumber = '47')),'OVERDUE','UNRETURNED','1.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '5' AND itemnumber = '630'),'5','630',NOW(),'1.500000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '630'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '5' AND itemnumber = '630')),'OVERDUE','UNRETURNED','1.500000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '5' AND itemnumber = '279'),'5','279',NOW(),'1.500000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '279'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '5' AND itemnumber = '279')),'OVERDUE','UNRETURNED','1.500000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '23' AND itemnumber = '153'),'23','153',NOW(),'0.750000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '153'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '23' AND itemnumber = '153')),'OVERDUE','UNRETURNED','0.750000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '28' AND itemnumber = '34'),'28','34',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '34'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '28' AND itemnumber = '34')),'OVERDUE','UNRETURNED','4.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '28' AND itemnumber = '65'),'28','65',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '65'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '28' AND itemnumber = '65')),'OVERDUE','UNRETURNED','4.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '31' AND itemnumber = '562'),'31','562',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '562'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '31' AND itemnumber = '562')),'OVERDUE','UNRETURNED','4.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '31' AND itemnumber = '262'),'31','262',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '262'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '31' AND itemnumber = '262')),'OVERDUE','UNRETURNED','4.000000','cron'), ((SELECT issue_id FROM issues WHERE borrowernumber = '31' AND itemnumber = '35'),'31','35',NOW(),'4.000000',CONCAT((SELECT title FROM items LEFT JOIN biblio USING (biblionumber) WHERE itemnumber = '35'), (SELECT DATE(date_due) FROM issues WHERE borrowernumber = '31' AND itemnumber = '35')),'OVERDUE','UNRETURNED','4.000000','cron');
sql INSERT INTO account_offsets (`debit_id`,`type`,`amount`,`created_on`) VALUES ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '45' AND itemnumber = '47' AND amount = '1.000000'),'CREATE','1.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '5' AND itemnumber = '630' AND amount = '1.500000'),'CREATE','1.500000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '5' AND itemnumber = '279' AND amount = '1.500000'),'CREATE','1.500000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '23' AND itemnumber = '153' AND amount = '0.750000'),'CREATE','0.750000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '28' AND itemnumber = '34' AND amount = '4.000000'),'CREATE','4.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '28' AND itemnumber = '65' AND amount = '4.000000'),'CREATE','4.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '31' AND itemnumber = '562' AND amount = '4.000000'),'CREATE','4.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '31' AND itemnumber = '262' AND amount = '4.000000'),'CREATE','4.000000', NOW()), ((SELECT accountlines_id FROM accountlines WHERE borrowernumber = '31' AND itemnumber = '35' AND amount = '4.000000'),'CREATE','4.000000', NOW());