describe("tools/csvprofiles/addcsv-sql", 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();
}
/* FIXME - Invalid step */
cy.login();
/* No specific padding defined */
cy.set_cookie_lang(lang);
});
it("addcsv-sql", function () {
cy.visit("/cgi-bin/koha/tools/csv-profiles.pl?op=add_form");
cy.waitForPageLoad();
cy.get("#profile").type("Simple export");
cy.get("#type").select("SQL", {force: true});
cy.get("#used_for_sql").select("export_basket", {force: true});
cy.get("#sql_content").type("Title=biblio.title|Author=biblio.author|Year=biblio.copyrightdate");
cy.get("main").click();
cy.get("main").should('be.visible').screenshot("addcsv-sql");
});
});
});
afterEach(function () {
Cypress.env('PADDING_BEFORE_SCREENSHOT', undefined);
if (this.currentTest.state === 'failed') {
Cypress.env("TEST_FAILED", true);
}
});
});
Spec data
Page
csv-profiles.pl?op=add_form
Interface
staff
Element selector
main
Missing selector
N
setup
workflow
type #profile=Simple export
select #type=SQL
select #used_for_sql=export_basket
type #sql_content=Title=biblio.title|Author=biblio.author|Year=biblio.copyrightdate
click main
teardown
Notes
We must type some information in the form
Profile name: Simple export
Profile type (select): SQL
Usage (select): Basket export in acquisitions
Profile SQL fields: Title=biblio.title|Author=biblio.author|Year=biblio.copyrightdate
Look like click can't be used with <select> element, this will be a problem in many forms. The error says we should use cy.select() instead. I don't know if we can do that in the spec data section.