describe("circ/transfercheckin", 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 branchtransfers (itemnumber, frombranch, tobranch, reason, daterequested, datesent) VALUE (278, \"FFL\", \"CPL\", \"Manual\", \"2025-07-04\", \"2025-07-04\")")
cy.login();
/* No specific padding defined */
cy.set_cookie_lang(lang);
});
it("transfercheckin", function () {
cy.visit("/cgi-bin/koha/circ/returns.pl");
cy.waitForPageLoad();
cy.get("#barcode").type("39999000005417");
cy.get("#circ_returns_checkin [type=\"submit\"]").click();
cy.get(".alert").should('be.visible').screenshot("transfercheckin");
});
});
});
afterEach(function () {
cy.query("DELETE FROM branchtransfers WHERE itemnumber=278 and frombranch=\"FFL\"")
Cypress.env('PADDING_BEFORE_SCREENSHOT', undefined);
if (this.currentTest.state === 'failed') {
Cypress.env("TEST_FAILED", true);
}
});
});
Spec data
Page
circ/returns.pl
Interface
staff
Element selector
.alert
Missing selector
Y
setup
sql INSERT INTO branchtransfers (itemnumber, frombranch, tobranch, reason, daterequested, datesent) VALUE (278, "FFL", "CPL", "Manual", "2025-07-04", "2025-07-04")
workflow
type #barcode=39999000005417
click #circ_returns_checkin [type="submit"]
teardown
sql DELETE FROM branchtransfers WHERE itemnumber=278 and frombranch="FFL"
Notes
No id selector for alerts, only class
go_to branchtransfers.pl
Set value of #tobranchcd to FPL
Enter 39999000005417 in #barcode input
Submit
Change library to Fairview
go_to returns.pl
Enter 39999000005417 in #barcode input
Sumbit
CypressError: `cy.screenshot()` only works for a single element. You attempted to screenshot 4 elements.
https://on.cypress.io/screenshot
at screenshot (http://kohadev-intra.mydnsname.org:8081/__cypress/runner/cypress_runner.js:134836:70)
at originalFn (http://kohadev-intra.mydnsname.org:8081/__cypress/runner/cypress_runner.js:111055:30)
at overridden.fn (http://kohadev-intra.mydnsname.org:8081/__cypress/runner/cypress_runner.js:111060:21)
at wrapped (http://kohadev-intra.mydnsname.org:8081/__cypress/runner/cypress_runner.js:138387:19)
From Your Spec Code:
at Context.eval (webpack://koha/./cypress/integration/circ/transfercheckin.ts:21:54)