- Testing: Switch to Cypress with code coverage

- npm: Add peerDeps
This commit is contained in:
Brett Zamir
2019-11-23 21:02:51 +08:00
parent e1671cc372
commit 3736fddb7f
17 changed files with 4957 additions and 2608 deletions

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 will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

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

@@ -0,0 +1,44 @@
// ***********************************************************
// 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.js';
// Alternatively you can use CommonJS syntax:
// require('./commands')
/**
* FIDDLE
* Adds "cy.runExample()" custom command
* Accets test object property (or array thereof):
* Required: `test`
* Optional: `html`, `name`, `description`
* With `testExamples` only: `skip` and `only`
* @see https://github.com/cypress-io/cypress-fiddle
* @example import {testExamples} from '@cypress/fiddle';
*/
import '@cypress/fiddle';
/**
* COVERAGE
* @see https://docs.cypress.io/guides/tooling/code-coverage.html#Install-the-plugin
*/
import '@cypress/code-coverage/support.js';
/**
* ACCESSIBILITY
* @see https://www.npmjs.com/package/cypress-axe
*/
import 'cypress-axe';

View File

@@ -0,0 +1,13 @@
export const approveStorage = () => {
return cy.get('#dialog_buttons > input[type=button][data-ok]')
.click();
};
export const openMainMenu = () => {
return cy.get('#main_icon').click();
};
export const openEditorPreferences = () => {
openMainMenu();
return cy.get('#tool_prefs_option').click();
};