describe("acquisitions/addtobasketoptions", function () { const languages = ['en', 'es-ES', 'fr-FR']; languages.forEach((lang) => { describe(`in ${lang}`, () => { beforeEach(function(){ // If previous test failed, skip this one if (Cypress.env("TEST_FAILED")) { this.skip(); } cy.login(); cy.set_cookie_lang(lang); }); it("addtobasketoptions", function () { cy.visit("/cgi-bin/koha/acqui/basket.pl?basketno=1"); cy.get("div.btn-group:nth-child(1) > a:nth-child(1)").click(); cy.get("#acq_basket div.modal-content").should('be.visible').screenshot("addtobasketoptions"); }); }); }); afterEach(function () { if (this.currentTest.state === 'failed') { Cypress.env("TEST_FAILED", true); } }); });
click div.btn-group:nth-child(1) > a:nth-child(1)
CypressError: `cy.screenshot()` only works for a single element. You attempted to screenshot 6 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/acquisitions/addtobasketoptions.ts:17:77)