ToolJet/cypress/integration/auth.spec.js
Mohini Dahiya b333c8949a
Cypress: Added 'createAppIfEmptyDashboard' method to before hook and fixed widget tests. (#704)
* Added 'createAppIfEmptyDashboard' method to before hook

1. Added 'createAppIfEmptyDashboard()' method to before hook.
2. Fixed Widget tests.
3. Added ///<reference types="cypress" /> to index.js

* Test fix for Toggle switch

Capitalised first letters 'Toggle Switch' to search for exact text

* Fixes 'apps-page-operations' tests

1. Updated test for Launch button when no version is deployed.
2. Added test for Launch button when single version of App is deployed.
3. Added test to check message on app deletion.
4. Added custom method for Deploy App with single version.

* Moved import command to support/index.js file

1. Moved "import '@4tw/cypress-drag-drop'" statement to support/index.js file .
2. Updated viewport config "cypress.json" to override default viewport for my device macbook-pro

* Updated 'editor-navigation-bar.spec.js' tests

1. Removes test for hiding left sidebar.
2. Fixes test - resize canvas
3. Fixes test - switch to dark theme

* Revert "Updated 'editor-navigation-bar.spec.js' tests"

This reverts commit 70143c3020.
2021-09-12 09:52:29 +05:30

57 lines
2 KiB
JavaScript

describe('User login', () => {
it('should take user to login page', () => {
cy.visit('/login');
cy.get('.card-title').should('have.text', 'Login to your account');
});
it('should redirect unauthenticated user to login page', () => {
cy.visit('/');
cy.location('pathname').should('equal', '/login');
});
it('should display invalid email or password error', () => {
cy.login('fake_email', 'abcdefg');
cy.checkToastMessage('toast-login-auth-error', 'Invalid email or password');
});
it('should take user to the forgot password page', () => {
cy.visit('/forgot-password');
cy.get('.card-title').should('have.text', 'Forgot Password');
});
it('should take user to the signup page', () => {
cy.visit('/signup');
cy.get('.card-title').should('have.text', 'Create a ToolJet account');
});
it('should sign in the user', () => {
cy.visit('/login');
cy.login('[email protected]', 'password');
cy.location('pathname').should('equal', '/');
cy.get('.page-title').should('have.text', 'All applications');
});
it('should display error if email is not found for "Forgot password"', () => {
cy.visit('/forgot-password');
cy.get('[data-testid="emailField"]').type('[email protected]');
cy.get('[data-testid="submitButton"').click();
cy.checkToastMessage(
'toast-forgot-password-email-error',
'Email address is not associated with a ToolJet cloud account.'
);
});
it('should send reset password confirmation code to email', () => {
cy.intercept('POST', '/password/forgot').as('forgotPasswordConfirmationCode');
cy.visit('/forgot-password');
cy.get('[data-testid="emailField"]').type('[email protected]');
cy.get('[data-testid="submitButton"').click();
cy.wait('@forgotPasswordConfirmationCode').its('response.statusCode').should('eq', 200);
cy.checkToastMessage(
'toast-forgot-password-confirmation-code',
"We've sent the confirmation code to your email address"
);
});
});