Install cypress

This commit is contained in:
Josh Johnson 2018-10-10 12:36:43 +01:00
parent 3319529b98
commit 7d3c8daf07
8 changed files with 111 additions and 11 deletions

View File

@ -5,7 +5,8 @@
"prettier"
],
"plugins": [
"prettier"
"prettier",
"cypress"
],
"env": {
"es6": true,
@ -22,16 +23,30 @@
"afterEach": true
},
"rules": {
"import/no-extraneous-dependencies": ["error", {
"devDependencies": true
}],
"no-console": ["warn", { "allow": ["warn", "error"] }],
"import/no-extraneous-dependencies": [
"error",
{
"devDependencies": true
}
],
"no-console": [
"warn",
{
"allow": [
"warn",
"error"
]
}
],
"no-plusplus": "off",
"no-unused-expressions": "off",
"no-underscore-dangle": "off",
"prettier/prettier": ["error", {
"singleQuote": true,
"trailingComma": "all"
}]
"prettier/prettier": [
"error",
{
"singleQuote": true,
"trailingComma": "all"
}
]
}
}
}

3
cypress.json Normal file
View File

@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost:3001"
}

View File

@ -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"
}

View File

@ -0,0 +1,12 @@
describe('Choices', () => {
describe('text element', () => {
it('works', () => {
cy.visit('/');
expect(true).to.equal(true);
});
});
describe('select-one element', () => {});
describe('select-multiple element', () => {});
});

17
cypress/plugins/index.js Normal file
View File

@ -0,0 +1,17 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}

View File

@ -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
cypress/support/index.js Normal file
View File

@ -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')

View File

@ -11,6 +11,7 @@
"coverage": "nyc npm run test",
"test": "mocha --require ./config/test.js --compilers js:babel-core/register \"./src/**/**/**/**/*.test.js\"",
"test:watch": "npm run test -- --watch --inspect=5556",
"cypress": "$(npm bin)/cypress run",
"css:watch": "nodemon -e scss -x \"npm run css:build\"",
"css:build": "npm run css:sass -s && npm run css:prefix -s && npm run css:min -s",
"css:sass": "node-sass --output-style expanded --include-path scss src/styles/base.scss public/assets/styles/base.css && node-sass --output-style expanded --include-path scss src/styles/choices.scss public/assets/styles/choices.css",
@ -49,10 +50,12 @@
"chai": "^4.1.0",
"concurrently": "^3.1.0",
"csso": "^1.8.2",
"cypress": "^3.1.0",
"eslint": "^3.19.0",
"eslint-config-airbnb": "^15.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-loader": "^1.5.0",
"eslint-plugin-cypress": "^2.0.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-prettier": "^2.6.0",
@ -64,6 +67,7 @@
"node-sass": "^3.4.2",
"nodemon": "^1.9.1",
"nyc": "^11.0.3",
"opn": "^5.1.0",
"postcss-cli": "^2.5.1",
"prettier": "^1.13.0",
"sinon": "^2.4.0",
@ -79,7 +83,6 @@
"custom-event-polyfill": "^0.3.0",
"deepmerge": "^2.2.1",
"fuse.js": "^3.1.0",
"opn": "^5.1.0",
"redux": "^3.3.1"
},
"npmName": "choices.js",