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

Release v1.133.0 - releasestaging #11377

Merged
merged 137 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
cee32ae
feat : [M3-8528] - Include Object Storage buckets in Support tickets'…
harsh-akamai Nov 7, 2024
0da3709
refactor: [M3-8646] – Migrate `Divider` to `ui` package (#11205)
harsh-akamai Nov 7, 2024
4d3157a
UIE-8247: Conditionally give the new docs as the link on database lan…
rodonnel-akamai Nov 7, 2024
129a9da
fix: [M3-8764] - Kubernetes UI issues (#11217)
bnussman-akamai Nov 7, 2024
d4e59f1
refactor: [M3-8650] - Migrate Stack to `@linode/ui` package (#11228)
coliu-akamai Nov 7, 2024
5b05b76
refactor: [M3-8710] - Move `Notice` & `Tooltip` components to UI pack…
hkhalil-akamai Nov 7, 2024
0a2aa32
change: [M3-7337] - change Linode Details Summary VPC IPv4 Text to Co…
hasyed-akamai Nov 8, 2024
27a651c
feat: [UIE-8193] - Tooltip for Create/Resize Database table (#11223)
mpolotsk-akamai Nov 8, 2024
f065afd
Update PULL_REQUEST_TEMPLATE.md (#11219)
jcallahan-akamai Nov 8, 2024
5fc6839
change: [M3-8860] - Update unit testing docs to prefer `userEvent` ov…
mjac0bs Nov 8, 2024
abbedaf
feat: [M3-8665] - add option to copy token in LKE details page. (#11179)
hasyed-akamai Nov 11, 2024
dd212ec
Merge branch 'master' into develop
hana-akamai Nov 12, 2024
3450d7c
change: [M3-8857] - Update PULL_REQUEST_TEMPLATE (Part 2) (#11236)
mjac0bs Nov 12, 2024
292ae6c
refactor: [M3-8900] - Move `RadioGroup` to `@linode/ui` package (#11254)
pmakode-akamai Nov 13, 2024
0f5ae7e
test: [M3-8890] - Fix flaky DBaaS resize test related to recent facto…
jdamore-linode Nov 13, 2024
9209bc2
test: [M3-8430] - Mock disable OBJ Gen 2 flags for existing OBJ Cypre…
coliu-akamai Nov 13, 2024
d52d108
feat: [UIE-8129] - add new user permissions api with prefix (#11146)
aaleksee-akamai Nov 14, 2024
8ee5281
feat: [M3-6941]- Uniform Spacing b/w Resource Link Columns In Empty S…
carrillo-erik Nov 14, 2024
1d0051e
feat: [UIE-8128] - add new account api with (#11181)
aaleksee-akamai Nov 14, 2024
afbd8d9
refactor: [M3-8827] - Migrate `CircleProgress` to `ui` package (#11…
jaalah-akamai Nov 14, 2024
b40d5bd
feat: [M3-8883] - Use our search parser on Images Landing (#11233)
bnussman-akamai Nov 14, 2024
26258af
refactor: [M3-8649] - Move `Radio` to ` at linode/ui` package (#11244)
pmakode-akamai Nov 15, 2024
bd6ddb9
test: [M3-8550] - Add unit tests for EntityHeader component (#11222)
hasyed-akamai Nov 15, 2024
727dc75
upcoming: [DI-20934] - Configurable Max limit on resource selection c…
ankita-akamai Nov 15, 2024
6898013
refactor: [UIE-8245] - DBaaS: Replace Select component with Autocompl…
mpolotsk-akamai Nov 15, 2024
74b934e
test: [DI-21337] - Add Cypress tests to verify ACLP UI's handling of …
agorthi-akamai Nov 15, 2024
8492246
fix: [M3-8904] - Fix Storybook docgen (#11264)
hkhalil-akamai Nov 15, 2024
c452a0e
refactor: [M3-8642] - Migrate `Button` to UI package (#11250)
hkhalil-akamai Nov 15, 2024
715f597
refactor: [M3-8898] - Replace one-off hardcoded color values with col…
pmakode-akamai Nov 18, 2024
6126513
refactor: [M3-8911] - Move `ClickAwayListener` to `at linode/ui` pack…
pmakode-akamai Nov 18, 2024
ef21ecb
refactor: [M3-8645] - Move `Chip` to `ui` package (#11266)
hasyed-akamai Nov 18, 2024
f5beea7
feat: [M3-8682] - Add 'Credit Card Expired' banner (#11240)
harsh-akamai Nov 18, 2024
bea1ccc
fix: [UIE-8259] dbaas summary blank read-only host should be N/A (#11…
smans-akamai Nov 18, 2024
f3a9f37
change: [M3-8533, M3-8761] - Fix firewall rules table and Replace `re…
pmakode-akamai Nov 18, 2024
2572e57
UIE-8261: Update doc links on db landing page empty state (#11262)
rodonnel-akamai Nov 18, 2024
fce1b81
fix: Button import in `CreditCardExpiredBanner.tsx` (#11271)
bnussman-akamai Nov 18, 2024
bb4be03
change: [M3-8817] - Replace PageSize autocomplete with simple select …
abailly-akamai Nov 18, 2024
f73af31
feat: [M3-8833] - Update API types and mock data for VPU plans (#11256)
coliu-akamai Nov 18, 2024
65a19f9
upcoming: [DI-21694] - Added the Create Alert Button and few componen…
santoshp210-akamai Nov 18, 2024
1059742
test: [M3-8919] - Fix Linode migration test failure caused by region …
jdamore-linode Nov 18, 2024
19ddac2
test: Unskip Placement Group navigation test by removing `.only` (#11…
jdamore-linode Nov 18, 2024
be0566c
refactor: [M3-8708] – Migrate `TooltipIcon` to `ui` package (#11269)
dwiley-akamai Nov 18, 2024
4617bfb
upcoming: [DI: 21998] - Added Severity, Region, Engine Option compone…
santoshp210-akamai Nov 19, 2024
c2b296e
upcoming: [DI:21998] - Fixed the ServiceTypeSelect test file and remo…
santoshp210-akamai Nov 19, 2024
a3e9178
upcoming: [DI:21998] - Added changesets
santoshp210-akamai Nov 19, 2024
efc7b22
change: [UIE-8253] - DBaaS GA: UI update, bug fix (#11282)
mpolotsk-akamai Nov 19, 2024
90b860a
upcoming: [DI:21998] - Fixed a typo
santoshp210-akamai Nov 19, 2024
0314dc5
feat: [M3-8837] - Add LKE-E feature flag (#11259)
mjac0bs Nov 19, 2024
c2fbd5a
upcoming: [DI:21998] - Modified the Create Alert test file to reflect…
santoshp210-akamai Nov 19, 2024
c42720b
Merge remote-tracking branch 'origin/master' into develop
hkhalil-akamai Nov 19, 2024
255e3ec
fix: [M3-8924] - Storybook `optimizeDeps` config to improve cold star…
abailly-akamai Nov 19, 2024
b9442d8
fix: [M3-8929] - Unexpected gradient on Linode Detail with VPC interf…
abailly-akamai Nov 19, 2024
426be75
refactor: [M3-8908] - Optimize Events Polling following changes from …
bnussman-akamai Nov 19, 2024
04e528b
upcoming: [DI-21998] - Addressed the review comments
santoshp210-akamai Nov 19, 2024
7e766d5
test: [M3-8930] - Fix StackScript update test failure (#11292)
jdamore-linode Nov 20, 2024
8aa1545
fix: [UIE-8259] dbaas landing paginator disappears when pageSize is l…
smans-akamai Nov 20, 2024
84de904
change: [UIE-8268] dbaas summary add tooltip for ipv6 to read-only ho…
smans-akamai Nov 20, 2024
2533236
upcoming: [DI-21998] - Changed the name of the utility getCreateAlert…
santoshp210-akamai Nov 20, 2024
6c15fbd
upcoming: [DI-21200] - Migration from ChartJS to Recharts in CloudPul…
nikhagra-akamai Nov 20, 2024
b91a446
upcoming: [DI-21998] - Fixed the type in alerts.ts and removed Random
santoshp210-akamai Nov 20, 2024
39f2a18
upcoming: [DI-21998] - Extended the createAlertDefinitionSchema and s…
santoshp210-akamai Nov 20, 2024
260c0b3
feat: [M3-8915] - Improve UI for billing contact info when sensitive …
mjac0bs Nov 20, 2024
18b2bf9
fix: [M3-8787] - Fix Alignment for Backup Label in Add-ons Panel (#11…
carrillo-erik Nov 21, 2024
654d24c
feat: [M3-8741] - Add linter rules for common pr feedback points (#11…
pmakode-akamai Nov 21, 2024
eb4b0e7
test: [M3-8542] - Add unit tests for `CopyableTextField` component (#…
hasyed-akamai Nov 21, 2024
f7a2793
refactor: [M3-8644] - Move `Checkbox` to `linode/ui` package (#11279)
hasyed-akamai Nov 21, 2024
26988f3
refactor: [M3-8910] - Move `H1Header` to `at linode/ui` package (#11283)
pmakode-akamai Nov 21, 2024
d8812c4
fix: [M3-8923] - Fix Account Maintenance Account X-Filter (#11277)
bnussman-akamai Nov 21, 2024
9c92ef8
refactor: [M3-8815] – Migrate `TextField` component to `ui` package (…
dwiley-akamai Nov 21, 2024
7472d8b
feat: [M3-8903] - Improve Image Status Column (#11257)
bnussman-akamai Nov 21, 2024
40b335b
fix: Broken TooltipIcon import (#11305)
bnussman-akamai Nov 21, 2024
dba4bfa
test: [M3-8934] - Fix test failure in `linode-storage.spec.ts` (#11304)
jdamore-linode Nov 21, 2024
c81667d
change: [M3-8916] - Implement Dialogs/Drawers loading patterns (#11273)
abailly-akamai Nov 21, 2024
c59c943
test: [M3-8393] - Cypress test for Account Maintenance CSV downloads …
subsingh-akamai Nov 22, 2024
4b3fe8a
test: [M3-8918] - Cypress test for restricted user Image empty landin…
hasyed-akamai Nov 22, 2024
0cf9941
upcoming: [DI-22040] - Updated ACLP tech docs URL
nikhagra-akamai Nov 14, 2024
75e6041
upcoming: [DI-22040] - Change ACLP url path from /monitor/clodupulse …
nikhagra-akamai Nov 14, 2024
1101687
upcoming: [DI-22040] - Updated default redirecting url to dashboards …
nikhagra-akamai Nov 21, 2024
9b0004a
upcoming: [DI-22040] - Updated default redirecting urls
nikhagra-akamai Nov 21, 2024
f8402e0
upcoming: [DI-22040] - Updated automation tests
nikhagra-akamai Nov 22, 2024
a52c2ba
docs: [M3-8932] - Add Form Validation Best Practices (#11298)
jaalah-akamai Nov 22, 2024
3ca4f1d
upcoming: [M3-8881, M3-8885] - Add and update beta endpoints and quer…
mjac0bs Nov 22, 2024
31960f5
refactor: [M3-8654] - Migrate `Typography` to UI package (#11299)
hkhalil-akamai Nov 22, 2024
2a92113
Merge pull request #11315 from linode/staging
jaalah-akamai Nov 22, 2024
f2653ad
refactor: [M3-8909] - Migrate `EditableText` to `ui` package (#11308)
pmakode-akamai Nov 25, 2024
8dfa25d
upcoming: [DI-21998] - Review changes: changeset naming, changed type…
santoshp210-akamai Nov 25, 2024
86960c1
Merge commit: Latest linode/develop changes
santoshp210-akamai Nov 25, 2024
c42edd0
Merge pull request #11307 from nikhagra-akamai/tech-docs-url
jaalah-akamai Nov 25, 2024
7d562ef
upcoming: [DI-21998] - Separated null as a type from api-v4 and moved…
santoshp210-akamai Nov 25, 2024
d8b7978
Merge pull request #11286 from santoshp210-akamai/feature/create-aler…
jaalah-akamai Nov 25, 2024
064cb34
change: [M3-8874] - Adjust network_in values for distributed plans (#…
hana-akamai Nov 25, 2024
f3439da
feat: [M3-8728] - Add Product Families to Create Menu dropdown (#11260)
hana-akamai Nov 25, 2024
c580bfc
test: Fix `machine-image-upload.spec.ts` test failures (#11319)
bnussman-akamai Nov 25, 2024
23fa3c7
refactor: [M3-8938] - Update `TextField` to not depend on `ramda` (#1…
bnussman-akamai Nov 25, 2024
1b0733f
feat: [M3-8834] - Display new Accelerated plans in Plans Panel (#11287)
coliu-akamai Nov 25, 2024
f16fa7e
fix: [M3-8937] - Content shifting on Linode Details summary graphs (#…
bnussman-akamai Nov 25, 2024
cf84d85
refactor: [M3-8639] - Move `Accordion` to `linode/ui` package (#11316)
hasyed-akamai Nov 26, 2024
8a6d1ca
upcoming: [DI-21118] - Monitor scope as part of PAT token (#11318)
ankita-akamai Nov 26, 2024
640d7a6
change: Update PULL_REQUEST_TEMPLATE (Part 3) (#11325)
mjac0bs Nov 26, 2024
afa6da9
fix: [M3-8872] - Table and Chart Legend Improvements (#11294)
jaalah-akamai Nov 26, 2024
890e90e
test: Attempt to fix DBaaS unit test flake (#11332)
bnussman-akamai Nov 26, 2024
6abe673
test: Fix unit tests depending on formatPercentage to reflect latest …
coliu-akamai Nov 26, 2024
f0fe69e
refactor: [M3-8653] - Migrate `Toggle` component to `linode/ui` packa…
coliu-akamai Nov 26, 2024
6a078a9
fix: [M3-8947] - Remove recently added camelCase rule (#11330)
pmakode-akamai Nov 27, 2024
df45bb2
test: [M3-8835] - Add accelerated plans test case to `plan-selection.…
coliu-akamai Nov 27, 2024
4d59953
upcoming: [DI-21119] - Handle jwe token limit in ACLP UI and Bug fix …
ankita-akamai Nov 27, 2024
1241222
upcoming: [DI-21842] - Fixed recharts issues in Cloudpulse (#11317)
nikhagra-akamai Nov 27, 2024
d495fd7
test: [M3-8836] - Add test to create a mock accelerated Linode (#11327)
coliu-akamai Nov 27, 2024
f690633
feat: [M3-8338] - Placement Groups UI updates during migrations (#11261)
abailly-akamai Nov 27, 2024
0285c7a
upcoming: [DI-21694] - Added Resource Select component to the Create-…
santoshp210-akamai Nov 27, 2024
4f777b9
test: [M3-8547] - Add unit tests for `DocsLink` component (#11336)
hasyed-akamai Nov 28, 2024
8611b57
feat: [M3-8947] - Improve linter rules for naming convention (#11337)
pmakode-akamai Dec 2, 2024
8c11b28
refactor: [M3-8945] - Update `yup` from `0.32.9` to `1.4.0` (#11324)
bnussman-akamai Dec 2, 2024
b39d3e7
change: [UIE-8228] - DBaaS Resize GA: Enable Downsizing, update node …
mpolotsk-akamai Dec 2, 2024
35fffca
upcoming: [M3-8840] - Add Cluster Type selection to LKE Create Cluste…
mjac0bs Dec 2, 2024
5aeb650
refactor: [M3-8709] – Migrate `Autocomplete` (and `List` and `ListIte…
dwiley-akamai Dec 2, 2024
2581eb5
tech-story: [M3-8939] - Get rid of `DrawerContent` (#11338)
abailly-akamai Dec 2, 2024
f45fd17
test: [M3-8546] - Add unit tests for `DialogTitle` component (#11340)
hasyed-akamai Dec 3, 2024
9afb2bc
feat: [UIE-8131] - RBAC-1: Routes, Menu, Feature Flag (#11310)
aaleksee-akamai Dec 3, 2024
8dfa028
test: [M3-6611] - Add new assertions for linode backup tests (#11326)
AzureLatte Dec 3, 2024
dbaa3dd
Master into develop
jaalah Dec 3, 2024
d57c38d
fix: [M3-8958] - LinodeCreate OS Panel fetches region with -1 on page…
abailly-akamai Dec 3, 2024
e86ab3d
build(deps): bump cross-spawn from 6.0.5 to 6.0.6 (#11280)
dependabot[bot] Dec 3, 2024
6be3f6b
refactor: [M3-8899] - Migrate `FormControlLabel` to `ui` package (#11…
pmakode-akamai Dec 4, 2024
c537af2
fix: [M3-7565] - Fix Radio size prop not affecting the radio button's…
zaenab-akamai Dec 4, 2024
50a5f6e
tech-story: [M3-8959] - Bump recharts to ^2.14.1 (#11358)
abailly-akamai Dec 4, 2024
af363a5
feat: [M3-8931] - Add doc link and region availability banner for Acc…
coliu-akamai Dec 4, 2024
6ff1863
change: [M3-8961] - Change Pendo sanitized url path string to match U…
mjac0bs Dec 4, 2024
83a4776
fix: [M3-8966] - Regression with AppBar (#11370)
abailly-akamai Dec 4, 2024
6f6d303
upcoming: [M3-8847] - Update Region Select for LKE-Enterprise (#11348)
hana-akamai Dec 4, 2024
7609507
feat: [M3-8953] - Object Storage Gen2 Updates and Improvements (#11355)
jaalah-akamai Dec 4, 2024
2dc4dc6
fix: [M3-8740] - Convert Object Storage size from `GiB` to `GB` in UI…
hasyed-akamai Dec 5, 2024
259d8cb
Fix region select width (#11374)
abailly-akamai Dec 5, 2024
340f2ee
feat: [UIE-8269], [UIE-8290] - DBaaS: Access Controls text update, fi…
mpolotsk-akamai Dec 5, 2024
062a2c4
Cloud version 1.133.0, API v4 version 0.131.0, Validation version 0.5…
DevDW Dec 5, 2024
9046178
Revised CM and api-v4 changelogs to reflect Accelerated
DevDW Dec 5, 2024
5b73942
Revise api-v4 changelog for IAM entry
DevDW Dec 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
66 changes: 46 additions & 20 deletions docs/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
## Description 📝

Highlight the Pull Request's context and intentions.

## Changes 🔄
List any change relevant to the reviewer.

List any change(s) relevant to the reviewer.

- ...
- ...

## Target release date 🗓️
Please specify a release date to guarantee timely review of this PR. If exact date is not known, please approximate and update it as needed.

Please specify a release date (and environment, if applicable) to guarantee timely review of this PR. If exact date is not known, please approximate and update it as needed.

## Preview 📷

**Include a screenshot or screen recording of the change.**

:lock: Use the [Mask Sensitive Data](https://cloud.linode.com/profile/settings) setting for security.
Expand All @@ -23,38 +28,58 @@ Please specify a release date to guarantee timely review of this PR. If exact da
## How to test 🧪

### Prerequisites

(How to setup test environment)

- ...
- ...

### Reproduction steps

(How to reproduce the issue, if applicable)
- ...
- ...

- [ ] ...
- [ ] ...

### Verification steps

(How to verify changes)
- ...
- ...

## As an Author I have considered 🤔
- [ ] ...
- [ ] ...

<details>
<summary> Author Checklists </summary>

## As an Author, to speed up the review process, I considered 🤔

👀 Doing a self review
❔ Our [contribution guidelines](https://github.com/linode/manager/blob/develop/docs/CONTRIBUTING.md)
🤏 Splitting feature into small PRs
➕ Adding a [changeset](https://github.com/linode/manager/blob/develop/docs/CONTRIBUTING.md#writing-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

*Check all that apply*
<br/>

- [ ] 👀 Doing a self review
- [ ] ❔ Our [contribution guidelines](https://github.com/linode/manager/blob/develop/docs/CONTRIBUTING.md)
- [ ] 🤏 Splitting feature into small PRs
- [ ] ➕ Adding a [changeset](https://github.com/linode/manager/blob/develop/docs/CONTRIBUTING.md#writing-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
- [ ] I have read and considered all applicable items listed above.

## As an Author, before moving this PR from Draft to Open, I confirmed ✅

- [ ] All unit tests are passing
- [ ] TypeScript compilation succeeded without errors
- [ ] Code passes all linting rules

</details>

---

## Commit message and pull request title format standards

> **Note**: Remove this section before opening the pull request
Expand All @@ -63,6 +88,7 @@ Please specify a release date to guarantee timely review of this PR. If exact da
`<commit type>: [JIRA-ticket-number] - <description>`

**Commit Types:**

- `feat`: New feature for the user (not a part of the code, or ci, ...).
- `fix`: Bugfix for the user (not a fix to build something, ...).
- `change`: Modifying an existing visual UI instance. Such as a component or a feature.
Expand Down
2 changes: 1 addition & 1 deletion docs/development-guide/04-component-library.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ We use [Material-UI](https://mui.com/material-ui/getting-started/overview/) as t
All MUI components have abstractions in the Cloud Manager codebase, meaning you will use relative imports to use them instead of importing from MUI directly:

```ts
import { Typography } from "src/components/Typography"; // NOT from '@mui/material/Typography'
import { Typography } from "@linode/ui"; // NOT from '@mui/material/Typography'
```

We do this because it gives us the ability to customize the component and still keep imports consistent. It also gives us flexibility if we ever wanted to change out the underlying component library.
Expand Down
45 changes: 26 additions & 19 deletions docs/development-guide/08-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,38 @@ The unit tests for Cloud Manager are written in Typescript using the [Vitest](ht

To run tests, first build the **api-v4** package:

```
```shell
yarn install:all && yarn workspace @linode/api-v4 build
```

Then you can start the tests:

```
```shell
yarn test
```

Or you can run the tests in watch mode with:

```
```shell
yarn test:watch
```

To run a specific file or files in a directory:

```
```shell
yarn test myFile.test.tsx
yarn test src/some-folder
```

Vitest has built-in pattern matching, so you can also do things like run all tests whose filename contains "Linode" with:

```
```shell
yarn test linode
```

To run a test in debug mode, add a `debugger` breakpoint inside one of the test cases, then run:

```
```shell
yarn workspace linode-manager run test:debug
```

Expand All @@ -64,31 +64,25 @@ describe("My component", () => {
Handling events such as clicks is a little more involved:

```js
import { fireEvent } from "@testing-library/react";
import { userEvent } from '@testing-library/user-event';
import { renderWithTheme } from "src/utilities/testHelpers";
import Component from "./wherever";

const props = { onClick: vi.fn() };

describe("My component", () => {
it("should have some text", () => {
it("should have some text", async () => {
const { getByText } = renderWithTheme(<Component {...props} />);
const button = getByText("Submit");
fireEvent.click(button);
await userEvent.click(button);
expect(props.onClick).toHaveBeenCalled();
});
});
```

If, while using the Testing Library, your tests trigger a warning in the console from React ("Warning: An update to Component inside a test was not wrapped in act(...)"), first check out the library author's [blog post](https://kentcdodds.com/blog/fix-the-not-wrapped-in-act-warning) about this. Depending on your situation, you probably will have to `wait` for something in your test:

```js
import { fireEvent, wait } from '@testing-library/react';
We recommend using `userEvent` rather than `fireEvent` where possible. This is a [React Testing Library best practice](https://testing-library.com/docs/user-event/intro#differences-from-fireevent), because `userEvent` more accurately simulates user interactions in a browser and makes the test more reliable in catching unintended event handler behavior.

...
await wait(() => fireEvent.click(getByText('Delete')));
...
```
If, while using the Testing Library, your tests trigger a warning in the console from React ("Warning: An update to Component inside a test was not wrapped in act(...)"), first check out the library author's [blog post](https://kentcdodds.com/blog/fix-the-not-wrapped-in-act-warning) about this. Depending on your situation, you probably will have to use [`findBy`](https://testing-library.com/docs/dom-testing-library/api-async/#findby-queries) or [`waitFor`](https://testing-library.com/docs/dom-testing-library/api-async/) for something in your test to ensure asynchronous side-effects have completed.

### Mocking

Expand All @@ -108,7 +102,9 @@ vi.mock('@linode/api-v4/lib/kubernetes', async () => {

Some components, such as our ActionMenu, don't lend themselves well to unit testing (they often have complex DOM structures from MUI and it's hard to target). We have mocks for most of these components in a `__mocks__` directory adjacent to their respective components. To make use of these, just tell Vitest to use the mock:

```js
vi.mock('src/components/ActionMenu/ActionMenu');
```

Any `<ActionMenu>`s rendered by the test will be simplified versions that are easier to work with.

Expand Down Expand Up @@ -157,6 +153,7 @@ We use [Cypress](https://cypress.io) for end-to-end testing. Test files are foun
* Select a reasonable expiry time (avoid "Never") and make sure that every permission is set to "Read/Write".
3. Set the `MANAGER_OAUTH` environment variable in your `.env` file using your new personal access token.
* Example of `.env` addition:

```shell
# Manager OAuth token for Cypress tests:
# (The real token will be a 64-digit string of hexadecimals).
Expand All @@ -174,16 +171,19 @@ We use [Cypress](https://cypress.io) for end-to-end testing. Test files are foun
Cloud Manager UI tests can be configured using environment variables, which can be defined in `packages/manager/.env` or specified when running Cypress.

##### Cypress Environment Variables

These environment variables are used by Cypress out-of-the-box to override the default configuration. Cypress exposes many other options that can be configured with environment variables, but the items listed below are particularly relevant for Cloud Manager testing. More information can be found at [docs.cypress.io](https://docs.cypress.io/guides/guides/environment-variables).

| Environment Variable | Description | Example | Default |
|----------------------|--------------------------------------------|----------------------------|-------------------------|
| `CYPRESS_BASE_URL` | URL to Cloud Manager environment for tests | `https://cloud.linode.com` | `http://localhost:3000` |

##### Cloud Manager-specific Environment Variables

These environment variables are specific to Cloud Manager UI tests. They can be distinguished from out-of-the-box Cypress environment variables by their `CY_TEST_` prefix.

###### General

Environment variables related to the general operation of the Cloud Manager Cypress tests.

| Environment Variable | Description | Example | Default |
Expand All @@ -192,6 +192,7 @@ Environment variables related to the general operation of the Cloud Manager Cypr
| `CY_TEST_TAGS` | Query identifying tests that should run by specifying allowed and disallowed tags. | `method:e2e` | Unset; all tests run by default |

###### Overriding Behavior

These environment variables can be used to override some behaviors of Cloud Manager's UI tests. This can be useful when testing Cloud Manager for nonstandard or work-in-progress functionality.

| Environment Variable | Description | Example | Default |
Expand All @@ -200,6 +201,7 @@ These environment variables can be used to override some behaviors of Cloud Mana
| `CY_TEST_FEATURE_FLAGS` | JSON string containing feature flag data | `{}` | Unset; feature flag data is not overridden |

###### Run Splitting

These environment variables facilitate splitting the Cypress run between multiple runners without the use of any third party services. This can be useful for improving Cypress test performance in some circumstances. For additional performance gains, an optional test weights file can be specified using `CY_TEST_SPLIT_RUN_WEIGHTS` (see `CY_TEST_GENWEIGHTS` to generate test weights).

| Environment Variable | Description | Example | Default |
Expand All @@ -210,6 +212,7 @@ These environment variables facilitate splitting the Cypress run between multipl
| `CY_TEST_SPLIT_RUN_WEIGHTS` | Path to test weights file | `./weights.json` | Unset; disabled by default |

###### Development, Logging, and Reporting

Environment variables related to Cypress logging and reporting, as well as report generation.

| Environment Variable | Description | Example | Default |
Expand All @@ -222,6 +225,7 @@ Environment variables related to Cypress logging and reporting, as well as repor
| `CY_TEST_GENWEIGHTS` | Generate and output test weights to the given path | `./weights.json` | Unset; disabled by default |

###### Performance

Environment variables that can be used to improve test performance in some scenarios.

| Environment Variable | Description | Example | Default |
Expand All @@ -233,6 +237,7 @@ Environment variables that can be used to improve test performance in some scena

1. Look here for [Cypress Best Practices](https://docs.cypress.io/guides/references/best-practices)
2. Test Example:

```tsx
/* this test will not pass on cloud manager.
it is only intended to show correct test structure, syntax,
Expand Down Expand Up @@ -293,13 +298,15 @@ Environment variables that can be used to improve test performance in some scena
});
});
```

3. How to use intercepts:

```tsx
// stub response syntax:
cy.intercept('POST', ‘/path’, {response}) or cy.intercept(‘/path’, (req) => { req.reply({response})}).as('something');
// edit and end response syntax:
// edit and end response syntax:
cy.intercept('GET', ‘/path’, (req) => { req.send({edit: something})}).as('something');
// edit request syntax:
// edit request syntax:
cy.intercept('POST', ‘/path’, (req) => { req.body.storyName = 'some name'; req.continue().as('something');

// use alias syntax:
Expand Down
71 changes: 71 additions & 0 deletions docs/development-guide/15-composition.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,74 @@ The Linode Create Page is a good example of a complex form that is built using r
### Uncontrolled Forms
Uncontrolled forms are a type of form that does not have a state for its values. It is often used for simple forms that do not need to be controlled, such as forms with a single input field or call to action.

## Form Validation (React Hook Form)
### Best Practices
1. Keep API validation in `@linode/validation` package
2. Create extended schemas in `@linode/manager` package when you need validation beyond the API contract
3. Use yup.concat() to extend existing schemas
4. Add custom validation logic within the resolver function
5. Include type definitions for form values and context

### Simple Schema Extension
For basic form validation, extend the API schema directly:

```typescript
import { CreateWidgetSchema } from '@linode/validation';
import { object, string } from 'yup';
import { yupResolver } from '@hookform/resolvers/yup';

const extendedSchema = CreateWidgetSchema.concat(
object({
customField: string().required('Required field'),
})
);

const form = useForm({
resolver: yupResolver(extendedSchema)
});
```

### Complex Schema Extensions
You may create a `resolver` function that handles the validation (see: [ManageImageRegionsForm.tsx](https://github.com/linode/manager/blob/develop/packages/manager/src/features/Images/ImagesLanding/ImageRegions/ManageImageRegionsForm.tsx#L189-L213)):

```typescript
// Step 1: Create a Resolver Function
// This function validates your form data against specific requirements

type Resolver<FormData, Context> = (values: FormData, context: Context) => {
errors: Record<string, any>;
values: FormData;
};

// Example resolver that checks if at least one item from a list is selected
const resolver: Resolver<YourFormData, YourContext> = (values, context) => {
// Check if at least one valid option is selected
const hasValidSelection = values.selectedItems.some(
item => context.availableItems.includes(item)
);

if (!hasValidSelection) {
return {
errors: {
selectedItems: {
message: 'Please select at least one valid option',
type: 'validate'
}
},
values
};
}

return { errors: {}, values };
};

// Step 2: Use the Resolver in Your Form
const form = useForm({
resolver,
defaultValues: { selectedItems: [] },
context: { availableItems: ['item1', 'item2'] }
});
```

### Additional Complexity
When working with multiple sequential schemas that require validation, you can create a resolver map and function (see: [LinodeCreate/resolvers.ts](https://github.com/linode/manager/blob/develop/packages/manager/src/features/Linodes/LinodeCreate/resolvers.ts])).
Loading
Loading