Skip to content

Commit

Permalink
Add logout command and expect correct statuses for login and logout r…
Browse files Browse the repository at this point in the history
…equests
  • Loading branch information
fosterfarrell9 committed Aug 24, 2024
1 parent 9e5d4e4 commit cec8dc6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,19 @@ Cypress.Commands.add("login", (user) => {
"user[email]": user.email,
"user[password]": user.password,
},
}).then((response) => {
expect(response.status).to.eq(200);
});
});

Cypress.Commands.add("logout", () => {
return cy.request({
method: "DELETE",
url: "/users/sign_out",
form: true,
failOnStatusCode: true,
}).then((response) => {
expect(response.status).to.eq(204);
});
});

Expand Down

0 comments on commit cec8dc6

Please sign in to comment.