Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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:master
base:master
Choose a base branch
Loading
frombahmutov:greenkeeper/initial
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
17 commits
Select commitHold shift + click to select a range
7c0304e
wrote e2e tests
bahmutovJan 23, 2018
878c8f5
start component unit tests
bahmutovJan 23, 2018
c5f0a52
setup travis CI
bahmutovJan 23, 2018
a48e2b7
use node 8 on Travis
bahmutovJan 23, 2018
b8f6b93
trying to uninstall all SW and clear caches
bahmutovJan 23, 2018
d809f04
more sw
bahmutovJan 24, 2018
d9de141
working filters on Item tests except for router-link
bahmutovJan 24, 2018
12c13a8
more try and fail
bahmutovJan 24, 2018
7d9074a
trying to test router
bahmutovFeb 5, 2018
913e2b3
chore(package): update dependencies
greenkeeper[bot]Feb 16, 2018
ac0bcb2
docs(readme): add Greenkeeper badge
greenkeeper[bot]Feb 16, 2018
7aeac79
Fix RouterLink issue and item-spec test (#1)
amirrustamFeb 16, 2018
742b2a3
Update dependencies to enable Greenkeeper 🌴 (#2)
greenkeeper[bot]Feb 16, 2018
97aa872
add travis ci badge
bahmutovFeb 16, 2018
a2aa24f
record on CI
bahmutovFeb 16, 2018
2f6bcee
remove duplicate import
bahmutovFeb 16, 2018
ac129da
Merge branch 'master' into greenkeeper/initial
bahmutovFeb 16, 2018
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
3 changes: 2 additions & 1 deletion.gitignore
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,4 +4,5 @@ dist/
npm-debug.log
yarn-error.log
.idea
*.iml
*.iml
cypress/videos
4 changes: 4 additions & 0 deletions.npmrc
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
# vue-hackernews-2.0

[![Greenkeeper badge](https://badges.greenkeeper.io/bahmutov/vue-hackernews-2.0.svg)](https://greenkeeper.io/) [![Build Status](https://travis-ci.org/bahmutov/vue-hackernews-2.0.svg?branch=master)](https://travis-ci.org/bahmutov/vue-hackernews-2.0)

HackerNews clone built with Vue 2.0 + vue-router + vuex, with server-side rendering.

<p align="center">
Expand Down
13 changes: 13 additions & 0 deletionsbuild/webpack.cypress.config.js
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
{
"baseUrl": "http://localhost:8080",
"projectId": "b1sfu5"
}
5 changes: 5 additions & 0 deletionscypress/fixtures/example.json
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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
View file
Open in desktop
Original file line numberDiff line numberDiff 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')
Loading

[8]ページ先頭

©2009-2025 Movatter.jp