2024-03-18 11:47:01 +03:00
|
|
|
/** @file Test the drive view. */
|
|
|
|
import * as test from '@playwright/test'
|
|
|
|
|
|
|
|
import * as actions from './actions'
|
|
|
|
|
2024-06-19 18:24:11 +03:00
|
|
|
const PASS_TIMEOUT = 5_000
|
|
|
|
|
2024-03-18 11:47:01 +03:00
|
|
|
test.test('extra columns should stick to right side of assets table', async ({ page }) => {
|
|
|
|
await actions.mockAllAndLogin({ page })
|
|
|
|
await actions.locateAccessedByProjectsColumnToggle(page).click()
|
|
|
|
await actions.locateAccessedDataColumnToggle(page).click()
|
|
|
|
await actions.locateAssetsTable(page).evaluate(element => {
|
|
|
|
let scrollableParent: HTMLElement | SVGElement | null = element
|
|
|
|
while (
|
|
|
|
scrollableParent != null &&
|
|
|
|
scrollableParent.scrollWidth <= scrollableParent.clientWidth
|
|
|
|
) {
|
|
|
|
scrollableParent = scrollableParent.parentElement
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
|
|
scrollableParent?.scrollTo({ left: 999999, behavior: 'instant' })
|
|
|
|
})
|
|
|
|
const extraColumns = actions.locateExtraColumns(page)
|
|
|
|
const assetsTable = actions.locateAssetsTable(page)
|
|
|
|
await test
|
|
|
|
.expect(async () => {
|
|
|
|
const extraColumnsRight = await extraColumns.evaluate(
|
|
|
|
element => element.getBoundingClientRect().right
|
|
|
|
)
|
|
|
|
const assetsTableRight = await assetsTable.evaluate(
|
|
|
|
element => element.getBoundingClientRect().right
|
|
|
|
)
|
|
|
|
test.expect(extraColumnsRight).toEqual(assetsTableRight)
|
|
|
|
})
|
2024-06-19 18:24:11 +03:00
|
|
|
.toPass({ timeout: PASS_TIMEOUT })
|
2024-03-18 11:47:01 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
test.test('extra columns should stick to top of scroll container', async ({ page }) => {
|
|
|
|
const { api } = await actions.mockAllAndLogin({ page })
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
|
|
for (let i = 0; i < 100; i += 1) {
|
|
|
|
api.addFile('a')
|
|
|
|
}
|
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 10:14:40 +03:00
|
|
|
await actions.reload({ page })
|
2024-03-18 11:47:01 +03:00
|
|
|
|
|
|
|
await actions.locateAccessedByProjectsColumnToggle(page).click()
|
|
|
|
await actions.locateAccessedDataColumnToggle(page).click()
|
|
|
|
await actions.locateAssetsTable(page).evaluate(element => {
|
|
|
|
let scrollableParent: HTMLElement | SVGElement | null = element
|
|
|
|
while (
|
|
|
|
scrollableParent != null &&
|
|
|
|
scrollableParent.scrollWidth <= scrollableParent.clientWidth
|
|
|
|
) {
|
|
|
|
scrollableParent = scrollableParent.parentElement
|
|
|
|
}
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
|
|
scrollableParent?.scrollTo({ top: 999999, behavior: 'instant' })
|
|
|
|
})
|
|
|
|
const extraColumns = actions.locateExtraColumns(page)
|
|
|
|
const assetsTable = actions.locateAssetsTable(page)
|
|
|
|
await test
|
|
|
|
.expect(async () => {
|
|
|
|
const extraColumnsTop = await extraColumns.evaluate(
|
|
|
|
element => element.getBoundingClientRect().top
|
|
|
|
)
|
|
|
|
const assetsTableTop = await assetsTable.evaluate(element => {
|
|
|
|
let scrollableParent: HTMLElement | SVGElement | null = element
|
|
|
|
while (
|
|
|
|
scrollableParent != null &&
|
|
|
|
scrollableParent.scrollWidth <= scrollableParent.clientWidth
|
|
|
|
) {
|
|
|
|
scrollableParent = scrollableParent.parentElement
|
|
|
|
}
|
|
|
|
return scrollableParent?.getBoundingClientRect().top
|
|
|
|
})
|
|
|
|
test.expect(extraColumnsTop).toEqual(assetsTableTop)
|
|
|
|
})
|
2024-06-19 18:24:11 +03:00
|
|
|
.toPass({ timeout: PASS_TIMEOUT })
|
2024-03-18 11:47:01 +03:00
|
|
|
})
|
|
|
|
|
|
|
|
test.test('can drop onto root directory dropzone', async ({ page }) => {
|
|
|
|
const { api } = await actions.mockAllAndLogin({ page })
|
|
|
|
const assetRows = actions.locateAssetRows(page)
|
|
|
|
const asset = api.addDirectory('a')
|
|
|
|
api.addFile('b', { parentId: asset.id })
|
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 10:14:40 +03:00
|
|
|
await actions.reload({ page })
|
2024-03-18 11:47:01 +03:00
|
|
|
|
|
|
|
await assetRows.nth(0).dblclick()
|
|
|
|
const parentLeft = await actions.getAssetRowLeftPx(assetRows.nth(0))
|
|
|
|
const childLeft = await actions.getAssetRowLeftPx(assetRows.nth(1))
|
|
|
|
test.expect(childLeft, 'child is indented further than parent').toBeGreaterThan(parentLeft)
|
2024-06-12 13:20:07 +03:00
|
|
|
await assetRows.nth(1).dragTo(actions.locateRootDirectoryDropzone(page), { force: true })
|
2024-03-18 11:47:01 +03:00
|
|
|
const firstLeft = await actions.getAssetRowLeftPx(assetRows.nth(0))
|
|
|
|
const secondLeft = await actions.getAssetRowLeftPx(assetRows.nth(1))
|
|
|
|
test.expect(firstLeft, 'siblings have same indentation').toEqual(secondLeft)
|
|
|
|
})
|