You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
1.2 KiB

  1. context('Login', () => {
  2. beforeEach(() => {
  3. cy.request('/api/method/logout');
  4. cy.visit('/login');
  5. cy.location().should('be', '/login');
  6. });
  7. it('greets with login screen', () => {
  8. cy.get('.page-card-head').contains('Login');
  9. });
  10. it('validates password', () => {
  11. cy.get('#login_email').type('Administrator');
  12. cy.get('.btn-login').click();
  13. cy.location('pathname').should('eq', '/login');
  14. });
  15. it('validates email', () => {
  16. cy.get('#login_password').type('qwe');
  17. cy.get('.btn-login').click();
  18. cy.location('pathname').should('eq', '/login');
  19. });
  20. it('logs in using correct credentials', () => {
  21. cy.get('#login_email').type('Administrator');
  22. cy.get('#login_password').type(Cypress.config('adminPassword'));
  23. cy.get('.btn-login').click();
  24. cy.location('pathname').should('eq', '/desk');
  25. cy.window().its('frappe.session.user').should('eq', 'Administrator');
  26. });
  27. it('shows invalid login if incorrect credentials', () => {
  28. cy.get('#login_email').type('Administrator');
  29. cy.get('#login_password').type('qwer');
  30. cy.get('.btn-login').click();
  31. cy.get('.page-card-head').contains('Invalid Login. Try again.');
  32. cy.location('pathname').should('eq', '/login');
  33. });
  34. });