Files
cypress/cli
Ben Kucera 4cfcae28f0 feat: test config overrides (#5346)
* decaffeinate: Rename browser.coffee from .coffee to .js

* decaffeinate: Convert browser.coffee to JS

* decaffeinate: Run post-processing cleanups on browser.coffee

* temp 02/14/20 [skip ci]

* add beforeEachRestoreRunner to select specs, remove support file hook

* temp 03/03/20 [skip ci]

* fix more specs due to support file change

* fix errored spec

* add isInteractive config to many specs

* update yarn.lock

* use yarn.lock from develop

* fix nested suite configurations

* fix nested suite configurations 2

* force isInteractive in driver/support file

* update more specs to use test config format

* update more specs to use test config format 2

* update more specs to use test config format 3

* update more specs to use test config format 4

* update more specs to use test config format 5

* fix cli/types tests, unit tests

* cleanup

* allow .isBrowser to support array, use .isBrowser for per-test-config

* allow null browser test/suite config value

* temp 04/10/20 [skip ci]

* restore test originalTitle when skip due to browser

* add tests for per-test-config baseUrl

* update .isBrowser error message

* fix rerunning hooks on top navigation

* rename duplicate issue number

* up timeout for server/integration test

* change test to be more specific

* rename TestOptions, add baseUrl test, override xit xdescribe methods

* add tests for xit/xdescribe

* disable video for flaky e2e test

* fix lint-types, e2e snapshot

* try 2: fix rerun before/after hooks

* temp 04/29/20 [skip ci]

* change logic to rerun before hooks after top navigation

* fix windowSize for browser e2e test

* fix windowSize for xvfb chrome in e2e test

* ok fine, just disable screenshots

* perf: faster lookup for hooks without runnables

* fix afterAll hook switch logic

* backport to before/after fix

* backport to before/after fix 2

* fix noExit passed to e2e test inline options

* remove extra root afterhook check

* add issue link..twice

* cleanup function to arrows

* remove Cypress object proxying related code for certain utils

* use getTest() as we did previously

* remove Cypress object proxying related code for certain utils

* fix Cypress._RESUMED_AT_TEST access

* fix Cypress._RESUMED_AT_TEST access 2

* fix runner.getResumedAtTestIndex, state accesses

* fix firefoxgcinterval access

* fix arrow function

* fix firefoxgcinterval access

* try a simpler way to fix afterAll hook issue

* fix decaf after merge

* cleanup internal-types.d.ts

* fix internal-types

* fix comment, getTestFromRunnable signature

* remove unneeded lastTestInSuiteLogic

* fix after merge: many decaffed specs, typedefs

* minor cleanup

* fix typedefs: add taskTimeout

* minor typedef fix, fix more specs modifying config()

* fix e2e snapshot

* fix flake: waiting_spec cancel outstanding XHR between tests

* fix flake

* change config mutation logic, add tests, update typedefs

* add env support to testConfigOverride

* fix specs: remove isInteractive override, add to beforeEach

* move testConfigOverride to file

* finish moving local config logic to cy.js

* fix typedefs cypress.d.ts

* fix minor minor dtslint

* minor spec cleanup

* chunk: typescript spec fixes, bind Cypress.$

* apply chunk: typescript spec fixes, bind Cypress.$

* fix stop-only

* fix stop-only 2

* extend the jqueryProxyFn in the constructor

* remove experimental code

* rename spec files for overrides, cleanup

* rename snapshots + tests to match updated test config overrides

* fix firefox flake: navigation_spec

Co-authored-by: Brian Mann <brian.mann86@gmail.com>
2020-06-04 11:26:11 -04:00
..
2020-04-01 11:44:27 -04:00
2020-04-01 11:44:27 -04:00
2020-06-04 11:26:11 -04:00

CLI

The CLI is used to build the cypress npm module to be run within a terminal.

The CLI has the following responsibilities:

  • Allow users to print CLI commands
  • Allow users to install the Cypress executable
  • Allow users to print their current Cypress version
  • Allow users to run Cypress tests from the terminal
  • Allow users to open Cypress in the interactive Test Runner.
  • Allow users to verify that Cypress is installed correctly and executable
  • Allow users to manages the Cypress binary cache
  • Allow users to pass in options that change way tests are ran or recorded (browsers used, specfiles ran, grouping, parallelization)

Building

See scripts/build.js. Note that the built npm package will include NPM_README.md as its public README file.

Testing

Automated

From the repo's root, you can run unit tests with:

yarn test-unit --scope cypress
yarn test-watch --scope cypress
yarn test-debug --scope cypress

This will take and compare snapshots of the CLI output. To update snapshots, see snap-shot-it instructions: https://github.com/bahmutov/snap-shot-it#advanced-use

Type Linting

When testing with dtslint, you may need to remove existing typescript installations before running the type linter (for instance, on OS X, you might rm -rf ~/.dts/typescript-installs) in order to reproduce issues with new versions of typescript (i.e., @next).

Manual

To build and test an NPM package:

  • yarn
  • yarn build

This creates build folder.

  • cd build; yarn pack

This creates an archive, usually named cypress-v<version>.tgz. You can install this archive from other projects, but because there is no corresponding binary yet (probably), skip binary download. For example from inside cypress-example-kitchensink folder

yarn add ~/{your-dirs}/cypress/cli/build/cypress-3.3.1.tgz --ignore-scripts

Which installs the tgz file we have just built from folder Users/jane-lane/{your-dirs}/cypress/cli/build.