From 0fcff960f765db205acc24d8ae4b859487f8b1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Wed, 12 Dec 2018 03:26:01 +0100 Subject: [PATCH] Fix lint --- cypress/integration/common/steps.js | 101 ++++++---------------------- cypress/plugins/index.js | 5 +- layouts/default.vue | 4 +- 3 files changed, 24 insertions(+), 86 deletions(-) diff --git a/cypress/integration/common/steps.js b/cypress/integration/common/steps.js index 9a263b51a..611636040 100644 --- a/cypress/integration/common/steps.js +++ b/cypress/integration/common/steps.js @@ -1,14 +1,19 @@ -import { Given, When, Then } from "cypress-cucumber-preprocessor/steps"; +import { Given, When, Then } from 'cypress-cucumber-preprocessor/steps' const baseUrl = 'http://localhost:3000' const username = 'Peter Lustig' - const login = (email, password) => { cy.visit(`${baseUrl}/login`) - cy.get('input[name=email]').trigger('focus').type(email) - cy.get('input[name=password]').trigger('focus').type(password) - cy.get('button[name=submit]').as('submitButton').click() + cy.get('input[name=email]') + .trigger('focus') + .type(email) + cy.get('input[name=password]') + .trigger('focus') + .type(password) + cy.get('button[name=submit]') + .as('submitButton') + .click() cy.location('pathname').should('eq', '/') // we're in! } @@ -17,20 +22,17 @@ const logout = () => { cy.location('pathname').should('contain', '/login') // we're out } -const checkLoggedIn = () => { -} - Given('I am logged in', () => { login('admin@example.org', 1234) }) -Given('my account has the following details:', (table) => { +Given('my account has the following details:', table => { // as long as we rely on seed data, this is only documentation }) When('I log out', logout) -When(`I visit the {string} page`, (route) => { +When(`I visit the {string} page`, route => { cy.visit(`${baseUrl}/${route}`) }) @@ -44,7 +46,10 @@ When('I refresh the page', () => { When('I log out through the menu in the top right corner', () => { cy.get('.avatar-menu').click() - cy.get('.avatar-menu-popover').find('a').contains('Logout').click() + cy.get('.avatar-menu-popover') + .find('a') + .contains('Logout') + .click() }) Then('I can click on my profile picture in the top right corner', () => { @@ -57,80 +62,12 @@ Then('I can see my name {string} in the dropdown menu', () => { Then('I see the login screen again', () => { cy.location('pathname').should('contain', '/login') - cy.contains('Wenn Du ein Konto bei Human Connection hast, melde Dich bitte hier an.') + cy.contains( + 'Wenn Du ein Konto bei Human Connection hast, melde Dich bitte hier an.' + ) }) Then('I am still logged in', () => { cy.get('.avatar-menu').click() cy.get('.avatar-menu-popover').contains(username) }) - -// cy.visit('http://localhost:3000/') -// .get('.layout-blank') -// .should('be.visible') -// -// cy.location('pathname') -// .should('contain', '/login') -// -// cy.get('input[name=email]') -// .as('inputEmail') -// .should('be.empty') -// .and('have.attr', 'placeholder', 'Deine E-Mail') -// .trigger('focus') -// .type('user@example.org') -// -// cy.get('input[name=password]') -// .as('inputPassword') -// .should('be.empty') -// // .and('have.attr', 'placeholder', 'Dein Passwort') -// .trigger('focus') -// .type('1234') -// -// cy.get('button[name=submit]') -// .as('submitButton') -// .should('be.visible') -// .and('not.be.disabled') -// .click() -// -// cy.get('@submitButton') -// .should('be.disabled') -// // .next('.snackbar') -// -// cy.get('.layout-default') -// -// cy.location('pathname') -// .should('eq', '/') -// } -// -// const logout = function () { -// cy.visit('http://localhost:3000/logout') -// -// cy.location('pathname') -// .should('contain', '/login') -// -// cy.get('.layout-blank') -// .should('be.visible') -// } -// -// context('Authentication', () => { -// it('Login Testuser', loginTestUser) -// -// it('Login & Logout', function () { -// // login -// loginTestUser() -// -// // logout -// logout() -// }) -// -// it('Still logged in after page-reload', function () { -// // login -// loginTestUser() -// -// cy.reload() -// .get('.layout-default') -// -// // logout -// // logout() -// }) -// }) diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js index 4957acf21..788e74365 100644 --- a/cypress/plugins/index.js +++ b/cypress/plugins/index.js @@ -12,13 +12,14 @@ // the project's config changing) const cucumber = require('cypress-cucumber-preprocessor').default -module.exports = (on) => { // (on, config) => { +module.exports = on => { + // (on, config) => { // `on` is used to hook into various events Cypress emits // `config` is the resolved Cypress config on('file:preprocessor', cucumber()) on('task', { - log () { + log() { console.log(arguments) return null } diff --git a/layouts/default.vue b/layouts/default.vue index c01d0f866..0bea14ac2 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -19,7 +19,7 @@ style="float: right" > @@ -31,7 +31,7 @@