Cypress integration (#357)

* initial cypress setup and sample specs

* integrate with e2e run

* update ci settings

* config update

* update config

* remove cypress from e2e setup

* update protractor settings

* upgrade libs

* restore tsconfig

* re-enable cypress
This commit is contained in:
Denys Vuika
2018-05-14 10:54:13 +01:00
committed by Cilibiu Bogdan
parent e1ea9fbfc1
commit 60da9d8b94
8 changed files with 1009 additions and 218 deletions

5
cypress.json Normal file
View File

@@ -0,0 +1,5 @@
{
"$schema": "https://on.cypress.io/cypress.schema.json",
"baseUrl": "http://localhost:4200",
"videoRecording": false
}

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,17 @@
describe('Login', function() {
it('logs in as an admin', () => {
cy.visit('/login');
cy
.get('#username')
.type('admin')
.should('have.value', 'admin');
cy
.get('#password')
.type('admin')
.should('have.value', 'admin');
cy.get('#login-button').click();
cy.url().should('include', '#/personal-files');
});
});

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) => { ... })

26
cypress/support/index.js Normal file
View File

@@ -0,0 +1,26 @@
// ***********************************************************
// 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')
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false
});

1116
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,10 @@
"e2e": "npm run wd:update && protractor protractor.conf.js",
"start:docker": "docker-compose up -d --build && wait-on http://localhost:8080 && wait-on http://localhost:3000",
"stop:docker": "docker-compose stop",
"e2e:docker": "npm run start:docker && npm run e2e && npm run stop:docker"
"e2e:docker": "npm run start:docker && npm run cypress:ci && npm run e2e && npm run stop:docker",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"cypress:ci": "cypress run --browser chrome --config baseUrl=http://localhost:3000"
},
"private": true,
"dependencies": {
@@ -62,19 +65,20 @@
"@types/selenium-webdriver": "^3.0.8",
"codacy-coverage": "^2.0.3",
"codelyzer": "^4.0.1",
"cypress": "^2.1.0",
"jasmine-core": "~2.8.0",
"jasmine-reporters": "^2.2.1",
"jasmine-spec-reporter": "~4.2.1",
"jasmine2-protractor-utils": "^1.3.0",
"jasminewd2": "^2.2.0",
"karma": "~2.0.0",
"karma": "2.0.2",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"node-rest-client": "^3.1.0",
"protractor": "5.3.1",
"protractor": "5.3.2",
"rimraf": "2.6.2",
"selenium-webdriver": "4.0.0-alpha.1",
"ts-node": "~4.1.0",