Minor changes to login-modal.cy.ts to cleanup CSS selectors

This commit is contained in:
Tim Donohue
2024-09-06 16:32:10 -05:00
parent f9911ce5ba
commit 7aba69edd6

View File

@@ -3,31 +3,31 @@ import { testA11y } from 'cypress/support/utils';
const page = { const page = {
openLoginMenu() { openLoginMenu() {
// Click the "Log In" dropdown menu in header // Click the "Log In" dropdown menu in header
cy.get('ds-header [data-test="login-menu"]').click(); cy.get('[data-test="login-menu"]').click();
}, },
openUserMenu() { openUserMenu() {
// Once logged in, click the User menu in header // Once logged in, click the User menu in header
cy.get('ds-header [data-test="user-menu"]').click(); cy.get('[data-test="user-menu"]').click();
}, },
submitLoginAndPasswordByPressingButton(email, password) { submitLoginAndPasswordByPressingButton(email, password) {
// Enter email // Enter email
cy.get('ds-header [data-test="email"]').type(email); cy.get('[data-test="email"]').type(email);
// Enter password // Enter password
cy.get('ds-header [data-test="password"]').type(password); cy.get('[data-test="password"]').type(password);
// Click login button // Click login button
cy.get('ds-header [data-test="login-button"]').click(); cy.get('[data-test="login-button"]').click();
}, },
submitLoginAndPasswordByPressingEnter(email, password) { submitLoginAndPasswordByPressingEnter(email, password) {
// In opened Login modal, fill out email & password, then click Enter // In opened Login modal, fill out email & password, then click Enter
cy.get('ds-header [data-test="email"]').type(email); cy.get('[data-test="email"]').type(email);
cy.get('ds-header [data-test="password"]').type(password); cy.get('[data-test="password"]').type(password);
cy.get('ds-header [data-test="password"]').type('{enter}'); cy.get('[data-test="password"]').type('{enter}');
}, },
submitLogoutByPressingButton() { submitLogoutByPressingButton() {
// This is the POST command that will actually log us out // This is the POST command that will actually log us out
cy.intercept('POST', '/server/api/authn/logout').as('logout'); cy.intercept('POST', '/server/api/authn/logout').as('logout');
// Click logout button // Click logout button
cy.get('ds-header [data-test="logout-button"]').click(); cy.get('[data-test="logout-button"]').click();
// Wait until above POST command responds before continuing // Wait until above POST command responds before continuing
// (This ensures next action waits until logout completes) // (This ensures next action waits until logout completes)
cy.wait('@logout'); cy.wait('@logout');