Files
cypress/packages/server
Chris Breiding 3e6d6bfe15 chore: Updates based on PR feedback (#21137)
* add generic to cy.origin type

* fix log type, update/add comments

* fix comment indentation

* specific generic

* move RemoteState to internal types

* add on links to experimental flag descriptions

* chore: reduce nesting by flipping condition

* fix test title

* simplify failing log

* rename variable

* delete error property

* fix types

* fix type

* remove unnecessary todo

* update wait test

* jquery -> this

* update comment

* remove vestigial autoRun

* use finally

* re-throw non-security errors

* move back getting index

* add new state types

* remove unnecessary export

* startsWith -> includes

* it -> them

* update system test

* remove use of promise constructor

* Revert "remove use of promise constructor"

This reverts commit 35ccc28b6f.

* log errors from Page.getFrameTree

* test if anything breaks when removing optional chaining operator

* remove vestigial file

* handle queue ending in cross-origin driver

* fix coordinates spec

* improve chrome/firefox check in extension

* improve secure cookie regex

* use production mode for cross-origin driver bundle

* adding remoteStates.getPrimary

* catch and ignore queue errors

* remove optional chaining in postMessage handler

* removed unnecessary async

* update frame tree on cri client reconnect

* fix formatting

* renaming remoteStates variable

* prevent requests from being paused if experimentalSessionAndOrigin flag is off

Co-authored-by: Matt Schile <mschile@cypress.io>
2022-04-22 14:58:02 -05:00
..

Server

The server is the heart of the Cypress application. All of this code represents the node process running behind the browser application. This node process is responsible for:

  • Proxying every byte coming in and out of the browser
  • Performing and normalizing automation tasks for each browser
  • Coordinating and synchronizing state with the desktop-gui and driver packages
  • Performing node specific tasks on behalf of the driver
  • Instantiating and orchestrating nearly every other layer and package
  • Spinning up various static file and http servers
  • Communicating with our external API's
  • Recording videos of run
  • Managing mocha reporters
  • Managing 3rd party plugins

The driver and the server are the two most complex packages of Cypress.

Developing

To run the Cypress server:

## boots the entire Cypress application
yarn start

Since the server controls nearly every aspect of Cypress, after making changes you'll need to manually restart Cypress.

Since this is slow, it's better to drive your development with tests.

Building

Note: you should not ever need to build the .js files manually. @packages/ts provides require-time transpilation when in development.

yarn workspace @packages/server build-prod

You can also use the test-watch command to rerun a test file whenever there is a change:

yarn test-watch /test/path/to/spec.js

Running individual unit tests

yarn test <path/to/test>
yarn test test/unit/api_spec.js
## or
yarn test-unit api_spec ## shorthand, uses globbing to find spec

Running individual integration tests

yarn test <path/to/test>
yarn test test/integration/cli_spec.js
## or
yarn test-integration cli_spec ## shorthand, uses globbing to find spec

Running e2e/system tests

With the addition of Component Testing, e2e tests have been renamed to system-tests and moved to the system-tests directory.

Updating snapshots

Prepend SNAPSHOT_UPDATE=1 to any test command. See snap-shot-it instructions for more info.

SNAPSHOT_UPDATE=1 yarn test test/unit/api_spec.js
SNAPSHOT_UPDATE=1 yarn test test/integration/cli_spec.js