Fixed some linting issues

This commit is contained in:
Grzegorz Leoniec 2019-02-24 17:14:06 +01:00 committed by Robert Schäfer
parent 1e219934d2
commit 459b582fb4
6 changed files with 82 additions and 50 deletions

View File

@ -29,7 +29,7 @@
ghost
@click.prevent="$router.back()"
>
{{ $t('actions.cancel') }}
{{ $t('actions.cancel') }}
</ds-button>
<ds-button
icon="check"
@ -38,7 +38,7 @@
:disabled="disabled || errors"
primary
>
{{ $t('actions.save') }}
{{ $t('actions.save') }}
</ds-button>
</div>
</ds-card>

View File

@ -35,7 +35,7 @@ Given('I am logged in with a {string} role', role => {
})
cy.login({
email: `${role}@example.org`,
password: '1234',
password: '1234'
})
})
@ -125,16 +125,16 @@ When(/^I confirm the reporting dialog .*:$/, () => {
})
Given('somebody reported the following posts:', table => {
table.hashes().forEach(({slug}, index) => {
const author = {
id: `author${index}`,
email: `author${index}@example.org`,
password: '1234'
table.hashes().forEach(({ slug }, index) => {
const author = {
id: `author${index}`,
email: `author${index}@example.org`,
password: '1234'
}
const reporter = {
id: `reporter${index}`,
email: `reporter${index}@example.org`,
password: '1234'
const reporter = {
id: `reporter${index}`,
email: `reporter${index}@example.org`,
password: '1234'
}
cy.factory()
.create('user', author)
@ -143,7 +143,10 @@ Given('somebody reported the following posts:', table => {
cy.factory()
.create('user', reporter)
.authenticateAs(reporter)
.create('report', { description: 'I don\'t like this post', resource: { id: `p${index}`, type: 'post' } })
.create('report', {
description: "I don't like this post",
resource: { id: `p${index}`, type: 'post' }
})
})
})

View File

@ -53,7 +53,7 @@ Then('they can see the location in the info box below my avatar', () => {
cy.contains(myLocation)
})
Then('the name {string} is still there', (name) => {
Then('the name {string} is still there', name => {
matchNameInUserMenu(name)
})

View File

@ -3,15 +3,14 @@ import { getLangByName } from '../../support/helpers'
/* global cy */
let lastPost = {
}
let lastPost = {}
const loginCredentials = {
email: 'peterpan@example.org',
password: '1234',
password: '1234'
}
const narratorParams = {
name: "Peter Pan",
name: 'Peter Pan',
...loginCredentials
}
@ -20,29 +19,44 @@ Given('I am logged in', () => {
})
Given('we have a selection of tags and categories as well as posts', () => {
cy.factory()
cy.factory()
.authenticateAs(loginCredentials)
.create('category', { id: 'cat1', name: 'Just For Fun', slug: 'justforfun', icon: 'smile' })
.create('category', { id: 'cat2', name: 'Happyness & Values', slug: 'happyness-values', icon: 'heart-o' })
.create('category', { id: 'cat3', name: 'Health & Wellbeing', slug: 'health-wellbeing', icon: 'medkit' })
.create('category', {
id: 'cat1',
name: 'Just For Fun',
slug: 'justforfun',
icon: 'smile'
})
.create('category', {
id: 'cat2',
name: 'Happyness & Values',
slug: 'happyness-values',
icon: 'heart-o'
})
.create('category', {
id: 'cat3',
name: 'Health & Wellbeing',
slug: 'health-wellbeing',
icon: 'medkit'
})
.create('tag', { id: 't1', name: 'Ecology' })
.create('tag', { id: 't2', name: 'Nature' })
.create('tag', { id: 't3', name: 'Democracy' })
.create('post', { id: 'p0' })
.create('post', { id: 'p1' })
.create('post', { id: 'p2' })
.relate('post', 'Categories', { from: 'p0', to: 'cat1' })
.relate('post', 'Categories', { from: 'p1', to: 'cat2' })
.relate('post', 'Categories', { from: 'p2', to: 'cat3' })
.relate('post', 'Tags', { from: 'p0', to: 't1' })
.relate('post', 'Tags', { from: 'p0', to: 't2' })
.relate('post', 'Tags', { from: 'p0', to: 't3' })
.relate('post', 'Tags', { from: 'p1', to: 't1' })
.relate('post', 'Tags', { from: 'p1', to: 't2' })
.relate('post', 'Categories', { from: 'p0', to: 'cat1' })
.relate('post', 'Categories', { from: 'p1', to: 'cat2' })
.relate('post', 'Categories', { from: 'p2', to: 'cat3' })
.relate('post', 'Tags', { from: 'p0', to: 't1' })
.relate('post', 'Tags', { from: 'p0', to: 't2' })
.relate('post', 'Tags', { from: 'p0', to: 't3' })
.relate('post', 'Tags', { from: 'p1', to: 't1' })
.relate('post', 'Tags', { from: 'p1', to: 't2' })
})
Given('we have the following user accounts:', table => {
table.hashes().forEach((params) => {
table.hashes().forEach(params => {
cy.factory().create('user', params)
})
})
@ -125,7 +139,7 @@ When('I press {string}', label => {
})
Given('we have the following posts in our database:', table => {
table.hashes().forEach(({Author, title, content}) => {
table.hashes().forEach(({ Author, title, content }) => {
cy.factory()
.create('user', {
name: Author,
@ -148,9 +162,12 @@ When('I click on the avatar menu in the top right corner', () => {
cy.get('.avatar-menu').click()
})
When('I click on the big plus icon in the bottom right corner to create post', () => {
cy.get('.post-add-button').click()
})
When(
'I click on the big plus icon in the bottom right corner to create post',
() => {
cy.get('.post-add-button').click()
}
)
Given('I previously created a post', () => {
cy.factory()
@ -158,24 +175,24 @@ Given('I previously created a post', () => {
.create('post', lastPost)
})
When('I choose {string} as the title of the post', (title) => {
When('I choose {string} as the title of the post', title => {
lastPost.title = title.replace('\n', ' ')
cy.get('input[name="title"]').type(lastPost.title)
})
When('I type in the following text:', (text) => {
When('I type in the following text:', text => {
lastPost.content = text.replace('\n', ' ')
cy.get('.ProseMirror').type(lastPost.content)
})
Then('the post shows up on the landing page at position {int}', (index) => {
Then('the post shows up on the landing page at position {int}', index => {
cy.openPage('landing')
const selector = `:nth-child(${index}) > .ds-card > .ds-card-content`
cy.get(selector).should('contain', lastPost.title)
cy.get(selector).should('contain', lastPost.content)
})
Then('I get redirected to {string}', (route) => {
Then('I get redirected to {string}', route => {
cy.location('pathname').should('contain', route)
})

View File

@ -35,7 +35,7 @@ Cypress.Commands.add('switchLanguage', (name, force) => {
}
})
Cypress.Commands.add('login', ({email, password}) => {
Cypress.Commands.add('login', ({ email, password }) => {
cy.visit(`/login`)
cy.get('input[name=email]')
.trigger('focus')

View File

@ -7,7 +7,7 @@ const neo4jDriver = getDriver({
username: Cypress.env('NEO4J_USERNAME'),
password: Cypress.env('NEO4J_PASSWORD')
})
const factory = Factory({neo4jDriver})
const factory = Factory({ neo4jDriver })
beforeEach(async () => {
await factory.cleanDatabase({ neo4jDriver })
@ -17,14 +17,26 @@ Cypress.Commands.add('factory', () => {
return Factory()
})
Cypress.Commands.add('create', { prevSubject: true }, (factory, node, properties) => {
return factory.create(node, properties)
})
Cypress.Commands.add(
'create',
{ prevSubject: true },
(factory, node, properties) => {
return factory.create(node, properties)
}
)
Cypress.Commands.add('relate', { prevSubject: true }, (factory, node, relationship, properties) => {
return factory.relate(node, relationship, properties)
})
Cypress.Commands.add(
'relate',
{ prevSubject: true },
(factory, node, relationship, properties) => {
return factory.relate(node, relationship, properties)
}
)
Cypress.Commands.add('authenticateAs', { prevSubject: true }, (factory, loginCredentials) => {
return factory.authenticateAs(loginCredentials)
})
Cypress.Commands.add(
'authenticateAs',
{ prevSubject: true },
(factory, loginCredentials) => {
return factory.authenticateAs(loginCredentials)
}
)