[add] cypress.io e2e testing
This commit is contained in:
parent
53c8fbc228
commit
d2dd404ac2
26 changed files with 1952 additions and 173 deletions
1
tests/cypress/.gitignore
vendored
Normal file
1
tests/cypress/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/node_modules/
|
||||
6
tests/cypress/cypress.json
Normal file
6
tests/cypress/cypress.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"baseUrl": "http://localhost:8984/vue-poc",
|
||||
"viewportWidth": 1600,
|
||||
"viewportHeight": 800
|
||||
}
|
||||
|
||||
1
tests/cypress/cypress/.gitignore
vendored
Normal file
1
tests/cypress/cypress/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/screenshots/
|
||||
5
tests/cypress/cypress/fixtures/example.json
Normal file
5
tests/cypress/cypress/fixtures/example.json
Normal 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"
|
||||
}
|
||||
42
tests/cypress/cypress/integration/apb_spec.js
Normal file
42
tests/cypress/cypress/integration/apb_spec.js
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/**
|
||||
* @author andy bunce
|
||||
* @description Cypress vue-poc
|
||||
*/
|
||||
|
||||
//This is where your test suite starts
|
||||
|
||||
describe('My First Test', function () {
|
||||
|
||||
//This function will execute before each test (i.e it())
|
||||
|
||||
beforeEach(function () {
|
||||
cy.log('I run before every test in every spec file!!!!!!')
|
||||
})
|
||||
|
||||
//Here you actually writes your test (it() is similar to @Test annotaion of TestNG)
|
||||
|
||||
it('home', function () {
|
||||
|
||||
//Click on type button
|
||||
cy.visit('/ui')
|
||||
cy.screenshot()
|
||||
|
||||
}),
|
||||
|
||||
it('about', function () {
|
||||
|
||||
//Click on type button
|
||||
cy.visit('/ui/about')
|
||||
cy.screenshot()
|
||||
|
||||
}),
|
||||
|
||||
it('documentation', function () {
|
||||
|
||||
//Click on type button
|
||||
cy.visit('/ui/documentation')
|
||||
cy.screenshot()
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
27
tests/cypress/cypress/integration/validate.js
Normal file
27
tests/cypress/cypress/integration/validate.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* @author andy bunce
|
||||
* @description Cypress vue-poc
|
||||
*/
|
||||
|
||||
//This is where your test suite starts
|
||||
|
||||
describe('validate tests', function () {
|
||||
|
||||
//This function will execute before each test (i.e it())
|
||||
|
||||
beforeEach(function () {
|
||||
cy.log('I run before every test in every spec file!!!!!!')
|
||||
})
|
||||
|
||||
//Here you actually writes your test (it() is similar to @Test annotaion of TestNG)
|
||||
|
||||
it('validate', function () {
|
||||
|
||||
//Click on type button
|
||||
cy.visit('/ui/validate')
|
||||
cy.screenshot("validate/validate")
|
||||
cy.get("#btn-clear").click()
|
||||
cy.screenshot("validate/clear")
|
||||
})
|
||||
|
||||
})
|
||||
17
tests/cypress/cypress/plugins/index.js
Normal file
17
tests/cypress/cypress/plugins/index.js
Normal 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
|
||||
}
|
||||
25
tests/cypress/cypress/support/commands.js
Normal file
25
tests/cypress/cypress/support/commands.js
Normal 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
tests/cypress/cypress/support/index.js
Normal file
20
tests/cypress/cypress/support/index.js
Normal 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')
|
||||
1578
tests/cypress/package-lock.json
generated
Normal file
1578
tests/cypress/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
14
tests/cypress/package.json
Normal file
14
tests/cypress/package.json
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "vue-poc",
|
||||
"version": "1.0.0",
|
||||
"description": "vue-poc e2e tests",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"cypress": "^3.4.1"
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue