describe('The Login Page', () => { it('login and redirect to main page', () => { const username = 'test'; const password = 'test'; cy.visit('/'); cy.login(username, password, true); cy.get('body').contains('Neues Wissen erwerben'); }); it('user sees error message if username is omitted', () => { const username = ''; const password = 'test'; cy.visit('/beta-login'); cy.login(username, password); cy.get('[data-cy=email-local-errors]').contains('E-Mail ist ein Pflichtfeld'); }); it('user sees error message if password is omitted', () => { const username = 'test'; const password = ''; cy.visit('/beta-login'); cy.login(username, password); cy.get('[data-cy=password-local-errors]').contains('Passwort ist ein Pflichtfeld'); }); it('user sees error message if credentials are invalid', () => { const username = 'test'; const password = '12345'; cy.visit('/beta-login'); cy.login(username, password); cy.get('[data-cy=login-error]').contains('Die E-Mail oder das Passwort ist falsch. Bitte versuchen Sie nochmals.'); }); })