2024-01-31 14:35:41 +03:00
|
|
|
/** @file Test dragging of labels. */
|
|
|
|
import * as test from '@playwright/test'
|
|
|
|
|
|
|
|
import * as backend from '#/services/Backend'
|
|
|
|
|
|
|
|
import * as actions from './actions'
|
|
|
|
|
2024-08-13 14:50:07 +03:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
|
|
export const ASSET_ROW_SAFE_POSITION = { x: 300, y: 16 }
|
|
|
|
|
|
|
|
/** Click an asset row. The center must not be clicked as that is the button for adding a label. */
|
|
|
|
export async function clickAssetRow(assetRow: test.Locator) {
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
|
|
await assetRow.click({ position: ASSET_ROW_SAFE_POSITION })
|
|
|
|
}
|
|
|
|
|
2024-01-31 14:35:41 +03:00
|
|
|
test.test('drag labels onto single row', async ({ page }) => {
|
|
|
|
const label = 'aaaa'
|
2024-07-16 12:55:45 +03:00
|
|
|
await actions.mockAllAndLogin({
|
|
|
|
page,
|
|
|
|
setupAPI: (api) => {
|
|
|
|
api.addLabel(label, backend.COLORS[0])
|
2024-08-08 15:12:05 +03:00
|
|
|
api.addLabel('bbbb', backend.COLORS[1])
|
|
|
|
api.addLabel('cccc', backend.COLORS[2])
|
|
|
|
api.addLabel('dddd', backend.COLORS[3])
|
2024-07-16 12:55:45 +03:00
|
|
|
api.addDirectory('foo')
|
|
|
|
api.addSecret('bar')
|
|
|
|
api.addFile('baz')
|
|
|
|
api.addSecret('quux')
|
|
|
|
},
|
|
|
|
})
|
|
|
|
const assetRows = actions.locateAssetRows(page)
|
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
|
|
|
const labelEl = actions.locateLabelsPanelLabels(page, label)
|
|
|
|
await actions.relog({ page })
|
2024-01-31 14:35:41 +03:00
|
|
|
|
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 test.expect(labelEl).toBeVisible()
|
|
|
|
await labelEl.dragTo(assetRows.nth(1))
|
2024-01-31 14:35:41 +03:00
|
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(0)).getByText(label)).not.toBeVisible()
|
|
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(1)).getByText(label)).toBeVisible()
|
|
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(2)).getByText(label)).not.toBeVisible()
|
|
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(3)).getByText(label)).not.toBeVisible()
|
|
|
|
})
|
|
|
|
|
|
|
|
test.test('drag labels onto multiple rows', async ({ page }) => {
|
|
|
|
const label = 'aaaa'
|
2024-07-16 12:55:45 +03:00
|
|
|
await actions.mockAllAndLogin({
|
|
|
|
page,
|
|
|
|
setupAPI: (api) => {
|
|
|
|
api.addLabel(label, backend.COLORS[0])
|
2024-08-08 15:12:05 +03:00
|
|
|
api.addLabel('bbbb', backend.COLORS[1])
|
|
|
|
api.addLabel('cccc', backend.COLORS[2])
|
|
|
|
api.addLabel('dddd', backend.COLORS[3])
|
2024-07-16 12:55:45 +03:00
|
|
|
api.addDirectory('foo')
|
|
|
|
api.addSecret('bar')
|
|
|
|
api.addFile('baz')
|
|
|
|
api.addSecret('quux')
|
|
|
|
},
|
|
|
|
})
|
|
|
|
const assetRows = actions.locateAssetRows(page)
|
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
|
|
|
const labelEl = actions.locateLabelsPanelLabels(page, label)
|
2024-01-31 14:35:41 +03:00
|
|
|
|
|
|
|
await page.keyboard.down(await actions.modModifier(page))
|
2024-08-12 15:55:49 +03:00
|
|
|
await test.expect(assetRows).toHaveCount(4)
|
2024-08-13 14:50:07 +03:00
|
|
|
await clickAssetRow(assetRows.nth(0))
|
|
|
|
await clickAssetRow(assetRows.nth(2))
|
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 test.expect(labelEl).toBeVisible()
|
|
|
|
await labelEl.dragTo(assetRows.nth(2))
|
2024-01-31 14:35:41 +03:00
|
|
|
await page.keyboard.up(await actions.modModifier(page))
|
|
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(0)).getByText(label)).toBeVisible()
|
|
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(1)).getByText(label)).not.toBeVisible()
|
|
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(2)).getByText(label)).toBeVisible()
|
|
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(3)).getByText(label)).not.toBeVisible()
|
|
|
|
})
|