Skip to content

Commit

Permalink
Initial commit for using cypress for integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Fryguy committed Jan 31, 2020
1 parent 942c294 commit 440d0b5
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -19,3 +19,5 @@ tmp/
node_modules/
config/webpack/paths.json
*.sw[po]
cypress/screenshots
cypress/videos
3 changes: 3 additions & 0 deletions cypress.json
@@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost:3000"
}
17 changes: 17 additions & 0 deletions cypress/integration/ui/actions.spec.js
@@ -0,0 +1,17 @@
/// <reference types="Cypress" />

describe('Login', () => {
beforeEach(() => {
cy.visit('/')
})

it("login page", () => {
cy.get('#user_name')
.type("admin")
cy.get('#user_password')
.type("smartvm")
cy.get('#login').click()

cy.get(".navbar-brand-name")
})
})
17 changes: 17 additions & 0 deletions cypress/plugins/index.js
@@ -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 changes: 25 additions & 0 deletions cypress/support/commands.js
@@ -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 will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/index.js
@@ -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')
3 changes: 3 additions & 0 deletions package.json
Expand Up @@ -4,6 +4,8 @@
"description": "ManageIQ Cloud Management Platform",
"main": "index.js",
"scripts": {
"cypress:open": "cypress open",
"cypress:run": "cypress run --headless --browser chrome",
"test": "jest",
"test:watch": "jest --watchAll",
"test:current": "jest --watch",
Expand Down Expand Up @@ -106,6 +108,7 @@
"compression-webpack-plugin": "~1.1.11",
"core-js-compat": "~3.2.1",
"css-loader": "~0.28.11",
"cypress": "^3.8.3",
"duplicate-package-checker-webpack-plugin": "~3.0.0",
"enhanced-resolve": "~4.0.0",
"enzyme": "^3.9.0",
Expand Down

0 comments on commit 440d0b5

Please sign in to comment.