Commit Graph

130 Commits

Author SHA1 Message Date
Chris Breiding
a3d3074e70 chore: remove document.domain usage for cross-origin testing (#24945) 2022-12-02 12:08:12 -05:00
Blue F
8ff38cdb01 feat: Create public Cypress.ensure API for use with custom queries (#24697)
* fix: Improve TypeScript support for custom queries

* Typo fix

* Fix TS more

* Move 'ensures' off of cy and onto Cypress

* Type fixes

* One missed replacement

* Test fixes

* Properly pass in  to ensureRunnable

* Add .eslintignores to quiet down warnings

* Review feedback

* Update cli/types/cypress.d.ts

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

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
2022-11-29 09:34:34 -06:00
mjhenkes
200656b1d2 Merge branch 'develop' into matth/merge-in-develop 2022-11-25 09:06:20 -06:00
Matt Henkes
b04f9a1143 fix: Canceled Intercepted calls will now end a waited on alias (#24709)
* fix: on a canceled request, end waiting on an intercepted alias

* Add tests, fix ts

* skip firefox

* add doc

* try to fix flake

* delay?

* Use http proxy instead of cdp.

* 'fix' safari

* test updates

* PR updates

* test updates
2022-11-25 08:53:40 -06:00
Emily Rohrbough
5f56670051 chore(12): merge in develop (#24783)
Co-authored-by: Ben M <benm@cypress.io>
Co-authored-by: Dariusz Czajkowski <darek@darek.dev>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Adam Stone <adams@cypress.io>
2022-11-23 07:55:29 -06:00
Adam Stone
2166ba0d94 fix: fix windows-lint CI job (#24758) 2022-11-22 14:35:28 -05:00
Emily Rohrbough
79ea453764 chore(v12): merge develop into release/12.0.0 (#24705)
Co-authored-by: amehta265 <65267668+amehta265@users.noreply.github.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: mattvCypress <mattv@cypress.io>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Jordan <jordan@jpdesigning.com>
Co-authored-by: Adam Stone <adams@cypress.io>
2022-11-18 16:02:31 -06:00
Jordan
ed90b14d4f refactor: move linting to each lib to enable caching (#24424) 2022-11-17 17:31:19 +10:00
Chris Breiding
e4be9697bd Merge branch 'develop' into merge-develop-v12-2022-11-14-take-2 2022-11-14 13:57:38 -05:00
Matt Henkes
23299acc88 fix: Disallow same-superdomain-origin cy.origin blocks (#24569)
* fix: throw error if the cy.origin origin is in the same superDomainOrigin as top.

* testing test tweaks

* 'fix' cypress in cypress tests

* Inject cross origin in google subdomains when not same-origin

* style tweaks

* Ensure strict same-origin check works for google.

* test fixes

* we don't need the location object when we just want the href.

* what is in a name?

* Address PR Comments
2022-11-09 08:29:27 -06:00
Bill Glesias
6055af37b0 Merge branch 'develop' of github.com:cypress-io/cypress into release/12.0.0 2022-11-02 10:27:39 -04:00
Bill Glesias
26e5f31b15 chore: only inject when html is going to be rendered (#24414)
* chore: only inject when html is going to be rendered AND if a
content-type exists, make sure it contains html (which is valid for
xhtml and other mime types)

* rename isHTML is isNotJavascript to be a bit more accurate

* chore: remove isNotJavascript function for restContentTypeIsJavascript for experimental ast rewriter
2022-11-01 14:01:59 -04:00
Ryan Manuel
b0c0eaa508 feat: introduce v8 snapshots to improve startup performance (#24295)
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zach Bloomquist <git@chary.us>
Co-authored-by: Tyler Biethman <tbiethman@users.noreply.github.com>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Mark Noonan <mark@cypress.io>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
Co-authored-by: Ben M <benm@cypress.io>
Co-authored-by: Zachary Williams <zachjw34@gmail.com>
Co-authored-by: astone123 <adams@cypress.io>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Emily Rohrbough <emilyrohrbough@yahoo.com>
Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Co-authored-by: Adam Stone <adams@cypress.io>
Co-authored-by: Blue F <blue@cypress.io>
Co-authored-by: GitStart <1501599+gitstart@users.noreply.github.com>
Co-authored-by: Mike Plummer <mike-plummer@users.noreply.github.com>
Co-authored-by: Jordan <jordan@jpdesigning.com>
Co-authored-by: Sam Goodger <turbo@tailz.dev>
Co-authored-by: Colum Ferry <cferry09@gmail.com>
Co-authored-by: Stokes Player <stokes@cypress.io>
Co-authored-by: Vilhelm Melkstam <vilhelm.melkstam@gmail.com>
Co-authored-by: amehta265 <65267668+amehta265@users.noreply.github.com>
2022-10-31 20:20:27 -05:00
Matt Schile
69873ae988 chore: remove experimentalSessionAndOrigin flag (#24340)
BREAKING CHANGE: removed experimentalSessionAndOrigin flag. testIsolation defaults to strict
2022-10-24 08:49:13 -06:00
Chris Breiding
f9272bbd22 fix: Improve document.cookie patch (#23643) 2022-10-18 17:38:56 -04:00
Bill Glesias
695dd275bc feat: same origin spec bridges (#23885)
* chore: enforce strict origin spec bridges

chore: refactor spec bridges to strictly enforce same origin

fix: wrap fullCrossOrigin injection around feature flag inside buffered response

* fix: do NOT set the initial cypress cookie inside the spec bridge as it is sending unecessary cookies

* chore: simplify the finding cypress in the injection code

* chore: change order in which callback fn is declared

* chore: add spec bridge performance issue to validation tests
2022-10-04 18:26:04 -04:00
Bill Glesias
a41b104880 chore: simulated cookie fixes 1 (#24060)
* chore: add documentation to CDP,electron, and web extension for selected resource types

* chore: change nomenclature of X-Cypress-Request to X-Cypress-Is-XHR-Or-Fetch

* chore: remove no longer applicable comment for socket code

* chore: add comments to the resourceType/credential manager
2022-10-03 10:05:34 -04:00
Bill Glesias
11ed9a622b fix: misc review comments (#23971)
* chore: refactor credential manager into its own utility class and add basic unit tests

* chore: add firefox comments into the cookie jar
2022-09-27 17:11:30 -04:00
Bill Glesias
01ea821926 feat: implement simulated top req res middleware (#23888)
* test: add correct cookie_behavior assertions before work on server
(currently failing)

* chore: add types needed in the socket and middlewares

* feat: add socket code to server-base (no tests here) to be used in request/response middleware

* feat: fill out the ExtractCypressMetadataHeaders implementation

* feat: add attach cookie logic to requests based on xhr/fetch requests

* feat: add attaching cookies to response logic w/ tests

* Update packages/proxy/lib/http/request-middleware.ts

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>

Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
2022-09-23 10:04:45 -04:00
Bill Glesias
56b4f894aa chore: add utility functions in proxy to be used in the near future i… (#23880)
* chore: add utility functions in proxy to be used in the near future in the request/response middleware(s)

* fix: add isAUTIframe check inside the shouldAttachAndSetCookies, move the siteContext info to the cookies package, simplify top-simulation util, and add better method documentation
2022-09-22 10:21:13 -04:00
Bill Glesias
252ae5ae67 Merge branch 'develop' of github.com:cypress-io/cypress into feature/simulated-top-cookie-handling 2022-09-21 18:29:21 -04:00
Bill Glesias
18321f80dd chore: refactor originPolicy to use superDomainOrigin nomenclat… (#23879)
* chore: refactor originPolicy to use superDomainOriginPolicy nomenclature and add sameSite/superDomainOrigin policy functions and make originMatch functions match fully same origin policy including sub domains

* chore: change doesAutMatchTopSuperOriginPolicy to doesAUTMatchTopSuperDomainOriginPolicy

* chore: rename originPolicy references to just be origin. Rename superDomainOriginPolicy to superDomainOrigin

* fix: remove duplicate origin keys and add check for remote.origin to return null

* chore: further rename variables to fit origin paradigm

* chore: remove latestActiveSuperDomainOrigin as it is no longer used

* fix: key order in consoleProps yielded test

* remove isAnticipatingCrossOriginResponse as it is no longer available

* chore: update documentation to urlMatchesSameSiteProps to show why the strictPortMatch is an option

* chore: refactor cors package to use a single parse function and update unit tests

* chore: refactor getOrigin to use url origin

* chore: update same-site documentation to now be dependent on cookies

* chore: update same-site policy to be schemeful-same-site policy as we consider protocol mismatches to be not same-site
2022-09-21 18:27:17 -04:00
Bill Glesias
cd2fde9047 fix: misc cy origin cleanup (#23914)
* chore: remove cannot_visit_previous_origin error message as it is no longer used

* fix: wrap MaybeEndRequestWithBufferedResponse fullCrossOrigin check around feature flag
2022-09-21 16:14:19 -04:00
Bill Glesias
fd941023a2 fix: properly replace integrity tags in script resources when experimentalModifyObstructiveThirdPartyCode is true (#23820)
* test: add failing unit test for expected behavior

* fix: add regex to strip out dynamic setAttribute integrity setting when modifyObstructiveThirdPartyCode is enabled

* fix: properly replace integrity tags inside script resources when experimentalModifyObstructiveThirdPartyCode is true

* test: fix regex rewritter to handle a few other cases of rewriting
integrity. Now accurately applies to other broad strokes

* rename html integrity re to general as this replaces both html and javascript integrity tags in certain cases

* chore: rephrase comments in regex rewriter for MO third party code
2022-09-20 16:03:17 -04:00
Bill Glesias
ce1dfc36e9 Merge branch 'develop' into feature/simulated-top-cookie-handling 2022-09-18 23:22:22 -04:00
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
Emily Rohrbough
344ee2145e Merge branch 'develop' into cache-sessions-server 2022-09-15 13:08:47 -05: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
Emily Rohrbough
821150517d Merge branch 'develop' into cache-sessions-server
# Conflicts:
#	packages/app/src/runner/event-manager.ts
#	packages/runner/src/studio/studio-recorder.js
#	packages/types/src/driver.ts
2022-09-14 11:49:59 -05:00
Bill Glesias
b28bbcf56f feat: add MaybeSimulateSecHeaders code to prevent 403 issues with google (#23720) 2022-09-09 16:38:02 -04:00
Bill Glesias
9cdb33b4c6 fix: same site cookie context and duplicate cookies (#23438)
* test: refactor and add tests in the cors package

* fix: add areUrlsSameSite method to cookies package and fix
sameSiteContext calculation method and add tests

* fix: always use Set-Cookie optimistically whether or not we keep track of the cookie or not in the server side cookie jar

* chore: add failing unit tests for postpending cookies

* chore: add tough cookie integration tests to verify we append cookies appropriately to request header Cookie

* fix: do not duplicate cookies in request if existing in the cookie jar. Add additional tests to verify expected behavior

* test: add cookie behavior tests that document current expected behavior vs what spec behavior should/will be

* test: add misc tests that check for cookie order

* chore: update debug logs in request to discern cookies

* test: fix assertions in firefox as same-site cookies are actually set correctly

* fix test incorrect assertions. cookies currently exist in primary that are same-site regardless of browser

* skip SameSite=none test in firefox as we currently low insecure samesite none cookies in firefox

* chore: apply suggestions from code review

* chore: change expects to expect

* chore: add documentation for why we need an additional HTTPS port

* remove X-Set-Cookie fixmes
2022-09-07 23:19:52 -04:00
Emily Rohrbough
835d337103 round 1 2022-08-29 13:31:09 -05:00
Zachary Williams
7ddcc96388 chore: update typescript (#23523)
* chore: update typescript

* use String()

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

* use String()

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

* use String()

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

Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
2022-08-25 09:31:02 +10:00
Zach Bloomquist
9bc3715c05 fix(proxy/prerequests): fix duplicate key behavior, fallthrough (#23227)
Co-authored-by: Blue F <blue@cypress.io>
2022-08-10 19:16:56 +00:00
Matt Schile
45ec63dbcd fix: Remove isAUTFrame qualification from cross origin cookie check (#22963) 2022-07-29 16:22:30 -06:00
Bill Glesias
5ff15046e2 feat: add experimentalModifyObstructiveThirdPartyCode flag for regex rewriter (#22568) 2022-07-22 08:30:20 -06:00
Chris Breiding
5573fe50b0 fix: Make cross-origin document.cookie work (#22594) 2022-06-30 14:03:21 -04:00
Blue F
172c364021 fix: Time out unmatched prerequests in proxy to avoid leaking memory (#22462)
* fix: Time out unmatched prerequests in proxy to avoid leaking memory (and generally improve proxy performance)

* Fix types, whoops

* More type fixes? Plz?

* One more TS attempt.

* Revert GQL changes that break TS

* Revert accidental config change

* Rewrote debug messages for clarity

* One more logging change

* Add test around pre-request garbage collection

* Add test around pre-request garbage collection

* Typo

* Typo again

* Apply suggestions from code review

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

* Apply suggestions from code review

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

* Clean up interval in prerequest tests

Co-authored-by: Emily Rohrbough <emilyrohrbough@users.noreply.github.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
2022-06-23 10:12:49 -07:00
Chris Breiding
a21c942ee4 fix: Improve cross-origin cookie handling (#22320) 2022-06-23 11:00:52 -04:00
kshastri
4319daa7f4 fix: cypress removes custom status text/reason phrase from http response (#22061) 2022-06-16 14:19:05 -04:00
Zach Bloomquist
86b277799d chore(proxy): improve debug log experience (#21489) 2022-05-16 21:35:31 +00:00
Bill Glesias
373ed05298 Merge branch 'develop' into md-10.0-merge 2022-05-02 12:26:58 -04:00
Bill Glesias
bbd9e7f1b2 Merge branch 'develop' into md-10.0-merge 2022-04-29 10:39:54 -04:00
Bill Glesias
bc01e44338 chore: rename multi-domain to origin paradigm (#21231) 2022-04-28 15:19:40 -04:00
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
Matt Schile
d7ce86541d chore: (cross-origin) add support for redirecting back to primary (#21144) 2022-04-20 23:03:08 -06:00
Matt Schile
27e1afbdd7 chore: (multi-domain) renaming flag to experimentalSessionAndOrigin (#21053) 2022-04-13 10:50:17 -06:00
Matt Henkes
25af92134a chore: [Multi-domain] Rename isMultiDomain for the driver and the server (#20947)
* chore: [Multi-domain] Rename isMultiDomain for the driver and the server

* A couple more changes

* Update packages/driver/src/cy/commands/navigation.ts

Co-authored-by: Matt Schile <mschile@gmail.com>

Co-authored-by: Matt Schile <mschile@gmail.com>
2022-04-07 09:22:49 -05:00
Matt Schile
dcbc68b8e7 chore: (multi-domain) updating experimental flag to experimentalLoginFlows (#20942) 2022-04-06 15:08:18 -06:00
Matt Henkes
b65db7b81f chore: [Multi-domain] Rename domain events (#20945)
* chore: [Multi-domain] Rename domain events

* finish index.ts

* missed one!

* rename error message

* Update packages/driver/src/cy/commands/navigation.ts

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

Co-authored-by: Emily Rohrbough  <emilyrohrbough@users.noreply.github.com>
2022-04-06 14:26:10 -05:00