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: swap the #__cy_root id selector to become data-cy-root for component mounting #20951

Merged
merged 35 commits into from
Apr 13, 2022

Conversation

JessicaSachs
Copy link
Contributor

@JessicaSachs JessicaSachs commented Apr 6, 2022

User facing changelog

For component tests, we're changing the default selector for where the component should attach onto.

Currently: using an ID for the mounting point

The html scaffolded for component testing requires a mounting point. This is currently a ROOT_ID. The downside to having an id is that there can only be one. For users whose stylesheets use a root node with id to segment their global app styles, this means that you'll need to create an inner-div or other DOM fixture so that the stylesheet rules apply.

<div id="__cy_root">
  <!--
    your component here, but unless you refactor your styles...
    it might render in Times New Roman
  -->
</div>

After: using a data-* attribute for the mounting point

Now, we expose a ROOT_SELECTOR which is a data-* attribute and so now the user can assign an id instead of refactoring their stylesheets.

<!-- support/component-index.html -->

<div data-cy-root id="your-app">
  <!-- your component here, but now with your global app styles! -->
</div>

@JessicaSachs JessicaSachs requested review from a team as code owners April 6, 2022 22:27
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 6, 2022

Thanks for taking the time to open a PR!

@JessicaSachs JessicaSachs requested review from jennifer-shehane and removed request for a team April 6, 2022 22:28
@cypress
Copy link

cypress bot commented Apr 6, 2022



Test summary

4336 0 48 0Flakiness 1


Run details

Project cypress
Status Passed
Commit 59eb082
Started Apr 13, 2022 7:56 PM
Ended Apr 13, 2022 8:11 PM
Duration 14:24 💡
OS Linux Debian - 10.10
Browser Electron 94

View run in Cypress Dashboard ➡️


Flakiness

cypress/e2e/commands/net_stubbing.cy.ts Flakiness
1 network stubbing > intercepting request > can delay and throttle a StaticResponse

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@JessicaSachs JessicaSachs marked this pull request as draft April 6, 2022 23:42
@jennifer-shehane jennifer-shehane removed their request for review April 8, 2022 13:05
@lmiller1990 lmiller1990 marked this pull request as ready for review April 13, 2022 04:52
@lmiller1990 lmiller1990 requested a review from tgriesser as a code owner April 13, 2022 04:52
Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

Some tests are skipped for known reasons

Fine with this for now, let's ship it.

…cypress-io/cypress into feat/swap-cy-root-id-for-data-attribute

* 'feat/swap-cy-root-id-for-data-attribute' of github.com:cypress-io/cypress:
  fixing nuxt issue w sys tests
  fix: Doc changes around vue2 (#21066)
@tgriesser tgriesser merged commit 0e7b555 into 10.0-release Apr 13, 2022
@tgriesser tgriesser deleted the feat/swap-cy-root-id-for-data-attribute branch April 13, 2022 20:08
tgriesser added a commit that referenced this pull request Apr 13, 2022
…o/cypress into tgriesser/fix/UNIFY-1206-cloud

* 'tgriesser/fix/UNIFY-1206-cloud' of github.com:cypress-io/cypress:
  feat: swap the #__cy_root id selector to become data-cy-root for component mounting (#20951)
  fix: Doc changes around vue2 (#21066)
  feat: Add vue2 package from npm/vue/v2 branch (#21026)
  fix: add possible frameworks to object API config (#21056)
tgriesser added a commit that referenced this pull request Apr 14, 2022
* 10.0-release: (25 commits)
  fix: stop running spec when switching specs (#21038)
  fix: remove asset size warnings and enable nuxt e2e tests (#21074)
  feat: swap the #__cy_root id selector to become data-cy-root for component mounting (#20951)
  fix: Doc changes around vue2 (#21066)
  feat: Add vue2 package from npm/vue/v2 branch (#21026)
  skip failing test
  fix: add possible frameworks to object API config (#21056)
  fix snapshot spacing
  fix system test
  fix snapshot
  update snapshots
  rename spec files
  rename files
  update snapshots
  release 9.5.4 [skip ci]
  fix(regression): cy.pause() should not be ignored with `cypress run --headed --no-exit` (#20877)
  fix: add missing Cypress.Commands.addAll() types (#20894)
  chore: Don't store video and screenshot artifacts for runs (#20979)
  chore: Update Chrome (beta) to 101.0.4951.26 (#20957)
  chore: remove parallelism from test-binary-against-repo jobs (#21004)
  ...
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.

4 participants