Skip to content

Commit

Permalink
frontend: apply prettier
Browse files Browse the repository at this point in the history
PR-URL: hasura/graphql-engine-mono#7668
GitOrigin-RevId: 0ed901780092994ae40c2c57557c5854812a91b2
  • Loading branch information
beaussan authored and hasura-bot committed Jan 25, 2023
1 parent 221af57 commit 09c9cf8
Show file tree
Hide file tree
Showing 205 changed files with 9,502 additions and 8,807 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
11a454c2d69bb05c3471be0d04d2282cc93a557e # reformat with Ormolu
342391f39dd68dd7922ef29215e150dca7811975 # reformat with Ormolu v0.5.0.1
fb19d80e16092186c6aa61bf90b3d1a55644a5a7 # Prettier reformat
3 changes: 3 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ Thumbs.db

# Env
.env

# This is a snapshot generated during npm install, but not needed
/snapshots.js
4 changes: 4 additions & 0 deletions frontend/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
/dist
/coverage
/docs
/apps/console-ce/src/assets/
/apps/console-ee/src/assets/
/apps/console-ce-e2e/**/snapshots.js
/snapshots.js
1 change: 0 additions & 1 deletion frontend/.vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"eslint.validate": ["json"],
"cSpell.words": ["clsx"],
"tailwindCSS.experimental.classRegex": [

"tw\\w+ ?= ?`([^`]*)`",
"tw\\w+: ?`([^`]*)`"
],
Expand Down
3 changes: 1 addition & 2 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ Visit the [Nx Documentation](https://nx.dev) to learn more about it.

This `frontend` monorepo contains the Hasura Console, in all the possible modes.


*Last import [2023-01-12](https://github.com/hasura/graphql-engine-mono/tree/a8cbb297437e4c2d9ba4cab5da1e464d4eac43e4)*
_Last import [2023-01-12](https://github.com/hasura/graphql-engine-mono/tree/a8cbb297437e4c2d9ba4cab5da1e464d4eac43e4)_

## Nx Console

Expand Down
1 change: 1 addition & 0 deletions frontend/apps/console-ce-e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Test

## Useful resources

- [Cypress Dashboard for the Console project](https://dashboard.cypress.io/projects/5yiuic)

## Running all tests to generate coverage
Expand Down
4 changes: 2 additions & 2 deletions frontend/apps/console-ce-e2e/src/e2e/_onboarding/snapshots.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
"__version": "10.4.0"
}
__version: '10.4.0',
};
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
"__version": "10.4.0"
}
__version: '10.4.0',
};
Original file line number Diff line number Diff line change
Expand Up @@ -37,71 +37,71 @@
* @see https://github.com/bahmutov/cypress-network-idle
*/

import 'cypress-wait-until';

export function waitForPostCreationRequests() {
let waitCompleted = false;

cy.log('*--- All requests must be settled*');

const pendingRequests = new Map();
cy.intercept('POST', 'http://localhost:8080/v1/metadata', req => {
if (waitCompleted) return;

Cypress.log({ message: '*--- Request pending*' });

pendingRequests.set(req, true);

req.continue(() => {
Cypress.log({ message: '*--- Request settled*' });

pendingRequests.delete(req);
});
});

Cypress.log({ message: '*--- Waiting for the first request to start*' });

// Check if at least one request has been caught. This check must protect from the following case
//
// check requests start test failure, the requests got the UI re-rendered
// | | |
// |--🚦🔴----⚠️---🚦🟢-------1-2-3-4-5-6-7-1----------💥
//
// where checking that "there are no pending requests" falls in the false positive case where
// there are no pending requests because no one started at all.
//
// The check runs every millisecond to be 100% sure that no request can escape (ex. because of a
// super fast server). A false-negative case represented here
//
// requests start requests end check check test failure, no first request caught
// | | | | | | |
// |--🚦🔴--1-2-3-4-5-6-7-1-2-3-4-5-6-7--⚠️------------------⚠️------------------💥
cy.waitUntil(() => pendingRequests.size > 0, {
timeout: 5000, // 5 seconds is the default Cypress wait for a request to start
interval: 1,
errorMsg: 'No first request caught',
});

Cypress.log({ message: '*--- Waiting for all the requests to start*' });

// Let pass some time to collect all the requests. Otherwise, it could detect that the first
// request complete and go on with the test, even if another one will be performed in a while.
//
// This fixed wait protects from the following timeline
//
// 1st request start first request end other requests start test failure, the requests got the UI re-rendered
// | | | |
// |--🚦🔴---1---------------------1----🚦🟢----------------2-3-4-5-6-7-1----------💥
//
// Obviously, it is an empiric waiting, that also slows down the test.
cy.wait(500);

Cypress.log({ message: '*--- Waiting for all the requests to be settled*' });

cy.waitUntil(() => pendingRequests.size === 0, {
timeout: 30000, // 30 seconds is the default Cypress wait for the request to complete
errorMsg: 'Some requests are not settled yet',
}).then(() => {
waitCompleted = true;
import 'cypress-wait-until';

export function waitForPostCreationRequests() {
let waitCompleted = false;

cy.log('*--- All requests must be settled*');

const pendingRequests = new Map();
cy.intercept('POST', 'http://localhost:8080/v1/metadata', req => {
if (waitCompleted) return;

Cypress.log({ message: '*--- Request pending*' });

pendingRequests.set(req, true);

req.continue(() => {
Cypress.log({ message: '*--- Request settled*' });

pendingRequests.delete(req);
});
}
});

Cypress.log({ message: '*--- Waiting for the first request to start*' });

// Check if at least one request has been caught. This check must protect from the following case
//
// check requests start test failure, the requests got the UI re-rendered
// | | |
// |--🚦🔴----⚠️---🚦🟢-------1-2-3-4-5-6-7-1----------💥
//
// where checking that "there are no pending requests" falls in the false positive case where
// there are no pending requests because no one started at all.
//
// The check runs every millisecond to be 100% sure that no request can escape (ex. because of a
// super fast server). A false-negative case represented here
//
// requests start requests end check check test failure, no first request caught
// | | | | | | |
// |--🚦🔴--1-2-3-4-5-6-7-1-2-3-4-5-6-7--⚠️------------------⚠️------------------💥
cy.waitUntil(() => pendingRequests.size > 0, {
timeout: 5000, // 5 seconds is the default Cypress wait for a request to start
interval: 1,
errorMsg: 'No first request caught',
});

Cypress.log({ message: '*--- Waiting for all the requests to start*' });

// Let pass some time to collect all the requests. Otherwise, it could detect that the first
// request complete and go on with the test, even if another one will be performed in a while.
//
// This fixed wait protects from the following timeline
//
// 1st request start first request end other requests start test failure, the requests got the UI re-rendered
// | | | |
// |--🚦🔴---1---------------------1----🚦🟢----------------2-3-4-5-6-7-1----------💥
//
// Obviously, it is an empiric waiting, that also slows down the test.
cy.wait(500);

Cypress.log({ message: '*--- Waiting for all the requests to be settled*' });

cy.waitUntil(() => pendingRequests.size === 0, {
timeout: 30000, // 30 seconds is the default Cypress wait for the request to complete
errorMsg: 'Some requests are not settled yet',
}).then(() => {
waitCompleted = true;
});
}
Loading

0 comments on commit 09c9cf8

Please sign in to comment.