reporter: get cypress tests set up

This commit is contained in:
Chris Breiding
2017-06-30 15:38:54 -04:00
parent f285c3b811
commit a650285180
8 changed files with 128 additions and 1 deletions
+4
View File
@@ -0,0 +1,4 @@
{
"viewportWidth": 500,
"viewportHeight": 450
}
+44
View File
@@ -0,0 +1,44 @@
{
"env": {
"browser": true,
"commonjs": true,
"mocha": true
},
"globals": {
"cy": true,
"Cypress": true,
"expect": true
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"plugins": [
"mocha",
"react"
],
"rules": {
"react/jsx-curly-spacing": "error",
"react/jsx-equals-spacing": "error",
"react/jsx-filename-extension": "error",
"react/jsx-no-duplicate-props": "error",
"react/jsx-no-target-blank": "error",
"react/jsx-no-undef": "error",
"react/jsx-pascal-case": "error",
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"react/no-unknown-property": "error",
"react/prefer-es6-class": "error",
"react/react-in-jsx-scope": "error",
"react/require-render-return": "error",
"react/wrap-multilines": "error",
"mocha/handle-done-callback": "error",
"mocha/no-exclusive-tests": "error",
"mocha/no-global-tests": "error"
}
}
@@ -0,0 +1,46 @@
{
"id": "r1",
"title": "",
"root": true,
"tests": [
],
"suites": [
{
"id": "r2",
"title": "suite 1",
"root": false,
"tests": [
{
"id": "r3",
"title": "test 1",
"state": "passed"
},
{
"id": "r4",
"title": "test 2",
"state": "failed"
}
],
"suites": [
{
"id": "r5",
"title": "nested suite 1",
"root": false,
"tests": [
{
"id": "r6",
"title": "test 1",
"state": "pending"
},
{
"id": "r7",
"title": "test 2",
"state": "active"
}
]
}
]
}
]
}
@@ -0,0 +1,19 @@
{ EventEmitter } = require("events")
describe "controls", ->
beforeEach ->
cy.fixture("runnables").as("runnables")
@runner = new EventEmitter()
cy.visit("cypress/support/index.html").then (win) =>
win.render({
runner: @runner
specPath: "/foo/bar"
})
cy.get(".reporter").then =>
@runner.emit("runnables:ready", @runnables)
@runner.emit("reporter:start", {})
it "shows reporter", ->
@@ -0,0 +1,3 @@
<link rel="stylesheet" href="/dist/reporter.css" />
<div id="app"></div>
<script src="/dist/reporter.js"></script>
@@ -13,5 +13,8 @@ module.exports = function setZunderConfig (zunder) {
resolutions: commonScripts,
scriptName: 'reporter.js',
stylesheetName: 'reporter.css',
staticGlobs: {
'node_modules/font-awesome/fonts/**': '/fonts',
},
})
}
+2 -1
View File
@@ -11,6 +11,7 @@ u.series(
u.parallel(
z.watchScripts,
z.watchTests,
z.watchStylesheets
z.watchStylesheets,
z.watchStaticAssets
)
)()
+7
View File
@@ -3,6 +3,7 @@ import { action } from 'mobx'
import { observer } from 'mobx-react'
import PropTypes from 'prop-types'
import React, { Component } from 'react'
import { render } from 'react-dom'
import EQ from 'css-element-queries/src/ElementQueries'
import appState from './lib/app-state'
@@ -77,4 +78,10 @@ class Reporter extends Component {
}
}
if (window.Cypress) {
window.render = (props) => {
render(<Reporter {...props} />, document.getElementById('app'))
}
}
export default { Reporter }