## Description
This PR fixes the test `actionWithTransform.e2e.test.ts`, failing only on CI (not on local builds). I've added some timeout when clearing the text areas; this probably fixes some issues due to debounce time.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7254
GitOrigin-RevId: 98052fa8e4ffd261f1944845d7eef2fcc1c6db37
For context: https://github.com/hasura/graphql-engine-mono/pull/6931
This PR makes some revisions that I had originally intended to be in the code, but due to some mixup, was refactored without discussion. @vijayprasanna13 and I synced up to try and make a decision about how to resolve it, but ultimately wanted to get more eyes on it to weigh in.
For context, when I refer to "premade selectors" I am talking about [this file](8a9264b14c/console/src/features/hasura-metadata-api/selectors.ts (L34))
And when I refer to "utility functions" (or metadata utility functions), I am talking about [this file](8a9264b14c/console/src/features/hasura-metadata-api/utils.ts (L38))
The changes I am suggesting here mostly about maintaining (IMHO) clearer separation of concern for selectors vs utility functions, and improving DX.
Here's how I see it high level:
![flows (light theme)](https://user-images.githubusercontent.com/49927862/204630900-aca2aad1-d760-409d-8ec6-446942b2d6ff.png#gh-light-mode-only)
![flows (dar theme)](https://user-images.githubusercontent.com/173663/204755227-e8850dbf-1012-4c7b-8087-dd6f16e5ca23.jpg#gh-dark-mode-only)
In other words, I want to avoid using pre-made selectors within a custom selector as it creates a pattern of multiple layers of curried functions and beings to (IMHO) look confusing and blur the separation of concern.
What I am proposing is that we have a convention of doing either
1) Developer wants the entire table object of a specific table. They can easily do this using one of the **premade** selectors and pass directly into `useMetdata()`:
```ts
const { isLoading, data: metadataTable } = useMetadata(
MetadataSelectors.findTable(dataSourceName, table)
);
```
2) Developer wants to get a specific piece of information on a specific table. They can leverage the `findMetadataTable()` utility function within a custom inline selector like this and avoid extra currying and double selector confusion:
```ts
const { isLoading, data: savedComment } = useMetadata(
m => MetadataUtils.findMetadataTable(dataSourceName, table, m)?.configuration?.comment
);
```
This is somewhat of a stylistic preference, but also one that I think makes a cleaner separation of concern in the way we are building the api and supportive pieces. In other words, premade selectors are _always_ a selector and not used to compose other selectors. It also makes available utility functions that are easy to pull of the shelf to do common metadata tasks whether in the scope of `useMetadata` or not.
## Simpler Approach?
We could also just go with **Flow # 2** and eliminate the premade selectors. The dev would then pass a custom selector into `useMetadata()` and if they prefer, use a utility function to support their task.
With that aside, whatever the team agrees makes more sense, I will gladly get on board with, but I wanted to make my case here : )
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7095
Co-authored-by: Vijay Prasanna <11921040+vijayprasanna13@users.noreply.github.com>
GitOrigin-RevId: 7ecc2db172def0d2f714cbbb2f95a4b56a528093
## Description 🔖
This PR adds snapshot testing to e2e tests. The goal is to avoid regressions that involve metadata by checking:
- the payload of requests sent
- the metadata after modification (only relevant part of the metadata)
![image](https://user-images.githubusercontent.com/8408875/204244610-4486b689-d220-40ab-bc1d-9c7b1a1b232f.png)
We implemented this feature for one test, `actionWithTransform.e2e.test.ts` but this approach can be potentially used for other tests as well.
## Review checklist. 📋
- [ ] Run e2e tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7058
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: 618147fad3f7d6849a0815b16c077efddef751ca
## Description
This PR fixes the test `actionWithTransform.e2e.test.ts`, failing only on CI (not on local builds). I've added some timeout when clearing the text areas; this probably fixes some issues due to debounce time.
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7109
GitOrigin-RevId: 30efbc32bb804cc11d3e4af0f70b552512c6ded1