Fixing Cypress issue

This commit is contained in:
Phan An 2019-04-21 23:43:19 +02:00
parent eaaa1610e0
commit 37597e2a35
5 changed files with 10 additions and 6 deletions

View file

@ -1,5 +1,8 @@
language: php
addons:
chrome: stable
php:
- 7.1
- 7.2

View file

@ -1,3 +1,5 @@
{
"baseUrl": "http://localhost:8088"
"baseUrl": "http://localhost:8088",
"viewportWidth": 1440,
"viewportHeight": 900
}

View file

@ -12,7 +12,7 @@ describe('authentication', () => {
it('logs out', () => {
cy.login()
cy.route('DELETE', '/api/me', [])
cy.get('[data-cy=btnLogOut').click()
cy.get('[data-cy=btnLogOut]').click({ force: true }) // https://github.com/cypress-io/cypress/issues/695
cy.get('[data-cy=loginForm]').should('be.visible')
cy.get('[data-cy=appHeader]').should('not.be.visible')
})

View file

@ -27,11 +27,10 @@
Cypress.Commands.add('login', (email = 'me@phanan.net', password = 'secret') => {
cy.server()
cy.route('POST', '/api/me', 'fixture:token.json')
cy.route('GET', '/api/data', 'fixture:data.json').as('getData')
cy.route('GET', '/api/ping', [])
cy.route('GET', '/api/data', 'fixture:data.json')
cy.route('GET', '/api/ping', '')
cy.visit('/')
cy.get('[type=email]').type(email)
cy.get('[type=password]').type(password)
cy.get('[type=submit]').click()
cy.wait('@getData')
})

View file

@ -99,7 +99,7 @@
"watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"watch-poll": "yarn watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"cy": "kill-port 8088 && php artisan serve --port=8088 & wait-on http://localhost:8088 && cypress run",
"cy": "kill-port 8088 && php artisan serve --port=8088 & wait-on http://localhost:8088 && cypress run --browser chrome",
"build": "yarn production",
"prod": "yarn production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"