3.2.0 • Published 2 years ago

@runnerty/executor-cypress v3.2.0

Weekly downloads
43
License
MIT
Repository
github
Last release
2 years ago

NPM version Downloads

Cypress executor for Runnerty:

Cypress wrapper.

Installation:

Through NPM

npm i @runnerty/executor-cypress

You can also add modules to your project with runnerty

npx runnerty add @runnerty/executor-cypress

This command installs the module in your project, adds example configuration in your config.json and creates an example plan of use.

If you have installed runnerty globally you can include the module with this command:

runnerty add @runnerty/executor-cypress

Please check Cypress system requirements.

Configuration sample:

Add in config.json:

{
  "id": "cypress_default",
  "type": "@runnerty-executor-cypress"
}

Plan sample:

Add in plan.json:

{
  "id": "cypress_default",
  "exec": {
    "id": "cypress_default",
    "browser": "chrome",
    "configFile": false,
    "config": {
      "integrationFolder": "./tests"
    }
  }
}

Plan advanced:

Add in plan.json:

{
  "id": "cypress_default",
  "browser": "chrome",
  "group": "MY_GROUP",
  "tag": "production",
  "key": "MY_SECRET_KEY",
  "port": "8080",
  "headed": false,
  "headless": true,
  "quiet": true,
  "record": false,
  "reporter": "junit",
  "reporterOptions": {
    "mochaFile": false,
    "toConsole": false
  },
  "spec": ".tests/my_test.spec.js",
  "config": {
    "baseUrl": "https://runnerty.io",
    "env": {
      "MY_ENV_1": "@GV(MY_VAL_TO_ENV_1)"
    },
    "chromeWebSecurity": true,
    "numTestsKeptInMemory": 50,
    "defaultCommandTimeout": 4000,
    "execTimeout": 60000,
    "pageLoadTimeout": 60000,
    "requestTimeout": 5000,
    "responseTimeout": 30000,
    "taskTimeout": 60000,
    "fileServerFolder": "./",
    "fixturesFolder": "cypress/fixtures",
    "integrationFolder": "cypress/integration",
    "downloadsFolder": "cypress/downloads",
    "pluginsFile": "cypress/plugins/index.js",
    "screenshotsFolder": "cypress/screenshots",
    "videosFolder": "cypress/videos",
    "ignoreTestFiles": "**/ignoredTestFiles/*.js",
    "screenshotOnRunFailure": false,
    "supportFile": false,
    "trashAssetsBeforeRuns": true,
    "videoCompression": 32,
    "video": false,
    "videoUploadOnPasses": true,
    "viewportHeight": 660,
    "viewportWidth": 1000,
    "animationDistanceThreshold": 5,
    "waitForAnimations": true,
    "scrollBehavior": "top",
    "firefoxGcInterval": { "runMode": 1, "openMode": null },
    "experimentalRunEvents": false,
    "experimentalSourceRewriting": false,
    "experimentalStudio": false,
    "retries": { "runMode": 0, "openMode": 0 },
    "includeShadowDom": false
  }
}

Params:

ParameterDescription
browserSpecify different browser to run tests in, either by name or by filesystem path. default: chrome.
ciBuildIdSpecify a unique identifier for a run to enable grouping or parallelization
groupGroup recorded tests together under a single run name
tagTag string for the recorded run, like 'production,nightly'
headedDisplay the browser instead of running headlessly
headlessHide the browser instead of running headed. default: true.
keySpecify your secret record key
parallelRun recorded specs in parallel across multiple machines
portOverride default port
quietRun quietly, using only the configured reporter. default: true.
recordWhether to record the test run
reporterOptionsSpecify mocha reporter options.
specSpecify the specs to run
configFilePath to the config file to be used. If false is passed, no config file will be used.

Config param options:

ParameterDescription
baseUrlUrl used as prefix for cy.visit() or cy.request() command’s url
envAny values to be set as environment variables
ignoreTestFilesA String or Array of glob patterns used to ignore test files that would otherwise be shown in your list of tests. Cypress uses minimatch with the options: {dot: true, matchBase: true}. We suggest using http://globtester.com to test what files would match.
numTestsKeptInMemoryThe number of tests for which snapshots and command data are kept in memory. Reduce this number if you are experiencing high memory consumption in your browser during a test run.
reporterOptionsSome reporters accept reporterOptions that customize their behavior
portPort used to host Cypress. Normally this is a randomly generated port
reporterThe reporter used when running headlessly or in CI
defaultCommandTimeoutTime, in milliseconds, to wait until most DOM based commands are considered timed out
execTimeoutTime, in milliseconds, to wait for a system command to finish executing during a cy.exec() command
pageLoadTimeoutTime, in milliseconds, to wait for page transition events or cy.visit(), cy.go(), cy.reload() commands to fire their page load events
requestTimeoutTime, in milliseconds, to wait for an XHR request to go out in a cy.wait() command
responseTimeoutTime, in milliseconds, to wait until a response in a cy.request()
taskTimeoutTime, in milliseconds, to wait for a task to finish executing during a cy.task() command
fileServerFolderPath to folder where application files will attempt to be served from
fixturesFolderPath to folder containing fixture files (Pass false to disable). default: 'cypress/fixtures'
integrationFolderPath to folder containing integration test files. default: 'cypress/integration'
downloadsFolderPath to folder where files downloaded during a test are saved. default: 'cypress/downloads'
nodeVersionIf set to system, Cypress will try to find a node executable on your path to use when executing your plugins. Otherwise, Cypress will use the Node version bundled with Cypress. default: 'bundled'
pluginsFilePath to plugins file. (Pass false to disable). default: 'cypress/plugins/index.js'
resolvedNodePathIf nodeVersion === 'system' and a node executable is found, this will be the full filesystem path to that executable.
resolvedNodeVersionThe version of node that is being used to execute plugins. example 1.2.3
screenshotOnRunFailureWhether Cypress will take a screenshot when a test fails during cypress run.
screenshotsFolderPath to folder where screenshots will be saved from cy.screenshot() command or after a headless or CI run’s test failure. default: 'cypress/screenshots'
supportFilePath to file to load before test files load. This file is compiled and bundled. (Pass false to disable). default: 'cypress/support/index.js'
videosFolderPath to folder where videos will be saved after a headless or CI run. default: 'cypress/videos'
trashAssetsBeforeRunsWhether Cypress will trash assets within the screenshotsFolder and videosFolder before headless test runs. default: true.
videoCompressionThe quality setting for the video compression, in Constant Rate Factor (CRF). The value can be false to disable compression or a value between 0 and 51, where a lower value results in better quality (at the expense of a higher file size). default: 32
videoWhether Cypress will record a video of the test run when running headlessly. default: false.
videoUploadOnPassesWhether Cypress will upload the video to the Dashboard even if all tests are passing. This applies only when recording your runs to the Dashboard. Turn this off if you’d like the video uploaded only when there are failing tests. default: true.
chromeWebSecurityWhether Chrome Web Security for same-origin policy and insecure mixed content is enabled. Read more about this here. default: true.
viewportHeightDefault height in pixels for the application under tests’ viewport (Override with cy.viewport() command). default: 660.
viewportWidthDefault width in pixels for the application under tests’ viewport. (Override with cy.viewport() command). default: 1000.
animationDistanceThresholdThe distance in pixels an element must exceed over time to be considered animating. default: 5.
waitForAnimationsWhether to wait for elements to finish animating before executing commands. default: true.
scrollBehaviorViewport position to which an element should be scrolled prior to action commands. Setting false disables scrolling. default: 'top'
firefoxGcIntervalFirefox version 79 and below only: The number of tests that will run between forced garbage collections. default: { runMode: 1, openMode: null }
experimentalRunEventsAllows listening to the before:run, after:run, before:spec, and after:spec events in the plugins file. default: false.
experimentalSourceRewritingEnables AST-based JS/HTML rewriting. This may fix issues caused by the existing regex-based JS/HTML replacement algorithm. default: false.
experimentalStudioGenerate and save commands directly to your test suite by interacting with your app as an end user would.. default: false.
retriesNumber of times to retry a failed test. If a number is set, tests will retry in both runMode and openMode. To enable test retries only in runMode, set e.g. { openMode: null, runMode: 2 }. default: null
includeShadowDomEnables including elements within the shadow DOM when using querying. commands (e.g. cy.get(), cy.find()). Can be set globally in cypress.json per-suite or per-test in the test configuration object, or programmatically with Cypress.config(), default: false.

These parameters will always have the fixed values to avoid conflicts:

ParameterDescription
noExitKeep Cypress open after all tests run. Fixed value: false
reporterSpecify a mocha reporter. Fixed value: 'junit'
watchForFileChangesWhether Cypress will watch and restart tests on test file changes: Fixed value: false
reporterOptions/toConsoleSpecify mocha reporter options: toConsole. Fixed value: false

Output (Process values):

Standard

  • PROCESS_EXEC_MSG_OUTPUT: Cypress summary message.
  • PROCESS_EXEC_ERR_OUTPUT: Error output message.

Results output

  • PROCESS_EXEC_DATA_OUTPUT: Cypress Json stringify output.

It is also possible to access the rest of the values returned by Cypress. Some examples:

  • PROCESS_EXEC_TOTALDURATION: Total time duration
  • PROCESS_EXEC_TOTALPASSED: Total number of passed
  • PROCESS_EXEC_TOTALPENDING: Total number of pending
  • PROCESS_EXEC_TOTALFAILED: Total number of failures
  • PROCESS_EXEC_TOTALSKIPPED: Total number of skipped
  • PROCESS_EXEC_TOTALSKIPPED: Total number of skipped
  • PROCESS_EXEC_TOTALSKIPPED: Total number of skipped
  • PROCESS_EXEC_TOTALSUITES: Total number of suites
  • PROCESS_EXEC_TOTALTESTS: Total number of tests
  • PROCESS_EXEC_CYPRESSVERSION: Cypress Version
  • PROCESS_EXEC_BROWSERNAME: Browser name
  • PROCESS_EXEC_REPORTER: Reporter
  • PROCESS_EXEC_RUNURL: Run URL
  • PROCESS_EXEC_RUNS_0_STATE: State of test number 1
  • PROCESS_EXEC_RUNS_0_STATE: State of test number 1
  • PROCESS_EXEC_RUNS_0_DISPLAYERROR: Display error of test number 1
  • PROCESS_EXEC_RUNS_0_SCREENSHOTS_0: ScreenShot path 1 of test number 1
  • PROCESS_EXEC_RUNS_0_VIDEO: Video of test number 1
3.2.0

2 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.5

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

3.0.0-rc

3 years ago