2.0.0 • Published 3 years ago

wowpack1 v2.0.0

Weekly downloads
-
License
MTC
Repository
github
Last release
3 years ago

ABOUT this package

This is a package which will assist any new cypress users with the below functions

  • Cypress basic
  • Cypress cucumber folder structure and configuration
  • Cypress visual testing using cypress-image
  • Cypress Tags
  • Cypress browser configuration
  • Cypress config for specific environments
  • Cypress reporting with BDD and Mocawesome
  • Cypress intgration with dockers
  • Cypress integration with browserstack
  • Cypress integration with Percy
  • Cypress integration with Xray Jira
  • Cypress integration with GitHub Actions

Installation

npm i wowpack1

Instructions

  1. Install wowpack1
  2. Install the plugins vcode extensions
  • Docker for Visual Studio Code
  • Prettier Formatter for Visual Studio Code
  1. npx cypress open
  2. npx copy
  3. Update cypress.json with default values
{
	"watchForfileChanges": false,
	"testFiles": ["**/*.spec.js", "**/*.feature"],
	"ignoreTestFiles": ["*.md","x_*"],
	"viewportWidth": 1280,
	"ViewportHeight": 650,
	"waitForAnimation": true,
	"animationDistanceTreshold": 20,
	"video": true,
	"defultCommandTimeout": 5000,
	"pageLoadTimeout": 30000,
	"defaultCommandTimeout": 6000,
	"execTimeout": 15000,
	"requestTimeOut": 150000,
	"responseTimeout": 150000,
	"failOnStatusCode": false,
	"chromiumSecurity": false,
	"chromeWebSecurity": false,
	"baseUrl": "http://www.google.com",
	"retries": {
		"runMode": 1,
		"openMode": 0
	},
	"reporter": "cypress-multi-reporters",
	"reporterOptions": {
		"configFile": "cypress/support/reportGenerator/mocha-repoter-options.json"
	},
	"experimentalStudio": true
}
  1. Update pacakage.json with the below
  • scripts
"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "****": "************* Cypress Test **********************",
	  "unicon:test": "cypress run --spec cypress/integration/features/sample.test.spec.js",
	  "unicon:tags:test": "cypress-tags run -e TAGS='@xray'",
    "`****": "************* Cypress - Cucumber Test **********************",
    "unicon:test:chrome": "cypress run --spec cypress/integration/features/sample.test.feature --browser chrome",
    "`****`": "************* Cypress - Visual commands **********************",
		"unicon:test:update": "cypress run --spec cypress/integration/features/sample.test.feature name=DEV --env updateSnapshots=true",
		"unicon:test:imagdiff:false": "cypress run --spec cypress/integration/features/sample.test.feature --env failOnSnapshotDiff=false",
		"``****`": "************* Cypress - Reports **********************",
    "unicon:deletereport": "rm -rf cypress/reports/cucumber/*.* cypress/results/cucumber/*.* cypress/reports/mocha/*.* cypress/results/mocha/*.* || true",
		"unicon:bdd:generate:report": "node ./cypress/support/reportGenerator/cucumber-report-generator.js",
		"unicon:mocha:merge:report": "npx mochawesome-merge -f cypress/results/mocha/*.json -o cypress/results/mochaReport/report.json",
		"unicon:mocha:generate:report": "npx marge cypress/results/mochaReport/report.json -f report -o cypress/reports/mocha",
    "``****``": "************* Cypress - Third Part Integration **********************",
    "unicon:docker": "docker build -t cypress . ",
    "unicon:browserstack": "cypress/support/browserStackLocal/OSX/BrowserStackLocal --key access_key --local-identifier CypressLocalConnection1",
    "unicon:browserstack:run":"browserstack-cypress run --sync",
    "unicon:percy:token:win==>": "set PERCY_TOKEN=token",
		"unicon:percy:token:mac==>": "export PERCY_TOKEN=token",
		"unicon:percy": "percy exec -- cypress run --spec cypress/integration/features/sample.percyTest.spec.js",
    "unicon:multi:action:test": "npm run unicon:deletereport && npm run unicon:tags:test && npm run unicon:bdd:generate:report && npm run unicon:mocha:merge:report && npm run unicon:mocha:generate:report",
    "unicon:update:xray": "node ./cypress/support/reportGenerator/xray-report.js --te=abc-123 --tp=abc-111"
  },
  • copy cypress-cucumber-preprocessor
    "cypress-cucumber-preprocessor": {
        "nonGlobalStepDefinitions": false,
        "features": "cypress/integration/features/**/",
        "stepDefinitions": "cypress/integration/stepDefinitions/**/",
        "cucumberJson": {
        "generate": true,
        "outputFolder": "cypress/results/cucumber",
        "filePrefix": "",
        "fileSuffix": ".cucumber"
        }
    }
  1. Install desktop docker to work with dockers
  2. Update GitHub Action to work with actions
  3. For Browserstack
  • Enter username and Key
  • run the browserstack local setting location - cypress/support/browserStackLocal/OSX/BrowserStackLocal --key access_key --local-identifier CypressLocalConnection1
  • run the command browserstack-cypress run --sync
  1. Percy - Visual testing
    • Create a project in percy (use browserstack account)
      • on Mac run the command $ 'export PERCY_TOKEN=Token'
      • on windows, run the command $ 'set PERCY_TOKEN=token'