- Notifications
You must be signed in to change notification settings - Fork2.1k
Greenkeeper/initial#288
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
bahmutov wants to merge17 commits intovuejs:masterChoose a base branch frombahmutov:greenkeeper/initial
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
Uh oh!
There was an error while loading.Please reload this page.
Open
Changes fromall commits
Commits
Show all changes
17 commits Select commitHold shift + click to select a range
7c0304e
wrote e2e tests
bahmutov878c8f5
start component unit tests
bahmutovc5f0a52
setup travis CI
bahmutova48e2b7
use node 8 on Travis
bahmutovb8f6b93
trying to uninstall all SW and clear caches
bahmutovd809f04
more sw
bahmutovd9de141
working filters on Item tests except for router-link
bahmutov12c13a8
more try and fail
bahmutov7d9074a
trying to test router
bahmutov913e2b3
chore(package): update dependencies
greenkeeper[bot]ac0bcb2
docs(readme): add Greenkeeper badge
greenkeeper[bot]7aeac79
Fix RouterLink issue and item-spec test (#1)
amirrustam742b2a3
Update dependencies to enable Greenkeeper 🌴 (#2)
greenkeeper[bot]97aa872
add travis ci badge
bahmutova2aa24f
record on CI
bahmutov2f6bcee
remove duplicate import
bahmutovac129da
Merge branch 'master' into greenkeeper/initial
bahmutovFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
3 changes: 2 additions & 1 deletion.gitignore
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -4,4 +4,5 @@ dist/ | ||
npm-debug.log | ||
yarn-error.log | ||
.idea | ||
*.iml | ||
cypress/videos |
4 changes: 4 additions & 0 deletions.npmrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
registry=http://registry.npmjs.org/ | ||
save-exact=true | ||
progress=false | ||
package-lock=false |
9 changes: 9 additions & 0 deletions.travis.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
language: node_js | ||
node_js: | ||
- '8' | ||
cache: | ||
directories: | ||
- ~/.npm | ||
- node_modules | ||
script: | ||
- npm run ci:record |
2 changes: 2 additions & 0 deletionsREADME.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletionsbuild/webpack.cypress.config.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
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 |
4 changes: 4 additions & 0 deletionscypress.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"baseUrl": "http://localhost:8080", | ||
"projectId": "b1sfu5" | ||
} |
5 changes: 5 additions & 0 deletionscypress/fixtures/example.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name":"Using fixtures to represent data", | ||
"email":"hello@cypress.io", | ||
"body":"Fixtures are a great way to mock data for responses to routes" | ||
} |
50 changes: 50 additions & 0 deletionscypress/integration/item-spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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 mountVue from 'cypress-vue-unit-test' | ||
/* eslint-env mocha */ | ||
/* global cy, Cypress */ | ||
describe('Item', () => { | ||
const template = `<news-item :item="item"></news-item>` | ||
const components = { | ||
'news-item': Item | ||
} | ||
const data = { | ||
item: { | ||
title: 'Vue unit testing with Cypress', | ||
score: 101, | ||
url: 'https://www.cypress.io', | ||
id: 'a0x', | ||
by: 'bahmutov', | ||
time: Cypress.moment('Jan 22 2018').unix(), | ||
descendants: 42 | ||
} | ||
} | ||
const extensions = { | ||
plugins: [VueRouter], | ||
filters: { timeAgo, host } | ||
} | ||
const options = { | ||
extensions | ||
} | ||
const router = createRouter() | ||
beforeEach(() => { | ||
cy.viewport(400, 200) | ||
}) | ||
beforeEach(mountVue({ template, router, components, data }, options)) | ||
it('loads news item', () => { | ||
cy.contains('.score', 101) | ||
}) | ||
it('has link to comments', () => { | ||
cy.contains('.comments-link > a', '42 comments') | ||
}) | ||
}) |
43 changes: 43 additions & 0 deletionscypress/integration/no-sw-spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* eslint-env mocha */ | ||
/* global cy, Cypress */ | ||
describe('Without ServiceWorker', () => { | ||
// cleaning anything cached by the ServiceWorker | ||
// and preventing ServiceWorker from registering | ||
// https://github.com/cypress-io/cypress/issues/702 | ||
const clearCache = (name) => | ||
window.caches.delete(name) | ||
const clearCaches = () => | ||
window.caches.keys().then(cacheNames => | ||
Promise.all(cacheNames.map(clearCache))) | ||
// prevents new service worker registration | ||
const neverRegisterSW = (win) => { | ||
// use a promise that never resolves | ||
const neverResolves = new Promise(resolve => {}) | ||
win.navigator.serviceWorker.register = () => neverResolves | ||
} | ||
// unregisters any service workers already registered | ||
const unregisterWorkers = (win) => | ||
win.navigator.serviceWorker.getRegistrations() | ||
.then(registrations => | ||
Cypress.Promise.map(registrations, sw => sw.unregister()) | ||
) | ||
beforeEach(clearCaches) | ||
beforeEach(() => { | ||
const clearSW = win => { | ||
neverRegisterSW(win) | ||
return unregisterWorkers(win) | ||
} | ||
cy.visit('/', { | ||
onBeforeLoad: clearSW | ||
}) | ||
}) | ||
it('loads news items', () => { | ||
cy.get('.news-item').should('have.length.gt', 10) | ||
}) | ||
}) |
38 changes: 38 additions & 0 deletionscypress/integration/spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* eslint-env mocha */ | ||
/* global cy */ | ||
describe('HackerNews', () => { | ||
beforeEach(() => { | ||
cy.visit('/') | ||
}) | ||
it('loads', () => { | ||
cy.contains('Built with Vue.js') | ||
}) | ||
it('loads news items', () => { | ||
cy.get('.news-item').should('have.length.gt', 10) | ||
}) | ||
it('goes to the second page and back', () => { | ||
cy.contains('.news-list-nav a', 'more >').click() | ||
cy.url().should('contain', '/top/2') | ||
cy.go('back') | ||
cy.url().should('contain', '/top') | ||
}) | ||
it('cannot go to the previous page', () => { | ||
cy.contains('.news-list-nav a', '< prev') | ||
.should('have.class', 'disabled') | ||
}) | ||
it('goes to comments and back', () => { | ||
// see comments for the first story | ||
cy.get('.news-item') | ||
.first().find('.meta .comments-link') | ||
.click() | ||
// loader disappears, and comments are there | ||
cy.get('.item-view-comments-header .spinner').should('not.be.visible') | ||
// NOTE: there might be zero comments | ||
cy.get('.comment') | ||
.should('have.length.gte', 0) | ||
.and('be.visible') | ||
// go to the top news | ||
cy.get('nav').contains('Top').click() | ||
cy.url().should('contain', '/top') | ||
}) | ||
}) |
8 changes: 8 additions & 0 deletionscypress/plugins/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const join = require('path').join | ||
const { | ||
onFilePreprocessor | ||
} = require('cypress-vue-unit-test/preprocessor/webpack') | ||
const config = join(__dirname, '../../build/webpack.cypress.config') | ||
module.exports = on => { | ||
on('file:preprocessor', onFilePreprocessor(config)) | ||
} |
25 changes: 25 additions & 0 deletionscypress/support/commands.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) |
20 changes: 20 additions & 0 deletionscypress/support/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
// Import commands.js using ES2015 syntax: | ||
import'./commands' | ||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.