diff --git a/.gitignore b/.gitignore index b2cd19c1df8d..bf1f7099e4e1 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ tmp/ node_modules/ config/webpack/paths.json *.sw[po] +cypress/screenshots +cypress/videos diff --git a/cypress.json b/cypress.json new file mode 100644 index 000000000000..17ef242e711f --- /dev/null +++ b/cypress.json @@ -0,0 +1,3 @@ +{ + "baseUrl": "http://localhost:3000" +} diff --git a/cypress/integration/ui/actions.spec.js b/cypress/integration/ui/actions.spec.js new file mode 100644 index 000000000000..6d98931147b3 --- /dev/null +++ b/cypress/integration/ui/actions.spec.js @@ -0,0 +1,17 @@ +/// + +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") + }) +}) diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js new file mode 100644 index 000000000000..fd170fba6912 --- /dev/null +++ b/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 +} diff --git a/cypress/support/commands.js b/cypress/support/commands.js new file mode 100644 index 000000000000..ca4d256f3eb1 --- /dev/null +++ b/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) => { ... }) diff --git a/cypress/support/index.js b/cypress/support/index.js new file mode 100644 index 000000000000..d68db96df269 --- /dev/null +++ b/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') diff --git a/package.json b/package.json index 1ae1b8edb6b4..d86f126f56fb 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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",