https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44270 --- Comment #1 from Nick Clemens (kidclamp) <nick@bywatersolutions.com> --- Created attachment 212569 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=212569&action=edit Bug 44270: Add Cypress helpers to create a staff member and log in as them Several Cypress specs need a staff member with specific permissions, and each builds one by hand: insertSamplePatron, then SQL for borrowers.flags and user_permissions, then the password through the API, then their own login and cleanup code. This adds: - the insertSampleStaff task, which creates a staff member who can log in to the staff interface (catalogue is always given) with the requested permissions, written as "module" or "module:subpermission": cy.task("insertSampleStaff", { permissions: ["tools:upload_general_files"], library: { library_id: "CPL" }, }) It returns { patron, password } (and the generated library and patron category, if any), which can be passed to deleteSampleObjects. The permissions are deleted with the patron by the database. - the cy.loginAs(staff) command, which clears the cookies and logs in as that staff member borrowers.flags is computed with 2 ** bit: some permission modules have a bit above 30 (sip2 is 31, item_lists 33), which 1 << bit gets wrong in JavaScript. Test plan: npx cypress run --spec t/cypress/integration/t/insertData.ts The insertSampleStaff tests pass. (insertSampleHold needs circulation rules that allow holds.) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes.