Commit Graph

1360 Commits

Author SHA1 Message Date
Bill Glesias
0c265638ce feat: add resource type header to CDP, extension, and electron (#23821)
* feat: add X-Cypress-Request header in extension

* feat: add X-Cypress-Request header in CDP

* feat: add X-Cypress-Request header in electron

* feat: add ExtractRequestedWithAndCredentialsIfApplicable middleware stub to remove the newly added x-cypress-request header

* chore: change defaultHeaders variable name to requestModifications to more accurately reflect usage

* chore: condense ExtractIsAUTFrameHeader and ExtractRequestedWithAndCredentialsIfApplicable into ExtractCypressMetadataHeaders middleware

* test: add anti assertion for x-cypress-request and remove setting request verbage (as it does nothing yet)
2022-09-18 22:28:32 -04:00
Matt Henkes
6ee305ba41 feat: Allow cy.visit to visit cross origin sites. (#23297)
* 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

* update to warn about cross origin command AUT in assertions

* Fix type errors

* Move document.cookie patch to injection

* 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

* for realz this time

* roll back change

* Fix some flake

* Fix flakey xhr test hopefully.

* oops, forgot communicator changes. need those.

* modify error message to not lose the original error

* read config right derp

* simpler check

* no unused vars

* don't put config on window

* Make isRunnerAbleToCommunicateWithTheAUT a util function instead of attaching it to cypress.

* fix a race condition maybe

* clear document when window is cross origin... we'll see if this breaks anything.

* Retry if querying against the wrong AUT

* use timeout

* Don't print the retrying string unless you're retrying due to command aut origin mismatch

* try handling undefined document

* Code review updates. What could go wrong??

* Apply suggestions from code review

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* minor fixes

* try aut location and move the async state collection.

* fix flake around the loading message, probably

* Fix system tests and some flake around redirect counts.

* Improve error handler prior to attaching.

* Code review suggestions

* use a generated ID when promisifying post message

* clean up promise helper

* skip xhr test until issue is resolved.

* Apply suggestions from code review

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>

* use state directly

* Apply suggestions from code review

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* Update packages/driver/src/cypress/error_messages.ts

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2022-09-15 12:28:27 -05:00
Zach Bloomquist
566a1a208c feat: gate WebKit behind experimentalWebKitSupport in prod (#23711) 2022-09-13 01:56:13 +00:00
Bill Glesias
afb8e67a0b fix: also set electron user agent through CDP. see #23597 (#23721) 2022-09-09 13:21:43 -04:00
Mike Plummer
9abbbe61af feat: Banner Analytics (#23691)
Co-authored-by: astone123 <adams@cypress.io>
2022-09-08 16:37:09 -05:00
Lachlan Miller
1aa979341a chore: fix test and types in server (#23693)
* update types

* fix test
2022-09-08 12:32:53 +10:00
Emily Rohrbough
38412925ba fix: correct dashboard result when successful spec run and videoUploadOnPasses=false (#23660) 2022-09-07 19:42:34 -05:00
Zach Bloomquist
b5ba6d7b87 chore(webkit): add before:browser:launch and download support (#23662) 2022-09-06 18:19:42 +00:00
Zach Bloomquist
dc9e9dc62c chore(webkit): add video recording (#23579) 2022-09-06 17:12:13 +00:00
Zach Bloomquist
bcd7548d74 refactor: move more of video capture into browser automations (#23587) 2022-08-31 18:55:28 +00:00
Emily Rohrbough
c8b1b30323 fix: run "before:spec" plugin event when experimentalInteractiveRunEvents is enabled (#23634)
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Rachel <Raquel.rudermano@gmail.com>
2022-08-31 13:40:11 -05:00
Lachlan Miller
72b8a65e78 feat: Cypress Studio for Cypress 10 (#23544)
* chore: wire up Cypress Studio  (#23413)

* wip

* wip

* wip - spike

* more wip [skip ci]

* update style

* fix ts

* move types around

* extract types

* lint

* fixing tests

* fix component test

* skip some tests

* do not error on experimentalStudio flag

* add studio controls placeholder

* fixing tests

* revert

* revert changes

* rename store

* rename method

* remove comment

* refactor

* correctly feature flag studio

* simplify code

* simplify code

* lift check into useEventManager

* correctly hide create studio prompt based on flag;

* remove superfulous css

* rename variables

* fix bugs

* wip

* unskip tests

* unskip more tests

* fix a bug in the assertion API

* fix bug in assertions [skip ci]

* wip - bugs [skip ci]

* feat: add experimentalStudio flag back (#23506)

Co-authored-by: astone123 <adams@cypress.io>

* chore: Add Studio UI to Cypress 10 (#23537)

* wip

* wip

* wip - spike

* more wip [skip ci]

* update style

* fix ts

* move types around

* extract types

* lint

* fixing tests

* fix component test

* skip some tests

* do not error on experimentalStudio flag

* add studio controls placeholder

* fixing tests

* revert

* revert changes

* rename store

* rename method

* remove comment

* refactor

* correctly feature flag studio

* chore: wip add barebones studio modals

* simplify code

* simplify code

* lift check into useEventManager

* correctly hide create studio prompt based on flag;

* remove superfulous css

* chore: style studio toolbar

* chore: misc feedback

* chore: remove studio store prop

* chore: studio URL prompt and other changes

* update component

* chore: UI styling and remove studio init modal

* chore: revert unnecessary changes

* chore: fix types

* chore: fix some tests, minor refactor (#23545)

* fix test

* fix test

* add noHelp link to StandardModal

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>

* test: studio e2e tests (#23546)

* add basic e2e test

* add some e2e tests for studio and a note on limitations

* additional spec

* add more tests, refactor helper

* fix bug in studio

* remove test code

* chore: UI feedback

* fix race condition

* update tests

* rename test

* improve types in reporter

* remove dead code

* improve tests

* merge tests into one spec

* chore: Cap instruction modal width; exit studio mode when new spec is chosen

* chore: Only render studio error when test has failed; add test for studioEnabled

* correctly check if command is studio or not

* improve specs and hopefully reduce flake

* communicate studio state from app->reporter

* receive studio save state validity from app

* fix test

* improve test coverage

* fix external link

Co-authored-by: astone123 <adams@cypress.io>
2022-08-30 07:45:06 +10:00
Zach Bloomquist
3c2fea216b chore(server): convert remaining browsers code to typescript (#23556) 2022-08-29 19:47:05 +00:00
Zach Bloomquist
4871ebc333 refactor: move console logging out of run.ts (#23555) 2022-08-29 19:05:58 +00:00
Emily Rohrbough
2324d703c2 chore(server): remove redundant supportFile check (#23543)
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
2022-08-29 10:21:58 -05:00
Emily Rohrbough
b08bc270e9 chore: remove dead code -- lives in data-context/src/sources/HtmlDataSource.ts now (#23542) 2022-08-29 12:15:05 +10:00
Zach Bloomquist
bd0d38f352 chore(server): convert modes/run to typescript (#23536)
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-08-25 17:20:53 +00:00
Tyler Biethman
2fcecbf43e chore(webkit): driver updates for clicking/typing actions and related tests (#23522)
* detect playwright-webkit browser

* fix: use stdio for CDP instead of TCP (#14348)

* wip: begin launchin webkit

* run mode works w webkit in 10.0

* reset previous cdp changes

* run driver webkit tests

* always detect webkit in non-prod

* fix version detection

* actually run new job

* cleanup

* fix run

* try caching pw binary

* npx install pw binary

* install-deps

* add experimentalSessionAndOrigin wk tests

* wk experimentalSessionAndOrigin tests

* browser icon

* fix some tests

* reset browsers.ts change

* fix more tests

* fix even more tests, skip driver CI for now

* comma

* fix server-unit-test

* fix websockets_spec

* refactor wkautomation to initialize self from static async method

* fix(proxy/prerequests): fix duplicate key behavior, fallthrough

* Apply suggestions from code review

Co-authored-by: Blue F <blue@cypress.io>

* simpler name for StackMap

* fix proxy-logging spec, some xhr specs

* fix last xhr test

* update testConfigOverrides

* skip webcam.cy.js

* reenable driver tests

* ci?

* Suggestions from code review

* skip remaining failures which won't be fixed here

* fix/skip a couple tests

* fix tests

* skip crashy specs

* skip hidden suites

* Scoping down range of skipped type tests

* Scoping down click test skips

* Updating webkit contenteditable selection handling and associated test

* Adding additional mouse event filtering when disabled. Validated by opening playwright-webkit outside of cypress and validating logged events when enabled/disabled.

* Updating click 'mouseout coords' tests to account for default style changes

* Updating a few more click 'mouse state' tests

* Getting all click tests passing with no webkit skips. Fixing _most_ type tests, selection focus is troublesome.

* Updating cross-origin type action test

* Tweaking coords for CI rendering

* Adding workaround for webkit default input selection.

* Webkit -> WebKit

* Adding logic and test for handling capture-phase focus event selections

* Type errors tests now passing

* Adding a couple more WebKit keyboard/mouse tweaks

* Couple more tweaks for special_chars tests.

* Updating contenteditable beforeinput event tests

* Making WebKit checks more consistent

* Don't expose webkit in public types

* Adding comments and doing a little cleanup

* PR updates

* Simplifying workaround for webkit focus selection

* Removing unnecessary test

* Revert "Removing unnecessary test"

This reverts commit 2c522935ec.

* Revert "Simplifying workaround for webkit focus selection"

This reverts commit 47d1155219.

* Removing comment that is no longer applicable

* Simplifying selection logic that is now functional for all supported browsers

Co-authored-by: Zach Bloomquist <git@chary.us>
Co-authored-by: Zach Bloomquist <github@chary.us>
Co-authored-by: Blue F <blue@cypress.io>
2022-08-25 09:22:47 -05:00
Jaime Pericas
47d86556bd fix: adds GITHUB_RUN_ATTEMPT counter for tracking retries 2022-08-18 15:34:56 -07:00
Zach Bloomquist
272438977e chore(webkit): fix WebKit network-related driver tests (#23232)
Co-authored-by: Blue F <blue@cypress.io>
2022-08-18 16:43:05 +00:00
Kukhyeon Heo
a27affe447 chore: refactor server/lib/config.ts to pkg/config (#22530)
Co-authored-by: Rachel <rachel@cypress.io>
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: Rachel <Raquel.rudermano@gmail.com>
2022-08-17 10:54:02 -07:00
Mike Plummer
741254803f feat: ACI Notification Banners (#23256) 2022-08-16 17:05:09 -05:00
Lachlan Miller
91beb9012c feat: experimental single tab run mode for component testing (#23104)
* revive logic to run CT in a single tab

* add feature flag: experimentalSingleTabRunMode

* remove log

* reset browser state between tests

* document single tab run mode experiment;

* add system test for experimental run mode

* fix snapshots

* use more simple project for testing

* additional guard;

* fix test

* Apply suggestions from code review

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>

* destroy aut after each spec

* update snapshot

* fix types

* add experiment flag error

* add warning when using experimental flag with e2e

* build binaries for experimentalSingleTabRunMode feature

* build binaries take 2

* make error message more open ended

* destroy AUT later in run mode lifecycle

* add additional assertion around experimental flag

* simplify error

* remove test code from production code

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-08-16 10:44:14 +10:00
mirobo
f7dce39876 fix: escape backslashes in downloadFolder for Firefox on Windows #17896 (#23006)
* fix: escape backslashes in downloadFolder for Firefox on Windows

* fix import of doubleEscape in packages/server/lib/browsers/firefox.ts

Co-authored-by: Bill Glesias <bglesias@gmail.com>

* don't run ls command on Windows

* Revert "don't run ls command on Windows"

This reverts commit deec721b06.

* chore: add unit test to verify double escape behavior

Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Rachel <rachel@cypress.io>
2022-08-15 20:26:54 -04:00
Zach Bloomquist
4580330763 chore: WebKit support (development-only) (#15533) 2022-08-15 22:53:37 +00:00
Kukhyeon Heo
0aa89fa5b3 chore: add check-ts command to pkg/driver (#22912)
Co-authored-by: Blue F <blue@everblue.info>
Co-authored-by: Rachel <Raquel.rudermano@gmail.com>
Co-authored-by: Rachel <rachel@cypress.io>
2022-08-15 09:46:24 -05:00
Emily Rohrbough
f1122fcf62 fix: clear session state when changing specs in open mode (#23146) 2022-08-12 13:00:01 -05:00
Emily Rohrbough
0729a6833b feat: add testIsolation option and support describe-only overrides (#23040)
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2022-08-12 11:56:39 -05:00
Kukhyeon Heo
2d119ad46a chore: Intregrate runner packages. (#23028)
* chore: Intregrate runner packages.

* Remove unnecessary Studio react files.

* Remove unnecessary gif

* runner-shared to runner-ct.

* fix path.

* fix package.json

* Remove scss files from runner-ct

* Remove runner-ct

* Remove runner-shared and runner-ct comments.

* Feedback

* chore: reduce parallelism for reporter-componen-tests

* chore: reduce paralelleism

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
2022-08-11 14:07:10 +10:00
Emily Rohrbough
0129a80883 fix: cypress hang caused in run mode when test:before:run handler throws (#23226)
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2022-08-10 14:53:05 -05:00
Mark Noonan
3d98f98136 fix: save spec filter term (#22755) 2022-08-09 12:44:35 -04:00
Eiríkur Fannar Torfason
d65e2d2fab fix: Infinite recursion when identical intercept routes exist (#22940)
* Minimal fix, hacky repro

* Convert getRouteForRequest into a generator function

* Create separate test for reproducing the original issue

* Remove TODO, check .done property instead of .value

* Improve readability

Co-authored-by: Eiríkur Fannar Torfason <eirikur.torfason@gmail.com>
Co-authored-by: Tyler Biethman <tbiethman@users.noreply.github.com>
2022-08-05 12:59:15 -05:00
Bill Glesias
3a78e1f570 chore: add experimentalModifyObstructiveThirdPartyCode documentation to settings page and experiments (#23088) 2022-08-04 10:39:31 -04:00
Emily Rohrbough
17fd75f04b chore: clean up the globbing for supportFile(s) on test start (#22903) 2022-08-02 19:21:57 -05:00
Bill Glesias
2612219501 feat: add modify obstructive user agent code for electron to strip el… (#22958)
* feat: add modify obstructive user agent code for electron to strip electron and cypress out of the UA string.

* fix user agent destructuring error within unit tests

* remove explicit CDP command and opt for _setUserAgent. add test to not override passed in user agent via config

* add get user agent method to electron and update tests

* move user agent override in electron under experimentalModifyObstructiveThirdPartyCode over experimentalSessionAndOrigin

* move position of setting user agent to browser launch, hopefully fixing issues in CI with parallelization between parent/child processes

* update stale documentation and remove no longer necessary stub of getUserAgent

* add user agent to get user agent debug log

Co-authored-by: Matt Schile <mschile@gmail.com>
2022-07-29 22:46:27 -04:00
Matt Henkes
f147ebbcc6 fix: call screencastOpts as a function for starting a screencast on electron. (#23001)
Co-authored-by: Mark Noonan <mark@cypress.io>
2022-07-29 08:27:00 -05:00
Emily Rohrbough
85ee714217 chore(server): clean up server code (#23002)
* remove dead code

* looking a little closer, runAllSpecsInSameBrowserSession is not used and default browser was already set to electron
2022-07-29 16:30:40 +10:00
Emily Rohrbough
65d29cdcf3 chore: remove dead server code (#22902) 2022-07-25 10:29:14 -05:00
Hugo Alliaume
f512f75ceb fix(config): allow "additionalIgnorePattern" to be an array of strings (#22826)
* fix(config): allow "additionalIgnorePattern" to be an array of string

Also set default value to "[]", to prevent issue when running E2E tests.

* chore(test): set "additionalIgnorePattern: undefined" for Cypress-in-Cypress config

* chore: update snapshots

* chore: update types for additionalIgnorePattern

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
2022-07-21 11:19:06 +10:00
mirobo
9517b60e9d fix: don't cut off a long runUrl in console (#22619)
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Ben M <benm@cypress.io>
Co-authored-by: Adam Stone <adams@cypress.io>
2022-07-19 15:04:56 -04:00
Adam Stone
1b688694fe fix: Ensure that file watchers are closed before Electron exits (#22606)
* Adding prototype before-quit handler to handle async teardown.

* Getting binary builds

* Let's try this then

* Working the async changes backwards, hope I got them all. Unit tests will be a disaster currently.

* Actually getting build artifacts for testing

* Moving logic to server interactive/run

* fix: Fix some tests

* fix: Revert changes to circle config

* fix: Fix some tests

* fix: Fix more tests

* fix: Remove dead code comment

* fix: Fix ProjectDataSource tests

* fix: Add comment prefix

* fix: Remove comment and unnecessary async

* fix: Build Mac binary

* Reverting run changes

* Addressing PR comments. Cleaning up a few naming quibbles I had.

* Addressing TODO regarding onLoadError watcher cleanup.

* Correcting catch

* Fighting some unref errors on these catches

* Reverting making this private en lieu of binding

* Should have left these as instances, whoops

* Removing unnecessary test that was previously skipped

* Adding a couple cheap unit tests for the new interactive mode behavior

Co-authored-by: Tyler Biethman <tbiethman@gmail.com>
Co-authored-by: Tyler Biethman <tbiethman@users.noreply.github.com>
2022-07-17 15:57:10 -05:00
Puranjay Jain
198b28d1d7 fix: for hosts typing in cypress.d.ts (#22718)
* Update cypress.d.ts

Fix the hosts typing in cypress typings file

* fix: Add ts type for hosts in a server base file
2022-07-14 22:30:55 -07:00
Chris Breiding
5573fe50b0 fix: Make cross-origin document.cookie work (#22594) 2022-06-30 14:03:21 -04:00
Muaz Othman
4726ea90a9 feat: Display Cypress Dashboard metrics in the Specs Explorer (#21250)
Co-authored-by: Muaz Othman <muazweb@gmail.com>
Co-authored-by: Tim Griesser <tgriesser10@gmail.com>
Co-authored-by: Mike Plummer <mikep@cypress.io>
Co-authored-by: Peter Stakoun <peter@stakoun.com>
Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
2022-06-27 17:37:36 -05:00
Dylan Schlabach
75a5daf9d5 fix: memory leak caused by storing base64 encoded files recieved by CDP Network.requestWillBeSent (#22460)
* filtering out data urls from networkRequestWillBeSent CDP requests

* fix: memory leak caused by storing base64 encoded files recieved by CDP Network.requestWillBeSent

* Update packages/server/lib/browsers/cdp_automation.ts

grammar :)

Co-authored-by: Sam Tsai <samtsai@gmail.com>

* Update packages/server/lib/browsers/cdp_automation.ts

grammar :)

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>

* added unit tests

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
Co-authored-by: Sam Tsai <samtsai@gmail.com>
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-06-23 09:35:49 -07:00
Chris Breiding
a21c942ee4 fix: Improve cross-origin cookie handling (#22320) 2022-06-23 11:00:52 -04:00
Tyler Biethman
defde91f2a fix: process_profiler follow up work for v10 (#22363)
* fix: process_profiler follow up work for v10

* Converting index file to ts
2022-06-22 11:44:58 -05:00
Zach Bloomquist
d01932bf75 fix: retry on EMFILE always, lint sync FS calls (#22175)
* fix: use graceful-fs always, warn in development on sync calls

* skip prop linting in some dirs

* eslint rules

* use AST-based lint rule instead

* comment

* ignore existsSync

* run without nextTick

* remove dev warning code

* fix order

* register TS first

* fix tests

* fix test

* cover new call site

* fix new test
2022-06-16 14:35:31 +10:00
Tyler Biethman
f8f2418a07 fix: Don't include project path with supportFile glob (#22222)
* fix: Don't glob project path in supportFile lookup

* Updating unit tests around supportFile 'isFolder'

* Adding unit test to validate the projectRoot isn't globbed

* Adding system test to validate successful run

* This is more accurate

* Updating snapshot to reflect now missing absolute path from the supportFile value

* Adding e2 launchpad test

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2022-06-10 10:50:53 -05:00
Ryan Manuel
203758f708 fix: properly run multiple specs in run and headed mode on linux and windows in chrome (#22168)
* fix: properly run multiple specs in run and headed mode on linux and windows

* fix: properly run multiple specs in run and headed mode on linux and windows

* Update test

* Update test

* Fix issue with running headed in linux and windows

* Improve test

* Update packages/server/lib/browsers/browser-cri-client.ts

* PR comments

* PR comments

* Fix test failure due to refactor

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2022-06-10 09:38:06 -05:00