describe("tools/tasksched/taskscheduler", 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("INSERT INTO saved_sql (id, borrowernumber, date_created, last_modified, savedsql, report_name, public) VALUES (1, 51, NOW(), NOW(), \"SELECT COUNT(barcode) AS Count FROM items WHERE barcode <> '' AND barcode IS NOT NULL\", \"Count of all items\", 1)")
cy.query("INSERT INTO saved_sql (id, borrowernumber, date_created, last_modified, savedsql, report_name, public) VALUES (2, 51, NOW(), NOW(), \"SELECT COUNT(biblio.title) AS Count FROM biblio\", \"Count of all titles\", 1)")
cy.login();
/* No specific padding defined */
cy.set_cookie_lang(lang);
});
it("taskscheduler", function () {
cy.visit("/cgi-bin/koha/tools/scheduler.pl");
cy.waitForPageLoad();
cy.get("select#report").select("1", {force: true});
cy.get("main").should('be.visible').screenshot("taskscheduler");
});
});
});
afterEach(function () {
cy.query("DELETE FROM saved_sql WHERE id=1")
cy.query("DELETE FROM saved_sql WHERE id=2")
Cypress.env('PADDING_BEFORE_SCREENSHOT', undefined);
if (this.currentTest.state === 'failed') {
Cypress.env("TEST_FAILED", true);
}
});
});
Spec data
Page
scheduler.pl
Interface
staff
Element selector
main
Missing selector
N
setup
sql INSERT INTO saved_sql (id, borrowernumber, date_created, last_modified, savedsql, report_name, public) VALUES (1, 51, NOW(), NOW(), "SELECT COUNT(barcode) AS Count FROM items WHERE barcode <> '' AND barcode IS NOT NULL", "Count of all items", 1)
sql INSERT INTO saved_sql (id, borrowernumber, date_created, last_modified, savedsql, report_name, public) VALUES (2, 51, NOW(), NOW(), "SELECT COUNT(biblio.title) AS Count FROM biblio", "Count of all titles", 1)
workflow
select select#report=1
teardown
sql DELETE FROM saved_sql WHERE id=1
sql DELETE FROM saved_sql WHERE id=2
Notes
The screenshot should be of the drop down showing possible reports to choose for the select element. Unfortunately using the cypress "select" command will just select the specified value, so you don't have a chance to see the drop down menu while it's still open.
Add these two reports to saved_sql:
https://wiki.koha-community.org/wiki/Catalog/Item_Reports#Count_of_all_items
https://wiki.koha-community.org/wiki/Cataloging_-_Bibliographic_Reports#Count_of_all_titles