Skip to content

Commit

Permalink
fix tests to match with session authenticate endPoint
Browse files Browse the repository at this point in the history
  • Loading branch information
avdev4j committed Aug 10, 2020
1 parent e1c4144 commit fc845cf
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('login modal', () => {

beforeEach(() => {
cy.server();
cy.route('POST', '/api/authentication').as('authentication');
cy.route('POST', '/api/<%_ if (authenticationType === 'session') { _%>authentication<% } else { %>authenticate<% } %>').as('authenticate');
});

it('greets with signin', () => {
Expand All @@ -27,7 +27,7 @@ describe('login modal', () => {
it('requires username', () => {
cy.get(passwordLoginSelector).type('a-password');
cy.get(submitLoginSelector).click();
cy.wait('@authentication').its('status').should('equal', 403);
cy.wait('@authenticate').its('status').should('equal', 400);
// login page should stay open when login fails
cy.get(titleLoginSelector).should('be.visible');
cy.get(passwordLoginSelector).clear();
Expand All @@ -36,7 +36,7 @@ describe('login modal', () => {
it('requires password', () => {
cy.get(usernameLoginSelector).type('a-login');
cy.get(submitLoginSelector).click();
cy.wait('@authentication').its('status').should('equal', 403);
cy.wait('@authenticate').its('status').should('equal', 400);
cy.get(errorLoginSelector).should('be.visible');
cy.get(usernameLoginSelector).clear();
});
Expand All @@ -45,7 +45,7 @@ describe('login modal', () => {
cy.get(usernameLoginSelector).type('admin');
cy.get(passwordLoginSelector).type('bad-password');
cy.get(submitLoginSelector).click();
cy.wait('@authentication').its('status').should('equal', 403);
cy.wait('@authenticate').its('status').should('equal', 401);
cy.get(errorLoginSelector).should('be.visible');
cy.get(usernameLoginSelector).clear();
cy.get(passwordLoginSelector).clear();
Expand All @@ -55,8 +55,7 @@ describe('login modal', () => {
cy.get(usernameLoginSelector).type('admin');
cy.get(passwordLoginSelector).type('admin');
cy.get(submitLoginSelector).click();
cy.wait('@authentication').its('status').should('equal', 200);
cy.wait('@authenticate').its('status').should('equal', 200);
cy.hash().should('eq', '');
cy.wait('@getAccount').its('status').should('equal', 200);
});
});

0 comments on commit fc845cf

Please sign in to comment.