* chore: add regression tests for duplicate cookies and bad expiry times * avoid prepending domain with dot for cookies that are set with the server side jar. This is to avoid the cookie being duplicated if it is set or overridden in a different context (request that can actually set the cookie or via document.domain) * feat: use cookie.toString() in the cookie patch to more accurately set cookies on the document, which should include other properties besides key=value * fix: add logic to handle expired cookies in the document.cookie patch, as well as in CDP * chore: build binary for cookie fixes for users to test * chore: change name of fixture to something more accurate * chore: comment why we are using the toughCookie toString method in the patch * [run ci] * chore: add changelog entry * [run ci] * fix: revert back to key=value when getting document.cookie as those are the only values are displayed (oversight on my end) * [run ci] * chore: make compatible with cypress.require * fix: add tests for hostOnly/non hostOnly cookies to make sure property gets sent up to automation client correctly. No longer need custom cookie prop to determine destination * [run ci] * fix: stale unit test * chore: adjust comments * [run ci] * fix: bad domain logic * [run ci] * chore: remove irrelevant comment * [run ci] * fix: adjust cookie login text to spec hostOnly cookie within the cookie patch. This should yield the same behavior as we are bound to same origin within the spec bridge * [run ci] * [run ci] * fix: allow for cookies on request of same key to take precedence over cookies in the jar, regardless of how many hierachy cookies exist in the jar * chore: fix cookie misc tests for cy.origin (dont run cy.origin) * [run ci] * chore: skip misc cookie tests in webkit as headless behavior doesn't clear cookies between tests correctly * Revert "fix: allow for cookies on request of same key to take precedence over cookies in the jar, regardless of how many hierachy cookies exist in the jar" This reverts commit17de1883ab. * [run ci] * chore: split changelog entry into two parts * chore: update logic to remove else statement and add comments * [run ci] * chore: readd windows snapshot branch in workflows * [run ci] * chore: fix workflows from bad merge * [run ci] * Revert "chore: split changelog entry into two parts" This reverts commit4352ef5f3e. * [run ci]
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.