From fc5b196cc5cba2af9a7954ada318c77f9ee2b709 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Wed, 30 Jul 2025 17:20:10 +0100 Subject: [PATCH] Create commands.js --- cypress/support/commands.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 cypress/support/commands.js diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 00000000..489fe9a3 --- /dev/null +++ b/cypress/support/commands.js @@ -0,0 +1,14 @@ +Cypress.Commands.add("login", () => { + const username = "m0abc"; + const password = "demo"; + cy.visit("/index.php/user/login"); + cy.get('input[name="user_name"]').type(username); + cy.get('input[name="user_password"]').type(password); + cy.get('button[type="submit"]').click(); +}); + +// Custom command to wait for select elements to be populated +Cypress.Commands.add("waitForSelectOptions", (selector, minOptions = 1) => { + cy.get(selector).should('be.visible'); + cy.get(`${selector} option`).should('have.length.greaterThan', minOptions); +});