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

test(unify): Settings e2e tests #19324

Merged
merged 7 commits into from
Dec 14, 2021
Merged

Conversation

BlueWinds
Copy link
Contributor

User facing changelog

N/A

Additional details

Adds tests around the settings page inside test runner, covering the following functionality:

  • Clicking the 'Settings' icon in the left nav will redirect to 'Settings' page
  • The Settings page displays the header
  • There are sections for 'Local' and 'Project' settings
  • Clicking 'Reconfigure Project' redirect to the Launchpad 'Project Setup' page
  • Clicking 'Local Settings' expands and collapses the local settings section
  • An external editor section displays with a list of IDE's found on your system, the generic finder as well.
  • Clicking 'Project Settings' expands and collapses the project settings section

The following bits are NOT covered:

  • Project ID is displayed with a button to 'Copy', once copied the status shows as 'Copied' - Currently broken in Firefox. so any tests written around this would fail.
  • After copying the projectId, the projectId is in your clipboard - This is currently broken in Firefox
  • Anything to do with Record Keys - Bart is currently looking into some issues here. Branch: feat/runs-errors
  • Anything to do with Spec Patterns - Currently in progress. feat: support specPattern, deprecate integrationFolder and componentFolder #19319

How has the user experience changed?

N/A

PR Tasks

  • Have tests been added/updated?
  • [N/A] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [N/A] Has a PR for user-facing changes been opened in cypress-documentation?
  • [N/A] Have API changes been updated in the type definitions?
  • [N/A] Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 9, 2021

Thanks for taking the time to open a PR!

@BlueWinds BlueWinds changed the title tests: Settings e2e tests test(unify): Settings e2e tests Dec 9, 2021
@BlueWinds BlueWinds marked this pull request as ready for review December 9, 2021 20:43
@cypress
Copy link

cypress bot commented Dec 9, 2021



Test summary

18199 0 218 0Flakiness 1


Run details

Project cypress
Status Passed
Commit 8835664
Started Dec 14, 2021 9:12 PM
Ended Dec 14, 2021 9:24 PM
Duration 11:53 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/commands/net_stubbing_spec.ts Flakiness
1 network stubbing > waiting and aliasing > can timeout waiting on a single request using "alias.request"

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

packages/app/cypress/e2e/integration/settings.spec.ts Outdated Show resolved Hide resolved

cy.get('[data-cy="use-well-known-editor"]').should('not.be.checked')
cy.get('[data-cy="use-custom-editor"]').should('be.checked')
cy.contains('Choose your editor...').click()
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the defaultMessages when we can i.e.

import defaultMessages from '@packages/frontend-shared/src/locales/en-US.json'
cy.contains(defaultMessages.settingsPage.editor.noEditorSelectedPlaceholder).click()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is something I always struggle with when writing tests - it feels strange to be importing values to test against.

On the one hand, there's less duplication of strings, and if the string changes, then we don't have to update the test. We try to avoid embedding strings in code for good reasons, and some of those reasons apply to embedding strings in tests too.

On the other hand, if the string changes... the behavior has changed and wouldn't we want the test to point that out? If I replaced noEditorSelectedPlaceholder with an empty string in the localization, the test would still pass despite not showing what we expected to the user.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a fair point. Plus, it makes the test a bit harder to read since I don't know exactly what DOM element it's trying to find, I either have to wait for the test to run or dig through the json. I think this is a good point to bring up to the team since we aren't consistent either way

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with @BlueWinds - I don't think it makes sense to assert against the same thing we test against. You could changing the string in en-US.json to some random junk and it would still pass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For anyone following along at home, we've started a discussion in Slack about this, currently waiting for Jess to return and give her opinion on the matter before deciding which direction to go.

cy.get('[data-cy="use-well-known-editor"]').should('not.be.checked')
cy.get('[data-cy="use-custom-editor"]').should('be.checked')
cy.contains('Choose your editor...').click()
cy.get('[data-testid="computer"]').click()
Copy link
Contributor

Choose a reason for hiding this comment

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

I started a discussion in Slack regarding the test attributes in use today: data-cy, data-testid, and data-test. There is a desire to standardize on data-cy given that is what is in our wheelhouse and what we recommend to our users.

The biggest hurdle to that is our usage of testing-library's Cypress command extensions, but we could override the attribute they're looking for to data-cy and continue to use the various ByTestId lookups.

@ZachJW34 ZachJW34 merged commit 39641e5 into 10.0-release Dec 14, 2021
@ZachJW34 ZachJW34 deleted the issue-19217-settings-e2e-tests branch December 14, 2021 22:50
tgriesser added a commit that referenced this pull request Dec 16, 2021
…cycle

* 10.0-release:
  build: remove syncRemoteGraphQL from codegen
  chore: fix incorrect type from merge
  build: allow work with local dashboard (#19376)
  chore: Test example recipes against chrome (#19362)
  test(unify): Settings e2e tests (#19324)
  chore(deps): update dependency ssri to 6.0.2 [security] (#19351)
  fix: spec from story generation, add deps for install (#19352)
  chore: Fix server unit tests running on mac by using actual tmp dir (#19350)
  fix: Add more precise types to Cypress.Commands (#19003)
  fix: Do not screenshot or trigger the failed event when tests are skipped (#19331)
  fix (#19262)
  fix: throw when writing to 'read only' properties of `config` (#18896)
  fix: close chrome when closing electron (#19322)
  fix: disable automatic request retries (#19161)
  chore: refactor cy funcs (#19080)
  chore(deps): update dependency @ffmpeg-installer/ffmpeg to v1.1.0 🌟 (#19300)
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.

None yet

4 participants