* feat: set up experimentalUseDefaultDocumentDomain to disallow document.domain overwritting * use default domain around experimentalUseDefaultDocumentDomain in main iframe and spec bridge iframes. Also adapt CORS policy to use same-origin if experimental flag is set * run ci * fix: add insertion of experimental flag where is was needed/missing * chore: add system test to exercise experimental flag for expected behavior * fix: fix issues with template updates to conform to squirrelly v7 * fix: update config tests to include new experimental flag * run ci * fix: trailing whitespace [run ci] * chore: update snapshot * run ci * fix: update proxy unit tests to account for experimentalUseDefaultDocumentDomain * run ci * fix: Allow component tests with special characters in filepath (#25299) feat: cut over experimental flag to take list of known problematic domains via string/glob pattern run ci chore: update system test and fix broken config * fix: fix server unit and integration tests. integration tests should no longer use google to test against injection as we do not inject document.domain on google domains * run ci * run ci * fix: server integration tests where google documents are expected to receive document.domain injection. Kept test same by changing URL * run ci * fix: update server test with mssing unupdated assertions * run ci * fix: turn off experimental flag by default while recommending sane defaults to users to configure * run ci * chore: fix typings [run ci] * run ci * chore: make experiment an e2e option only * run ci * chore: address comments in code review * chore: rename experimentalUseDefaultDocumentDomain to experimentalSkipDomainInjection * fix regression in shouldInjectionDocumentDomain utility function and add unit tests * run ci * chore: rename documentSuperDomainIfExists to superDomain [run ci] * chore: address comments from code review * chore: just pass opts through to policyForDomain * run ci Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com>
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 launchpad 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
yarn test-unitexecutes unit tests intest/unityarn test-integrationexecutes integration tests intest/integrationyarn test-performanceexecutes performance tests intest/performance
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,
e2etests have been renamed tosystem-testsand moved to thesystem-testsdirectory.
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
V8 Snapshots
In order to improve start up time, Cypress uses electron mksnapshot for generating v8 snapshots for both development and production.
Cypress code is automatically set up to run using snapshots. If you want to run Cypress in development without the v8 snapshot (for debugging purposes or to see if there's a problem with the snapshot or the code itself) you can set the environment variable DISABLE_SNAPSHOT_REQUIRE to 1 or true.