Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Cross Origin Testing Support #18075

Merged
merged 174 commits into from Apr 25, 2022
Merged

feat: Cross Origin Testing Support #18075

merged 174 commits into from Apr 25, 2022

Conversation

chrisbreiding
Copy link
Contributor

@chrisbreiding chrisbreiding commented Sep 13, 2021

!!! DO NOT SQUASH !!!

User facing changelog

  • Removed experimentalSessionSupport Flag
  • Added experimentalSessionAndOrigin Flag containing:
    • All features from the experimentalSessionSupportFlag
    • A new Cypress command called origin which allows users to run commands within multiple origins from a single test.
    • Cross-domain requests will no longer fail immediately, but instead, time out based on pageLoadTimeout.
    • Tests will no longer wait on page loads before moving on to the next test.

Additional details

This is the feature for multi-domain.. more details coming.

How has the user experience changed?

PR Tasks

chrisbreiding and others added 30 commits May 26, 2021
* add multidomain bundle

* add a spec for manually testing and experimenting with multidomain bundle

* get cy.now('get') functioning

* move majority of multidomain entry point into driver
cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on f164404 Apr 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/linux-x64/feature-multidomain-f1644045fc8d67d4a74f5cfbe49e2fce16cba401/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on f164404 Apr 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/darwin-x64/feature-multidomain-f1644045fc8d67d4a74f5cfbe49e2fce16cba401/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on f164404 Apr 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/win32-x64/feature-multidomain-f1644045fc8d67d4a74f5cfbe49e2fce16cba401/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on 885541e Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/linux-x64/feature-multidomain-885541ea5e736dfd4dac1d3254025b55b367fa3e/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on 885541e Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/darwin-x64/feature-multidomain-885541ea5e736dfd4dac1d3254025b55b367fa3e/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on 885541e Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/win32-x64/feature-multidomain-885541ea5e736dfd4dac1d3254025b55b367fa3e/cypress.tgz

AtofStryker and others added 2 commits Apr 22, 2022
* Empty commit to get a new percy nonce

* Implement snapshots and consoleprops within multi origin

further progress with getters

cleaned up log/snapshot serialization

attempt to pass and hydrate value state of serialized dom elements

temp commit traversal dom

by some stretch of a miracle this is working...

still somehow working

after massive performance issues with full tree serialization, fix here is to just attach values to inputs for reifying on primary

now we are cookin

test WIP

tests WIP

working multi-domain actions snapshots tests

added more tests to verify snapshots

add tests and refactor certain tests to make simpler

added misc snapshot tests

add navigation snapshot placeholder

add network request snapshot tests

add shadow querying snapshot tests

update test names

added snapshot querying spec

added screenshot snapshot test

add spies,clocks, and stubs tests

implement snapshot tests for traversal commands

rename local storeage snapshot tests to fit convention

add viewport snapshot tests

rename snapshot traversal to fit naming convention

add snapshot waiting tests

added window snapshot tests

implement navigation snapshot tests now that sinon proxy issues internal to log are now fixed

refactor multi-domain snapshot tests to leverage utility method over redefining in each spec

* fix lint types issues on serializationKeys

* rename switchToDomain to origin (might help with failing tests... ya know?)

* rename snapshot files to fit origin paradigm and fix misname on primaryDomainCommunicator

* fix .tick() snapshot/consoleProps test (figure out the deal with consoleProps sometimes being a function)

* rename multiDomainCommunicator to origin primaryDomainCommunicator

* don't invoke functions with arguments (we need to be more explicit about the functions we are invoking

* opt for my explicit serialization behavior with functions, never attempt to serialize bluebird promises

* move serialization to folder and change name to index

* refactor log serialization to own file, clean up code and add comments to what is going on in this 'here be dragons' code

* make sure to serialize functions for snapshots

* fix pause snapshot test for multi origin

* refactor postprocess snapshot into own method to handle in final state snapshot processing for cross origin

* update snapshot comments to be more accurate

* fix renamings within tests

* fix path in log.ts serialization

* revert about:blank changes in aut-iframe which was breaking session

* move all log/snapshot serialization magic invokations into the communicator

* update typos and fix namings of preprocess and reify

* further name changes

* fix snapshot generator to always reify snapshot (<body>) over attempting to match in the DOM

* unskip test that was fixed with explicit function serialization for logs

* fix flaky screenshot test that was screensize dependent

* rename a few items in the log serialization file

* clean up snapshot style reification to be more straightforward and remove redundancies

* refactor snapshots code to be more readable

* update reifyDomElement docs to actually explain what hte method does

* fix typos within the log serialization file pertaining to comments

* use Cypress._ over lodash import to reduce spec bundle size

* remove snapshots test folder and migrate tests into commands directory with #consoleProps context blocks for each

* change removeSrcAttributeFromAUTIframe name to removeSrcAttribute as it is implied on the AUT

* update log consoleProps comment to better reflect cross origin nature

* remove skipped consoleProps tests that do not have a command log to test against

* add createSnapshot to internal types (might need more specifics on this)

* refactor multi-domain consoleProp tests to use shouldWithTimeout custom command to avoid setTimeouts on command queue event to make test implementation cleaner

* simplify DOM hydration for input based elements

* update preprocessedHTMLElement type

* clean up some documentation and remove TS ignores. added getStyles to internal-types.

* add comment to aut-iframe on src attr removal for posterity

* reverse snapshot ternary for readability

* add shouldWithTimeout into spec-types and refactor out of internal-types

* add getAll type to cypress spec-types

* compare originPolicy of top and AUT instead of just origin to make snapshots work in subdomains

* add comment to _storeOriginalState for future developers and to add clarity

* add some basic log serialization tests that show full pre/reification of log, as well as state hydration for innerHTML. break out object/array methods from log like serialization into own methods

* update variables to metasyntactic

* add renderProps assertion for cy.request

* apply suggestions from code review to clean up log serializer

* make snapshot serialization more generic and typesafe

* work around firefox 93 issues by unsetting the document in cy state as the document is in a cross origin context in the primary, which means accessing any elements will not work

* clean up code and implement suggestions in code review

* remove crossOriginLog in favor of nullish coalescing if visible on the log is not set

* if get is null, return null for whole snapshot

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on ebaaf18 Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/linux-x64/feature-multidomain-ebaaf18268d861e5f5231e3bae91b412e7886ca6/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on ebaaf18 Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/darwin-x64/feature-multidomain-ebaaf18268d861e5f5231e3bae91b412e7886ca6/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on ebaaf18 Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/win32-x64/feature-multidomain-ebaaf18268d861e5f5231e3bae91b412e7886ca6/cypress.tgz

@chrisbreiding
Copy link
Contributor Author

@chrisbreiding chrisbreiding commented Apr 22, 2022

Fixed the type issue in this merge: 5e71789

* 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 35ccc28.

* 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>
cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on 3e6d6bf Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/linux-x64/feature-multidomain-3e6d6bfe155234f782a890fd904b361c84d5c34e/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on 3e6d6bf Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/darwin-x64/feature-multidomain-3e6d6bfe155234f782a890fd904b361c84d5c34e/cypress.tgz

Co-authored-by: Zach Bloomquist <git@chary.us>
cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on d866746 Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/linux-x64/feature-multidomain-d86674636b93a49a7e2dbbc24bf56666dc7d10b9/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on d866746 Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/darwin-x64/feature-multidomain-d86674636b93a49a7e2dbbc24bf56666dc7d10b9/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on d866746 Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/win32-x64/feature-multidomain-d86674636b93a49a7e2dbbc24bf56666dc7d10b9/cypress.tgz

Copy link
Contributor

@ryanthemanuel ryanthemanuel left a comment

Looks good to me at this point. Nice work all!

@chrisbreiding
Copy link
Contributor Author

@chrisbreiding chrisbreiding commented Apr 22, 2022

FWIW in regards to performance, I ran the cypress-example-kitchensink tests and got the following run times:

  • feature-multidomain branch, flag on: 284.58s
  • feature-multidomain branch, flag off: 273.79s
  • develop branch: 284.60s

I'm working on running the driver tests as well, but those take a lot longer, so I figured I would post what I have so far.

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on b8ae51e Apr 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/linux-x64/feature-multidomain-b8ae51edbcbce77416b42cec620b023e2311b4ca/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on f473d29 Apr 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the linux x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/linux-x64/feature-multidomain-f473d29b2c97eb4e23fcb9f20011bd1e08183088/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on f473d29 Apr 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the darwin x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/darwin-x64/feature-multidomain-f473d29b2c97eb4e23fcb9f20011bd1e08183088/cypress.tgz

cypress-bot[bot]
Copy link

@cypress-bot cypress-bot bot commented on f473d29 Apr 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Circle has built the win32 x64 version of the Test Runner.

Learn more about this pre-release platform-specific build at https://on.cypress.io/installing-cypress#Install-pre-release-version.

Run this command to install the pre-release locally:

npm install https://cdn.cypress.io/beta/npm/9.6.0/win32-x64/feature-multidomain-f473d29b2c97eb4e23fcb9f20011bd1e08183088/cypress.tgz

@mjhenkes mjhenkes merged commit 676fc97 into develop Apr 25, 2022
93 of 94 checks passed
@ganeshac123
Copy link

@ganeshac123 ganeshac123 commented May 23, 2022

@cy-veronica @cypress-app-bot : Code changes of these are available for users in recent version of Cypress app? or how can we clone changes of this release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment