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

Documentation updates for v12 #4880

Merged
merged 20 commits into from
Dec 5, 2022
Merged

Documentation updates for v12 #4880

merged 20 commits into from
Dec 5, 2022

Conversation

AtofStryker
Copy link
Contributor

@AtofStryker AtofStryker commented Nov 29, 2022

Documentation updates include

  • re-adding and revamping the Web Security Page to reflect cy.origin() and updated work arounds. Also includes snippet on experimentalModifyObstructiveThirdPartyCode
  • Re add trade offs section to include Navigation Rules section that works similar to the explainer in Web Security. Also re adds section about workarounds that includes cypress apis (needs link?)
  • Updates Key differences to use cy.origin() over programmatic login
  • Updates best practices around visiting external sites, recommending only authenticating to sites in which you have absolute control while discouraging use of third party social login.
  • updates error message that allows cross origin visits, but possibly not subsequent commands.

Updates to testing strategies and recipes will come in a different PR

@vercel
Copy link

vercel bot commented Nov 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
cypress-documentation ✅ Ready (Inspect) Visit Preview Dec 2, 2022 at 7:39PM (UTC)

content/guides/references/trade-offs.md Outdated Show resolved Hide resolved
content/guides/references/trade-offs.md Outdated Show resolved Hide resolved

::include{file=partials/single-domain-workaround.md}
<DocsImage src="/img/guides/references/cy-visit-subsequent-commands-timed-out.png" alt="cy.visit() subsequent commands timed out" ></DocsImage>
Copy link
Member

Choose a reason for hiding this comment

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

Won't this be out of date once we update to have a doc link to origin?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so, since it explains why the error happens, which we have done with the visiting behavior in the past

Copy link
Member

Choose a reason for hiding this comment

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

ohh I thought that's what Jennifer was pointing out earlier 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I think you mean the image? yeah that's gonna have to get updated. My bad 😆

Copy link
Member

Choose a reason for hiding this comment

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

oops...yeah! sorry. I couldn't comment on the image. I should have been clearer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image updated in 5ed169d

This is because the commands that were expected to run on the second domain are
actually being run on the first domain.

Without `cy.origin`, you can visit different superdomains in _different_ tests,
Copy link
Contributor

Choose a reason for hiding this comment

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

A lot of the rest of this section seems like general guidance on using cy.origin() and is not necessarily focused on web security. I also noticed that these examples are also in the Trade Offs guide. I feel like we should have a Cross-Origin Testing guide that covers this and link to it from here and from Trade Offs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took a stab at this in b3c5c6d, which pretty much just moves the content from trade-offs to the new cross origin testing guide and links the cross origin testing guide in the web security docs. Some of the limitations are still explained in web security but it removes the examples completely and points to the new guide. what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good!

content/guides/overview/key-differences.md Outdated Show resolved Hide resolved
content/guides/overview/key-differences.md Outdated Show resolved Hide resolved
content/guides/references/best-practices.md Outdated Show resolved Hide resolved
content/guides/references/best-practices.md Outdated Show resolved Hide resolved
content/guides/references/trade-offs.md Outdated Show resolved Hide resolved
content/guides/references/trade-offs.md Outdated Show resolved Hide resolved
content/guides/references/trade-offs.md Outdated Show resolved Hide resolved
content/guides/references/trade-offs.md Outdated Show resolved Hide resolved
content/guides/references/trade-offs.md Outdated Show resolved Hide resolved
@AtofStryker
Copy link
Contributor Author

@chrisbreiding I updated the language around localStorage, sessionStorage, and cookies to be pretty generic in b725472 that just says our APIs are not limited by the same origin restriction. Not sure if we want to add anything else there? I'm going to look into refactoring the origin contents into its own guide

})
})
```

Copy link
Member

Choose a reason for hiding this comment

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

We should move this passing example to be the second example?

The following tests will success without issue because each test visits a unique superdomain:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. I don't think this is a pattern we usually want to encourage, but we want to showcase the exception and let users see if its applicable to their use case or not

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess not so much discourage but just not common I think

Comment on lines 132 to 134
are not shared between them anyways. Cypress does offer APIs around
`localStorage`, `sessionStorage`, and `cookies` that are not limited to this
restriction.
Copy link
Member

Choose a reason for hiding this comment

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

With @chrisbreiding's recent changes we can grab & clear local across domains. is this statement true? Also not sure what addin content is trying to say in relation to other multi-domain test strategies

Copy link
Contributor Author

@AtofStryker AtofStryker Dec 2, 2022

Choose a reason for hiding this comment

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

It should be true because of those changes I believe. It's not really to help a testing strategy but to inform the user its available since we've said it isn't in the past and that precedent has changed

@AtofStryker AtofStryker self-assigned this Dec 5, 2022
@AtofStryker AtofStryker merged commit a43db8c into v12 Dec 5, 2022
@AtofStryker AtofStryker deleted the bill-12-docs branch December 5, 2022 19:41
Copy link
Contributor

@debrisapron debrisapron left a comment

Choose a reason for hiding this comment

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

Added a couple of non-critical suggestions

- [Web Security: Common Workarounds](/guides/guides/web-security#Common-Workarounds)
- [Recipes: Logging In - Single Sign On](/examples/examples/recipes#Logging-In)
- [Guides: Amazon Cognito Authentication](/guides/end-to-end-testing/amazon-cognito-authentication)
- [Guides: Okta Authentication](/guides/end-to-end-testing/okta-authentication)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add Auth0 guide here plz

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep I'll do a follow up to address these comments!


Cypress changes its own host URL to match that of your applications. With the
exception of `cy.origin`, Cypress requires that the URLs navigated to have the
same superdomain for the entirety of a single test.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the word "superdomain" is a new one for a lot of readers so whenever it appears for the first time on a page I would like to see it linked to the explainer you added in cross-origin-testing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

maybe linking /guides/guides/cross-origin-testing#Parts-of-a-URL?

debrisapron pushed a commit that referenced this pull request Dec 6, 2022
* re-add websecurity, links to websecurity, and trade-offs guides

* chore: revamp documentation around web security page

* chore: update same-origin tradeoff to be new navigation rules, including our SD chart, to help paint users a clear picture with cy.origin

* chore: link to the experimental modify obstructive third party code doc in web security from origin

* chore: update Error Messages section to reflect allowing cross origin visiting

* update best practices: visiting external sites

* remove node 12 from installing cypress section

* chore: update key differences to plug session and origin over programmatic login

* chore: update with suggestions from code review

* add okta/amazon guide links in trade-offs and update workarounds

* feat: add cross origin testing guide

* update image for command time out with visit

* chore: readd legacy errors and add a Note section to explain that this is only for cypress v11 and under

* chore: update suggestions from code review

* chore: add suggestions from code review

* fix: fix okta alert banner (needed a new line)

* fix: broken image in error messages

* chore: update error header for on link to address https://github.com/cypress-io/cypress-services/pull/5040#discussion_r1038322783
mjhenkes added a commit that referenced this pull request Dec 6, 2022
* Remove pages and references to functionality obsoleted by multidomain GA

* fix: Explain error thrown when cypress commands in .should() callback (#4755)

* fix: Explain error thrown when cypress commands in .should() callback

* Improve layout of previous changes and provide second example of how to fix

* Update content/api/commands/should.md

Co-authored-by: Rachel <rachel@cypress.io>

* Apply suggestions from code review

Co-authored-by: Zach Bloomquist <git@chary.us>

* Run prettier

* Run prettier again...?

* One more prettier run... :/

Co-authored-by: Rachel <rachel@cypress.io>
Co-authored-by: Zach Bloomquist <git@chary.us>

* docs: removing Cookies.defaults/preserveOnce (#4779)

* docs: remove experimentalSessionAndOrigin (#4807)

* Update cookie commands domain option description (#4861)

* docs: Queries, Detached DOM, and Retry-Ability (#4835)

* First rework of retryability guide

* Update each command's Yields section, and all guides, with information about queries vs commands

* Add Custom Queries page

* Minor formatting tweaks

* Review changes

* Review updates

* Update based on review + last week meetings

* More review updates

* Fix tests

* breaking: drop node 12, 13, 15 and 17 support (#4879)

* Add docs for new local/session storage commands (#4876)

* feat: update okta login guide for realworld app (#4883)

* feat: update okta login guide for realworld app

* chore: make changes to okta to have parity with cognito changes

* chore: address code review comments

* feat: update cognito login guide for realworld app (#4882)

* feat: update cognito login guide for realworld app

* chore: update guide from comments in code review

* properly close alert tag

* Update content/guides/end-to-end-testing/amazon-cognito-authentication.md

* chore: address comments from code review

* fix linting

* v12 Migration Guide (#4862)

Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Blue F <blue@everblue.info>
Co-authored-by: DEBRIS APRON <debrisapron@gmail.com>
Co-authored-by: Ben M <benm@cypress.io>
Closes undefined

* Small update to cy.origin API docs for v12

* Update auth examples for v12 on custom commands page

* 12: update test isolation docs to use true/false instead of on/off (#4890)

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>

* docs: add documentation for experimentalOriginDependencies (#4897)

* Documentation updates for v12 (#4880)

* re-add websecurity, links to websecurity, and trade-offs guides

* chore: revamp documentation around web security page

* chore: update same-origin tradeoff to be new navigation rules, including our SD chart, to help paint users a clear picture with cy.origin

* chore: link to the experimental modify obstructive third party code doc in web security from origin

* chore: update Error Messages section to reflect allowing cross origin visiting

* update best practices: visiting external sites

* remove node 12 from installing cypress section

* chore: update key differences to plug session and origin over programmatic login

* chore: update with suggestions from code review

* add okta/amazon guide links in trade-offs and update workarounds

* feat: add cross origin testing guide

* update image for command time out with visit

* chore: readd legacy errors and add a Note section to explain that this is only for cypress v11 and under

* chore: update suggestions from code review

* chore: add suggestions from code review

* fix: fix okta alert banner (needed a new line)

* fix: broken image in error messages

* chore: update error header for on link to address cypress-io/cypress-services#5040 (comment)

* Update cy.session API docs for v12 (#4851)

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

* Remove pages and references to functionality obsoleted by multidomain GA

* fix: Explain error thrown when cypress commands in .should() callback (#4755)

* fix: Explain error thrown when cypress commands in .should() callback

* Improve layout of previous changes and provide second example of how to fix

* Update content/api/commands/should.md

Co-authored-by: Rachel <rachel@cypress.io>

* Apply suggestions from code review

Co-authored-by: Zach Bloomquist <git@chary.us>

* Run prettier

* Run prettier again...?

* One more prettier run... :/

Co-authored-by: Rachel <rachel@cypress.io>
Co-authored-by: Zach Bloomquist <git@chary.us>

* docs: removing Cookies.defaults/preserveOnce (#4779)

* docs: remove experimentalSessionAndOrigin (#4807)

* Update cookie commands domain option description (#4861)

* docs: Queries, Detached DOM, and Retry-Ability (#4835)

* First rework of retryability guide

* Update each command's Yields section, and all guides, with information about queries vs commands

* Add Custom Queries page

* Minor formatting tweaks

* Review changes

* Review updates

* Update based on review + last week meetings

* More review updates

* Fix tests

* breaking: drop node 12, 13, 15 and 17 support (#4879)

* Add docs for new local/session storage commands (#4876)

* feat: update okta login guide for realworld app (#4883)

* feat: update okta login guide for realworld app

* chore: make changes to okta to have parity with cognito changes

* chore: address code review comments

* feat: update cognito login guide for realworld app (#4882)

* feat: update cognito login guide for realworld app

* chore: update guide from comments in code review

* properly close alert tag

* Update content/guides/end-to-end-testing/amazon-cognito-authentication.md

* chore: address comments from code review

* fix linting

* v12 Migration Guide (#4862)

Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Blue F <blue@everblue.info>
Co-authored-by: DEBRIS APRON <debrisapron@gmail.com>
Co-authored-by: Ben M <benm@cypress.io>
Closes undefined

* 12: update test isolation docs to use true/false instead of on/off (#4890)

Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>

* docs: add documentation for experimentalOriginDependencies (#4897)

* Documentation updates for v12 (#4880)

* re-add websecurity, links to websecurity, and trade-offs guides

* chore: revamp documentation around web security page

* chore: update same-origin tradeoff to be new navigation rules, including our SD chart, to help paint users a clear picture with cy.origin

* chore: link to the experimental modify obstructive third party code doc in web security from origin

* chore: update Error Messages section to reflect allowing cross origin visiting

* update best practices: visiting external sites

* remove node 12 from installing cypress section

* chore: update key differences to plug session and origin over programmatic login

* chore: update with suggestions from code review

* add okta/amazon guide links in trade-offs and update workarounds

* feat: add cross origin testing guide

* update image for command time out with visit

* chore: readd legacy errors and add a Note section to explain that this is only for cypress v11 and under

* chore: update suggestions from code review

* chore: add suggestions from code review

* fix: fix okta alert banner (needed a new line)

* fix: broken image in error messages

* chore: update error header for on link to address cypress-io/cypress-services#5040 (comment)

* Update auth examples for v12 on custom commands page

* Small update to cy.origin API docs for v12

* Update cy.session API docs for v12 (#4851)

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

* chore: address docs feedback post merge (#4899)

* .within() now throws an error if given more than one subject (#4898)

* .within() now throws error when passed more than one subject.

* Add migration guide, update based on reviews

* Update Logging In section of Testing Your App page (#4885)

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

* Update End-to-End Testing -> Auth0 Authentication docs for v12 (#4895)

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

* Cypress.Session Cypress API (#4900)

* docs around Cypress.session api

* data not date

* Update content/api/cypress-api/session.md

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

* Update content/api/cypress-api/session.md

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

* Update content/api/cypress-api/session.md

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

* Update content/api/cypress-api/session.md

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

* fix markdown

* Update content/api/cypress-api/session.md

* Apply suggestions from code review

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

* V12 ChangeLog (#4896)

Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Blue F <blue@everblue.info>
Co-authored-by: DEBRIS APRON <debrisapron@gmail.com>
Co-authored-by: Ben M <benm@cypress.io>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>

Co-authored-by: DEBRIS APRON <debrisapron@gmail.com>
Co-authored-by: Blue F <blue@everblue.info>
Co-authored-by: Rachel <rachel@cypress.io>
Co-authored-by: Zach Bloomquist <git@chary.us>
Co-authored-by: Matt Schile <mschile@cypress.io>
Co-authored-by: Matt Henkes <mjhenkes@gmail.com>
Co-authored-by: Chris Breiding <chrisbreiding@users.noreply.github.com>
Co-authored-by: Bill Glesias <bglesias@gmail.com>
Co-authored-by: Ben M <benm@cypress.io>
Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update Best Practices Update Error Messages Review Web Security Page
6 participants