enso/app/ide-desktop/lib/dashboard/e2e
Sergei Garin 37cc980082
Offline Mode Support (#10317)
#### Tl;dr
Closes: enso-org/cloud-v2#1283
This PR significantly reimplements Offline mode

<details><summary>Demo Presentation</summary>
<p>


https://github.com/enso-org/enso/assets/61194245/752d0423-9c0a-43ba-91e3-4a6688f77034


</p>
</details>

---

#### Context:
Offline mode is one of the core features of the dashboard. Unfortunately, after adding new features and a few refactoring,  we lost the ability to work offline.
This PR should bring this functionality back, with a few key differences:
1. We require users to sign in before using the dashboard even in local mode.
2. Once a user is logged in, we allow him to work with local files
3. If a user closes the dashboard, and then open it, he can continue using it in offline mode


#### This Change:
What does this change do in the larger context? Specific details to highlight for review:
1. Reimplements `<AuthProvider />` functionality, now it implemented on top of `<Suspense />` and ReactQuery
2. Reimplements Backend module flow, now remote backend is always created, You no longer need to check if the RemoteBackend is present
3. Introduces new `<Suspense />` component, which is aware of offline status
4. Introduce new offline-related hooks
5. Add a banner to the form if it's unable to submit it offline
6. Refactor `InviteUserDialog` to the new `<Form />` component
7. Fixes redirect bug when the app doesn't redirect a user to the dashboard after logging in
8. Fixes strange behavior when `/users/me` could stuck into infinite refetch
9. Redesign the Cloud table for offline mode.
10. Adds blocking UI dialog when a user clicks "log out" button

#### Test Plan:
This PR requires thorough QA on the login flow across the browser and IDE. All redirect logic must stay unchanged.

---
2024-06-21 07:14:40 +00:00
..
actions Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
actions.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
api.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
assetPanel.spec.ts Fix various issues on the Dashboard (#10256) 2024-06-20 18:30:24 +00:00
assetSearchBar.spec.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
assetsTableFeatures.spec.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
copy.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
createAsset.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
dataLinkEditor.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
delete.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
driveView.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
editAssetName.spec.ts Fix various issues on the Dashboard (#10256) 2024-06-20 18:30:24 +00:00
labels.spec.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
labelsPanel.spec.ts More E2E tests; export default classes from modules (#8730) 2024-01-31 11:35:41 +00:00
loginLogout.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
loginScreen.spec.ts More E2E tests; export default classes from modules (#8730) 2024-01-31 11:35:41 +00:00
membersSettings.spec.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
organizationSettings.spec.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
pageSwitcher.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
README.md Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
signUp.spec.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
sort.spec.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00
startModal.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
userMenu.spec.ts Refactor E2E tests for Dashboard; add E2E tests for User and Organization settings pages (#10031) 2024-06-20 16:19:01 +00:00
userSettings.spec.ts Offline Mode Support (#10317) 2024-06-21 07:14:40 +00:00

End-to-end tests

Running tests

Execute all commands from the parent directory.

# Run tests normally
npm run test:e2e
# Open UI to run tests
npm run test:e2e:debug
# Run tests in a specific file only
npm run test:e2e -- e2e/file-name-here.spec.ts
npm run test:e2e:debug -- e2e/file-name-here.spec.ts
# Compile the entire app before running the tests.
# DOES NOT hot reload the tests.
# Prefer not using this when you are trying to fix a test;
# prefer using this when you just want to know which tests are failing (if any).
PROD=1 npm run test:e2e
PROD=1 npm run test:e2e:debug
PROD=1 npm run test:e2e -- e2e/file-name-here.spec.ts
PROD=1 npm run test:e2e:debug -- e2e/file-name-here.spec.ts

Getting started

test.test("test name here", ({ page }) =>
  actions.mockAllAndLogin({ page }).then(
    // ONLY chain methods from `pageActions`.
    // Using methods not in `pageActions` is UNDEFINED BEHAVIOR.
    // If it is absolutely necessary though, please remember to `await` the method chain.
    // Note that the `async`/`await` pair is REQUIRED, as `Actions` subclasses are `PromiseLike`s,
    // not `Promise`s, which causes Playwright to output a type error.
    async ({ pageActions }) => await pageActions.goTo.drive(),
  ),
);

Perform arbitrary actions (e.g. actions on the API)

test.test("test name here", ({ page }) =>
  actions.mockAllAndLogin({ page }).then(
    async ({ pageActions, api }) =>
      await pageActions.do(() => {
        api.foo();
        api.bar();
        test.expect(api.baz()?.quux).toEqual("bar");
      }),
  ),
);