5.0.0-alpha.0 • Published 7 months ago

@meniga/testing v5.0.0-alpha.0

Weekly downloads
125
License
MIT
Repository
-
Last release
7 months ago

Meniga-testing

This is a common library for testing using cypress in the meniga world. It has some basic configs and all the external helper utils that are useful for testing

Setup

Step 1

Create a basic cypress.json file in the root of your application (cypress docs: https://docs.cypress.io/guides/references/configuration.html)

Example

{
  "projectId": "wrapp-index-web",
  "baseUrl": "http://localhost:9004",
  "video": false,
  "blacklistHosts": "www.google-analytics.com"
}

Step 2

Create the following folderstructure inside a folder called cypress in the root of your application

- cypress
 - plugins
  - index.js
 - support
  - index.js
plugins/index.js
module.exports = require('@meniga-testing/src/plugins')
support/index.js
require('@meniga/testing/src/support')

Test

Cypress will run all files matching the following filename syntax *.spec.js

Custom cypress functions

cy.getId(data-test-id)

This is a shorthand to select dom element based of data-test-id value. Using data-test-id is higly reccomended as described in cypress best practices https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements

Utils functions

hexToRgb(hexValue)

Converts hex color code to Rgb, usefull when testing the color of DOM elements