Files
cypress/packages/server
Zach Bloomquist 688b7ea33e feat(webkit): fix multidomain driver tests in WebKit (#23442)
* Initial async changes

* Small fixes and test updates.

* updating tests

* Fixes for cookie login tests

* remove the onlys

* Most tests passing

* Fix driver tests?

* fix firefox test?

* fix unit tests

* fix tests??

* a better check

* fix integration tests

* minor cleanup

* Comment out tyler fix for 10.0 origin issue

* also fix integration tests

* remove fixmes

* Adding Retries for cookie actions. May break other error tests.

* Address (some) PR comments

* factor console logging out of run.ts

* fix print-run

* minimize diff

* chore(server): convert browsers/index to typescript

* fix tests

* update stubbed tests

* convert electron.js to .ts

* Suggestions from code review

* Clean up new type errors

* electron.connectToExisting can be sync

* more type errors for the type god

* Suggestions from code review

* refactor: move more of video capture into browser automations

* unit tests

* refactor: move videoCapture to browsers

* fix snapshots

* update to warn about cross origin command AUT in assertions

* Fix type errors

* fix multi-spec videos?

* webkit video recording works!

* webkit system tests

* skip system-tests that won't be fixed in this PR

~60 tests skipped out of ~99:
* ~6 skipped due to needing multidomain support
* ~8 skipped due to missing before:browser:launch support
* ~22 skipped due to broken stack traces

* fix single-tab mode

* cleanup/api renames

* fix more tests

* minimize diff, fix ff

* fix unit tests

* fix tests

* cleanup

* Move document.cookie patch to injection

* enable ci job

* fix up/add request events to webkit automation

* update undefined message

* doesn't need an underscore

* Adding iframe patching.

* forward errors prior to attaching

* Add error message when using visit to visit a cross origin site with the onLoad or onBeforeLoad options.

* Attempt to fix test errors.

* more fixes, but not all

* use the origin policy

* Fix types

* more fixes

* consider chromeWebSecurity when checking if you can communicate with the AUT

* firefox

* prevent hangs if before unload happens after on load.

* Fix some ToDos

* code cleanup

* remove quotes

* Code review changes

* more cr changes

* fix tests possibly

* Updating cy.origin websocket for webkit connection error

* for realz this time

* temp fix for before:unload/load issue

* roll back change

* Fix some flake

* temporarily comment out autWindow.Error patch

* updating cookies to match develop

* update circle.yml

* commenting out driver-integration-tests-webkit-experimentalSessionAndOrigin

* revert cookie test change

* revert cross origin change

* Fix clear cookie problem

* Try it again

* test cy.origin in webkit

* Skip origin tests when running in webkit

* missed one

* attempt to revert web_security changes

* enable sessions on webkit

* maybe this fixes system tests??

* Update web_security_spec.js

* Update web_security_spec.js

* file cleanup

* Unify socket creation logic

* Address PR Comments

Co-authored-by: mjhenkes <mjhenkes@gmail.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
2022-10-12 16:21:58 -05:00
..
2021-12-07 12:22:15 -06: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 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

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