Cloudlog/cypress/support/commands.js
Peter Goodhall ca5df78114 Increase Cypress timeouts and add waitForSelectOptions command
Raised default and request timeouts to 60 seconds in Cypress config to improve test reliability. Added a custom 'waitForSelectOptions' command to ensure select elements are populated before interacting, and updated station location test to use this command.
2025-07-17 17:03:41 +01:00

14 行
540 B
JavaScript

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);
});