Skip to content

Fix RouterLink issue and item-spec test #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions build/webpack.cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const path = require('path')
const merge = require('webpack-merge')
const base = require('./webpack.base.config')

const config = merge(base, {
resolve: {
alias: {
'create-api': './create-api-client.js'
}
}
})

module.exports = config
2 changes: 1 addition & 1 deletion cypress.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"baseUrl": "https://vue-hn.now.sh",
"baseUrl": "http://localhost:8080",
"projectId": "b1sfu5"
}
9 changes: 7 additions & 2 deletions cypress/integration/item-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import VueRouter from 'vue-router'
import router from '../../src/router'
import Item from '../../src/components/Item.vue'
import { timeAgo, host } from '../../src/util/filters'
import { createRouter } from '../../src/router'
import VueRouter from 'vue-router'
import mountVue from 'cypress-vue-unit-test'

const mountVue = require('cypress-vue-unit-test')
/* eslint-env mocha */
/* global cy, Cypress */
describe('Item', () => {
Expand All @@ -22,6 +24,7 @@ describe('Item', () => {
descendants: 42
}
}

const extensions = {
plugins: [VueRouter],
filters: { timeAgo, host }
Expand All @@ -31,6 +34,8 @@ describe('Item', () => {
extensions
}

const router = createRouter()

beforeEach(() => {
cy.viewport(400, 200)
})
Expand All @@ -41,6 +46,6 @@ describe('Item', () => {
})

it('has link to comments', () => {
cy.contains('router-link', '42 comments')
cy.contains('.comments-link > a', '42 comments')
})
})
2 changes: 1 addition & 1 deletion cypress/plugins/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const join = require('path').join
const {
onFilePreprocessor
} = require('cypress-vue-unit-test/preprocessor/webpack')
const config = join(__dirname, '../../build/webpack.base.config')
const config = join(__dirname, '../../build/webpack.cypress.config')
module.exports = on => {
on('file:preprocessor', onFilePreprocessor(config))
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"author": "Evan You <[email protected]>",
"private": true,
"scripts": {
"cy:open": "cypress open",
"cy:run": "cypress run",
"dev": "node server",
"start": "cross-env NODE_ENV=production node server",
"build": "rimraf dist && npm run build:client && npm run build:server",
Expand Down