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

change: [M3-8860] - Update unit testing docs to prefer userEvent over fireEvent #11221

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

mjac0bs
Copy link
Contributor

@mjac0bs mjac0bs commented Nov 6, 2024

Description 📝

Our current unit test example (https://linode.github.io/manager/development-guide/08-testing.html#unit-tests) uses fireEvent, when best practice recommended by React Testing Library is to use userEvent, unless the situation does not allow it.

From the docs:

user-event allows you to describe a user interaction instead of a concrete event. It adds visibility and interactability checks along the way and manipulates the DOM just like a user interaction in the browser would. It factors in that the browser e.g. wouldn't let a user click a hidden element or type in a disabled text box.
This is why you should use user-event to test interaction with your components.

There are, however, some user interactions or aspects of these that aren't yet implemented and thus can't yet be described with user-event. In these cases you can use fireEvent to dispatch the concrete events that your software relies on.

Changes 🔄

  • Updated 08-testing.md

Preview 📷

image

How to test 🧪

Verification steps

(How to verify changes)

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@mjac0bs mjac0bs added the Documentation Improving / adding to our documentation label Nov 6, 2024
@mjac0bs mjac0bs self-assigned this Nov 6, 2024
@mjac0bs mjac0bs requested a review from a team as a code owner November 6, 2024 23:45
@mjac0bs mjac0bs requested review from hana-akamai and coliu-akamai and removed request for a team November 6, 2024 23:45
@mjac0bs mjac0bs changed the title change: [M3 8860] - Update unit testing docs to prefer userEvent over fireEvent change: [M3-8860] - Update unit testing docs to prefer userEvent over fireEvent Nov 6, 2024
Copy link

github-actions bot commented Nov 7, 2024

Coverage Report:
Base Coverage: 87.37%
Current Coverage: 87.38%

@mjac0bs mjac0bs added the Add'tl Approval Needed Waiting on another approval! label Nov 8, 2024
@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 445 passing tests on test run #3 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing445 Passing2 Skipped96m 51s

Copy link
Contributor

@hana-akamai hana-akamai left a comment

Choose a reason for hiding this comment

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

Ran into an issue with running docs locally but turns out it was bc I didn't have bun installed globally. Looks good!

@hana-akamai hana-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! Ready for Review labels Nov 8, 2024
@mjac0bs mjac0bs merged commit 5fc6839 into linode:develop Nov 8, 2024
23 checks passed
Copy link

cypress bot commented Nov 8, 2024

Cloud Manager E2E    Run #6806

Run Properties:  status check passed Passed #6806  •  git commit 5fc68391ab: change: [M3-8860] - Update unit testing docs to prefer `userEvent` over `fireEve...
Project Cloud Manager E2E
Branch Review develop
Run status status check passed Passed #6806
Run duration 30m 02s
Commit git commit 5fc68391ab: change: [M3-8860] - Update unit testing docs to prefer `userEvent` over `fireEve...
Committer Mariah Jacobs
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 7
Tests that did not run due to a developer annotating a test with .skip  Pending 2
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 445
View all changes introduced in this branch ↗︎

santoshp210-akamai added a commit to santoshp210-akamai/manager that referenced this pull request Nov 13, 2024
* feat: [UIE-8194] - DBaaS major and minor upgrades - 4 (linode#11199)

* feat: [M3-8831] - New GPUv2 egress transfer display (linode#11209)

* Add new gpuV2 egress transferlogic

* light cleanup

* adjust e2e s

* Added changeset: New GPUv2 egress transfer helpers

* feedback @coliu-akamai @hkhalil-akamai

* feedback @coliu-akamai @jaalah-akamai

* feedback optimization

* change: [M3-8806] - Disable unsupported images for distributed regions (linode#11206)

## Description 📝
In the Linode Create flow, when a distributed region is selected, images & distros that do not support distributed regions should be disabled

Note: It looks like the distributions are now sorted alphabetically. I don't see any issues with this but just wanted to point that out in case anyone did

## Changes  🔄
List any change relevant to the reviewer.
- Disable unsupported images/distros for distributed regions in Linode Create
- Removed the distributed icon & associated icon text
- Removed the word `currently` in the Add-Ons warning notice for distributed regions
- Added a new generic `ListItemOption` component and refactored `ImageOption`, `PlacementGroupSelectOption`, and `RegionOption` to use new generic component

## Target release date 🗓️
11/12

## How to test 🧪

### Prerequisites
(How to setup test environment)
- Ensure your account has the `new-dc-testing`, `new-dc-testing-gecko`, `edge_testing` and `edge_compute` customer tags

### Verification steps
(How to verify changes)
- Go to the Linode Create page and verify the following on the `OS` tab and `Images` tab:
  - Select a core region -> No Images/distributions should be disabled
  - Select a distributed region -> Images/distributions that do not support distributed regions should be disabled
- There should be no regressions in the components that were refactored
- Ensure unit tests and e2e tests are passing locally/remotely

* fix: [UIE-8246] - DBaaS provisioning 2 node clusters (linode#11218)

* feat : [M3-8528] - Include Object Storage buckets in Support tickets' dropdown (linode#11178)

* feat: [M3-8528] - Include Object Storage in Support Tickets

* query change

* Added changeset: Include Object Storage buckets in Support tickets dropdown

* added link support for object storage

* removed redundant query

* query updation and restructuring request payload

* Added changeset

* Initial Changelog

* refactor: [M3-8646] – Migrate `Divider` to `ui` package  (linode#11205)

* refactor: [M3-8646] – Migrate `Divider` to `ui` package

* Added changeset: Migrate Divider to ui package

* migrating all  imports

* removing redundant hook imports

* updated the import for omittedProps

* UIE-8247: Conditionally give the new docs as the link on database landing page (linode#11227)

* fix: [M3-8764] - Kubernetes UI issues (linode#11217)

* initial clean up

* save progress

* add changeset

* fix type error

* feedback @mjac0bs

* a few more small fixes

* a few more small fixes

---------

Co-authored-by: Banks Nussman <banks@nussman.us>

* upcoming: [DI-21811] - Post processing of missing timestamp data across dimensions in ACLP charts (linode#11225)

* upcoming: [DI-18419] - chart post processing for missing timestamps

* upcoming: [DI-21811] - Code corrections and refactoring

* upcoming: [DI-21811] - Code corrections and refactoring

* upcoming: [DI-21811] - Code corrections and refactoring

* upcoming: [DI-21811] - Added changeset

* upcoming: [DI-21811] - comment updates

* upcoming: [DI-21811] - comment updates

* upcoming: [DI-21811] - comment updates

* upcoming: [DI-21811] - comment updates

* upcoming: [DI-21811] - early returns for empty array

---------

Co-authored-by: vmangalr <vmangalr@akamai.com>

* Update changelog

* refactor: [M3-8650] - Migrate Stack to `@linode/ui` package (linode#11228)

* migrate stack, update organization for divider/icon button

* Added changeset: `Stack` component to `ui` package

* refactor: [M3-8710] - Move `Notice` & `Tooltip` components to UI package and update imports (linode#11174)

* Move Notice to UI package and update imports

* Add test imports

* Add renderWithTheme and other changes to make tests pass

* Fix broken icon imports

* Added changeset: Move `Notice` and `Tooltip` components to UI package

* Feedback @dwiley-akamai: consolidate imports and rename icon exports

* change: [M3-7337] - change Linode Details Summary VPC IPv4 Text to Copy Object. (linode#11172)

* change: [M3-7337] - change Linode Details Summary VPC IPv4 Text to Copy Object.

* Added changeset: change Linode Details Summary VPC IPv4 Text to Copy Object.

* Update changeset description

Co-authored-by: Purvesh Makode <pmakode@akamai.com>

* remove optional chaining

* change Text from "Subnets" to "Subnet"

* remove extra borderTop

* refactor: [M3-7337] - change Linode Details Summary VPC IPv4 Text to Copy Object

* Add descriptive variable name

---------

Co-authored-by: Purvesh Makode <pmakode@akamai.com>

* upcoming: [DI-21814] - ACLP UI - DBaaS instances order by label (linode#11226)

* upcoming: [DI-21814] - DBaaS instances order by label

* upcoming: [DI-21814] - Added changeset

* DI-21814: use map for better readability and optimisations

---------

Co-authored-by: vmangalr <vmangalr@akamai.com>

* UIE-8254: Add tooltip for ipv6 for new db clusters (linode#11231)

* feat: [UIE-8193] - Usable Storage Tooltip for Create/Resize Database table (linode#11232)

* feat: [UIE-8193] - Tooltip for Create/Resize Database table

* feat: [UIE-8193] - Tooltip context for small screens

* feat: [UIE-8193] - Tooltip for Create/Resize Database table (linode#11223)

* feat: [UIE-8193] - Tooltip for Create/Resize Database table

* Added changeset: Tooltip for 'Usable Storage' in Create/Resize Database Table

* feat: [UIE-8193] - Tooltip context for small screens

* DBaaS additions

* GPU egress transfer copy update (linode#11235)

* default behavior when creating new child clusters should match what existed before we enabled IPACL (in other words: disabled by default) (linode#11234)

Co-authored-by: Talmai Oliveira <toliveir@akamai.com>

* Update PULL_REQUEST_TEMPLATE.md (linode#11219)

* change: [M3-8860] - Update unit testing docs to prefer `userEvent` over `fireEvent` (linode#11221)

* Update 08-testing.md for userEvent

* Fix typo

* Address feedback; also further clean up linting issues the doc

* Fix a bad test that was not following good practices

* Added changeset: Update developer docs on unit testing user events

* Update changelog

* Fix LKE create ACL tests (linode#11237)

* feat: [M3-8665] - add option to copy token in LKE details page. (linode#11179)

* feat: [M3-8665] - add option to copy token in LKE details page.

* Added changeset: option to copy token in LKE details page

* Change the "Copy Token" button to use asynchronous functionality

* remove extra styling

* refactor: [M3-8665] - add option to copy token in LKE details page.

* Change cypress test for LKE update spec

* fix: sx styling for Textfield component (linode#11246)

* spread containerProps sx

* spread props.sx as well whoops

* fix: [M3-8894] - Linode Create crash when selected a Linode with a `type` that is `null` (linode#11247)

* don't fetch when `type` is an empty string

* fix and changelog entry

---------

Co-authored-by: Banks Nussman <banks@nussman.us>

* change: [M3-8857] - Update PULL_REQUEST_TEMPLATE (Part 2) (linode#11236)

* Make updates discussed to PR template during retro

* Add changeset

---------

Co-authored-by: corya-akamai <136115382+corya-akamai@users.noreply.github.com>
Co-authored-by: Alban Bailly <130582365+abailly-akamai@users.noreply.github.com>
Co-authored-by: Hana Xu <115299789+hana-akamai@users.noreply.github.com>
Co-authored-by: Harsh Shankar Rao <hrao@akamai.com>
Co-authored-by: Jaalah Ramos <jaalah.ramos@gmail.com>
Co-authored-by: rodonnel-akamai <rodonnel@akamai.com>
Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
Co-authored-by: Banks Nussman <banks@nussman.us>
Co-authored-by: venkatmano-akamai <chk-Venkatesh@outlook.com>
Co-authored-by: vmangalr <vmangalr@akamai.com>
Co-authored-by: Connie Liu <139280159+coliu-akamai@users.noreply.github.com>
Co-authored-by: Hussain Khalil <122488130+hkhalil-akamai@users.noreply.github.com>
Co-authored-by: hasyed-akamai <hasyed@akamai.com>
Co-authored-by: Purvesh Makode <pmakode@akamai.com>
Co-authored-by: ankitaakamai <ankitaan@akamai.com>
Co-authored-by: mpolotsk-akamai <157619599+mpolotsk-akamai@users.noreply.github.com>
Co-authored-by: Talmai Oliveira <to@talm.ai>
Co-authored-by: Talmai Oliveira <toliveir@akamai.com>
Co-authored-by: John Callahan <114753608+jcallahan-akamai@users.noreply.github.com>
Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
Co-authored-by: jdamore-linode <97627410+jdamore-linode@users.noreply.github.com>
Co-authored-by: Hana Xu <hxu@akamai.com>
santoshp210-akamai added a commit to santoshp210-akamai/manager that referenced this pull request Nov 13, 2024
* feat: [UIE-8194] - DBaaS major and minor upgrades - 4 (linode#11199)

* feat: [M3-8831] - New GPUv2 egress transfer display (linode#11209)

* Add new gpuV2 egress transferlogic

* light cleanup

* adjust e2e s

* Added changeset: New GPUv2 egress transfer helpers

* feedback @coliu-akamai @hkhalil-akamai

* feedback @coliu-akamai @jaalah-akamai

* feedback optimization

* change: [M3-8806] - Disable unsupported images for distributed regions (linode#11206)

## Description 📝
In the Linode Create flow, when a distributed region is selected, images & distros that do not support distributed regions should be disabled

Note: It looks like the distributions are now sorted alphabetically. I don't see any issues with this but just wanted to point that out in case anyone did

## Changes  🔄
List any change relevant to the reviewer.
- Disable unsupported images/distros for distributed regions in Linode Create
- Removed the distributed icon & associated icon text
- Removed the word `currently` in the Add-Ons warning notice for distributed regions
- Added a new generic `ListItemOption` component and refactored `ImageOption`, `PlacementGroupSelectOption`, and `RegionOption` to use new generic component

## Target release date 🗓️
11/12

## How to test 🧪

### Prerequisites
(How to setup test environment)
- Ensure your account has the `new-dc-testing`, `new-dc-testing-gecko`, `edge_testing` and `edge_compute` customer tags

### Verification steps
(How to verify changes)
- Go to the Linode Create page and verify the following on the `OS` tab and `Images` tab:
  - Select a core region -> No Images/distributions should be disabled
  - Select a distributed region -> Images/distributions that do not support distributed regions should be disabled
- There should be no regressions in the components that were refactored
- Ensure unit tests and e2e tests are passing locally/remotely

* fix: [UIE-8246] - DBaaS provisioning 2 node clusters (linode#11218)

* feat : [M3-8528] - Include Object Storage buckets in Support tickets' dropdown (linode#11178)

* feat: [M3-8528] - Include Object Storage in Support Tickets

* query change

* Added changeset: Include Object Storage buckets in Support tickets dropdown

* added link support for object storage

* removed redundant query

* query updation and restructuring request payload

* Added changeset

* Initial Changelog

* refactor: [M3-8646] – Migrate `Divider` to `ui` package  (linode#11205)

* refactor: [M3-8646] – Migrate `Divider` to `ui` package

* Added changeset: Migrate Divider to ui package

* migrating all  imports

* removing redundant hook imports

* updated the import for omittedProps

* UIE-8247: Conditionally give the new docs as the link on database landing page (linode#11227)

* fix: [M3-8764] - Kubernetes UI issues (linode#11217)

* initial clean up

* save progress

* add changeset

* fix type error

* feedback @mjac0bs

* a few more small fixes

* a few more small fixes

---------

Co-authored-by: Banks Nussman <banks@nussman.us>

* upcoming: [DI-21811] - Post processing of missing timestamp data across dimensions in ACLP charts (linode#11225)

* upcoming: [DI-18419] - chart post processing for missing timestamps

* upcoming: [DI-21811] - Code corrections and refactoring

* upcoming: [DI-21811] - Code corrections and refactoring

* upcoming: [DI-21811] - Code corrections and refactoring

* upcoming: [DI-21811] - Added changeset

* upcoming: [DI-21811] - comment updates

* upcoming: [DI-21811] - comment updates

* upcoming: [DI-21811] - comment updates

* upcoming: [DI-21811] - comment updates

* upcoming: [DI-21811] - early returns for empty array

---------

Co-authored-by: vmangalr <vmangalr@akamai.com>

* Update changelog

* refactor: [M3-8650] - Migrate Stack to `@linode/ui` package (linode#11228)

* migrate stack, update organization for divider/icon button

* Added changeset: `Stack` component to `ui` package

* refactor: [M3-8710] - Move `Notice` & `Tooltip` components to UI package and update imports (linode#11174)

* Move Notice to UI package and update imports

* Add test imports

* Add renderWithTheme and other changes to make tests pass

* Fix broken icon imports

* Added changeset: Move `Notice` and `Tooltip` components to UI package

* Feedback @dwiley-akamai: consolidate imports and rename icon exports

* change: [M3-7337] - change Linode Details Summary VPC IPv4 Text to Copy Object. (linode#11172)

* change: [M3-7337] - change Linode Details Summary VPC IPv4 Text to Copy Object.

* Added changeset: change Linode Details Summary VPC IPv4 Text to Copy Object.

* Update changeset description

Co-authored-by: Purvesh Makode <pmakode@akamai.com>

* remove optional chaining

* change Text from "Subnets" to "Subnet"

* remove extra borderTop

* refactor: [M3-7337] - change Linode Details Summary VPC IPv4 Text to Copy Object

* Add descriptive variable name

---------

Co-authored-by: Purvesh Makode <pmakode@akamai.com>

* upcoming: [DI-21814] - ACLP UI - DBaaS instances order by label (linode#11226)

* upcoming: [DI-21814] - DBaaS instances order by label

* upcoming: [DI-21814] - Added changeset

* DI-21814: use map for better readability and optimisations

---------

Co-authored-by: vmangalr <vmangalr@akamai.com>

* UIE-8254: Add tooltip for ipv6 for new db clusters (linode#11231)

* feat: [UIE-8193] - Usable Storage Tooltip for Create/Resize Database table (linode#11232)

* feat: [UIE-8193] - Tooltip for Create/Resize Database table

* feat: [UIE-8193] - Tooltip context for small screens

* feat: [UIE-8193] - Tooltip for Create/Resize Database table (linode#11223)

* feat: [UIE-8193] - Tooltip for Create/Resize Database table

* Added changeset: Tooltip for 'Usable Storage' in Create/Resize Database Table

* feat: [UIE-8193] - Tooltip context for small screens

* DBaaS additions

* GPU egress transfer copy update (linode#11235)

* default behavior when creating new child clusters should match what existed before we enabled IPACL (in other words: disabled by default) (linode#11234)

Co-authored-by: Talmai Oliveira <toliveir@akamai.com>

* Update PULL_REQUEST_TEMPLATE.md (linode#11219)

* change: [M3-8860] - Update unit testing docs to prefer `userEvent` over `fireEvent` (linode#11221)

* Update 08-testing.md for userEvent

* Fix typo

* Address feedback; also further clean up linting issues the doc

* Fix a bad test that was not following good practices

* Added changeset: Update developer docs on unit testing user events

* Update changelog

* Fix LKE create ACL tests (linode#11237)

* feat: [M3-8665] - add option to copy token in LKE details page. (linode#11179)

* feat: [M3-8665] - add option to copy token in LKE details page.

* Added changeset: option to copy token in LKE details page

* Change the "Copy Token" button to use asynchronous functionality

* remove extra styling

* refactor: [M3-8665] - add option to copy token in LKE details page.

* Change cypress test for LKE update spec

* fix: sx styling for Textfield component (linode#11246)

* spread containerProps sx

* spread props.sx as well whoops

* fix: [M3-8894] - Linode Create crash when selected a Linode with a `type` that is `null` (linode#11247)

* don't fetch when `type` is an empty string

* fix and changelog entry

---------

Co-authored-by: Banks Nussman <banks@nussman.us>

* change: [M3-8857] - Update PULL_REQUEST_TEMPLATE (Part 2) (linode#11236)

* Make updates discussed to PR template during retro

* Add changeset

* refactor: [M3-8900] - Move `RadioGroup` to `@linode/ui` package (linode#11254)

* Move RadioGroup to ui package

* Added changeset: Move `RadioGroup` from `manager` to `ui` package

---------

Co-authored-by: corya-akamai <136115382+corya-akamai@users.noreply.github.com>
Co-authored-by: Alban Bailly <130582365+abailly-akamai@users.noreply.github.com>
Co-authored-by: Hana Xu <115299789+hana-akamai@users.noreply.github.com>
Co-authored-by: Harsh Shankar Rao <hrao@akamai.com>
Co-authored-by: Jaalah Ramos <jaalah.ramos@gmail.com>
Co-authored-by: rodonnel-akamai <rodonnel@akamai.com>
Co-authored-by: Banks Nussman <115251059+bnussman-akamai@users.noreply.github.com>
Co-authored-by: Banks Nussman <banks@nussman.us>
Co-authored-by: venkatmano-akamai <chk-Venkatesh@outlook.com>
Co-authored-by: vmangalr <vmangalr@akamai.com>
Co-authored-by: Connie Liu <139280159+coliu-akamai@users.noreply.github.com>
Co-authored-by: Hussain Khalil <122488130+hkhalil-akamai@users.noreply.github.com>
Co-authored-by: hasyed-akamai <hasyed@akamai.com>
Co-authored-by: Purvesh Makode <pmakode@akamai.com>
Co-authored-by: ankitaakamai <ankitaan@akamai.com>
Co-authored-by: mpolotsk-akamai <157619599+mpolotsk-akamai@users.noreply.github.com>
Co-authored-by: Talmai Oliveira <to@talm.ai>
Co-authored-by: Talmai Oliveira <toliveir@akamai.com>
Co-authored-by: John Callahan <114753608+jcallahan-akamai@users.noreply.github.com>
Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
Co-authored-by: jdamore-linode <97627410+jdamore-linode@users.noreply.github.com>
Co-authored-by: Hana Xu <hxu@akamai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Approved Multiple approvals and ready to merge! Documentation Improving / adding to our documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants