Skip to content

Commit

Permalink
10007: Update how cypress is logging in
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Rogers committed Dec 20, 2023
1 parent c7c2e66 commit 7c085f0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
17 changes: 11 additions & 6 deletions cypress/cypress-integration/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,17 @@ Cypress.Commands.add('showsSuccessMessage', (shows = true) => {
});

Cypress.Commands.add('login', (username, route = '/') => {
const url = `/log-in?code=${username}@example.com&path=${route}`;
cy.visit(url);
cy.waitUntilSettled(50);
cy.url().should('include', route);
cy.showsErrorMessage(false);
cy.url().should('not.include', '/mock-login');
cy.visit('/login');

cy.get('[data-testid="email-input"]').type(`${username}@example.com`);

cy.get('[data-testid="password-input"]').type('Testing1234$', { log: false });

cy.get('[data-testid="login-button"]').click();

cy.get('[data-testid="account-menu-button"]');

cy.visit(route);
});

Cypress.Commands.add('goToRoute', (...args) => {
Expand Down
3 changes: 3 additions & 0 deletions web-client/src/views/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const Login = connect(
autoCapitalize="off"
autoCorrect="off"
className="usa-input"
data-testid="email-input"
id="email"
name="email"
type="text"
Expand All @@ -61,6 +62,7 @@ export const Login = connect(
<input
required
className="usa-input"
data-testid="password-input"
id="password"
name="password"
type={showPassword ? 'text' : 'password'}
Expand All @@ -85,6 +87,7 @@ export const Login = connect(
</button>
<Button
className="usa-button margin-top-3"
data-testid="login-button"
onClick={e => {
e.preventDefault();
submitLoginSequence();
Expand Down

0 comments on commit 7c085f0

Please sign in to comment.