describe('The Login Page', () => { it('login and redirect to main page', () => { const username = 'test'; const password = 'test'; cy.visit('/beta-login'); cy.login(username, password, true); cy.assertStartPage(); }); 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.'); }); it('logs out then logs in again', () => { const user = 'rahel.cueni'; const pw = 'test' cy.viewport('macbook-15'); cy.apolloLogin(user, pw); cy.visit('/me/my-class'); cy.get('[data-cy=header-user-widget]').should('exist').within(() => { cy.get('[data-cy=user-widget-avatar]').should('exist').click(); }); cy.get('[data-cy=logout]').click(); cy.get('[data-cy=email-input]').should('exist').within(() => { cy.visit('/beta-login'); }); cy.login(user, pw); cy.get('[data-cy=header-user-widget]').should('exist').within(() => { cy.get('[data-cy=user-widget-avatar]').should('exist').click(); }); cy.get('.profile-sidebar').should('be.visible'); }); })