enso/app/gui/e2e/dashboard/assetPanel.spec.ts
somebody1234 45ad3a751c
Dashboard improvements (8 Oct 2024) (#11268)
- ⚠️ Follow up to #11219. MUST NOT be merged in before that PR.

- Changes:
- Add optional overlay to `Popover`s
- Add and use `useAssetPassiveListener` everywhere to get reactive updates to asset state even outside Asset Panel
- `setItem` has been removed in favor of simply waiting for invalidations
- Migrate more `Modal`s to `Popover`s
- Migrate more inputs to `Form`s
- Periodically refetch Datalink in Asset Panel
- Show optimistic state for asset description (adding this because it is trivial to add)
- Remove usages of `get*` as mutations throughout the entire codebase - replace with `fetchQuery`
- Fixes most of rest of https://github.com/enso-org/cloud-v2/issues/1529
- (1) ℹ️ fixed in #11219
- (2)  backend issue
- (3)  out of scope
- (4)  backend issue
- (5)  out of scope
- (6)  [wontfix]? i think this is intentional, it's not so much slow scrolling and moreso snapped scrolling
- (7)  backend issue
- (8) ℹ️ fixed in #11126
- (9)  out of scope (potentially requires a way to trigger a tooltip on a disabled button)
- (10)  (will check later) Make sure you are not able to open a project opened by another user: cmd + click is not always working.
- (11) Drag from team space to user space should copy asset
- (12)  (will check later) Drag from user space to team should move (and swap ownership)
- (13) ℹ️ fixed in #11219
- (14) ℹ️ fixed somewhere (?)
- (15) ℹ️ fixed somewhere (?)
- (16) Show correct (and up-to-date) description for projects
- (17) ℹ️ fixed in #11219
- (18) ℹ️ fixed in #11219
- Fix https://github.com/enso-org/cloud-v2/issues/1535
- Completely remove optimistic UI for "copy asset"
- Fix https://github.com/enso-org/cloud-v2/issues/1541
- Make selection brush work again
- Unintentionally regressed in 51733ee876 (diff-f3e29bffcda342ab6a9dbafc58dde88ce26638eaecda1f17f40ca7e319c90cc8L89)

# Important Notes
None
2024-10-21 10:30:19 +00:00

79 lines
2.4 KiB
TypeScript

/** @file Tests for the asset panel. */
import * as test from '@playwright/test'
import * as backend from '#/services/Backend'
import * as permissions from '#/utilities/permissions'
import * as actions from './actions'
// =================
// === Constants ===
// =================
/** An example description for the asset selected in the asset panel. */
const DESCRIPTION = 'foo bar'
/** An example owner username for the asset selected in the asset panel. */
const USERNAME = 'baz quux'
/** An example owner email for the asset selected in the asset panel. */
const EMAIL = 'baz.quux@email.com'
// =============
// === Tests ===
// =============
test.test('open and close asset panel', ({ page }) =>
actions
.mockAllAndLogin({ page })
.createFolder()
.driveTable.clickRow(0)
.withAssetPanel(async (assetPanel) => {
await actions.expectNotOnScreen(assetPanel)
})
.toggleAssetPanel()
.withAssetPanel(async (assetPanel) => {
await actions.expectOnScreen(assetPanel)
})
.toggleAssetPanel()
.withAssetPanel(async (assetPanel) => {
await actions.expectNotOnScreen(assetPanel)
}),
)
test.test('asset panel contents', ({ page }) =>
actions
.mockAll({
page,
setupAPI: (api) => {
const { defaultOrganizationId, defaultUserId } = api
api.addProject('project', {
description: DESCRIPTION,
permissions: [
{
permission: permissions.PermissionAction.own,
user: {
organizationId: defaultOrganizationId,
// Using the default ID causes the asset to have a dynamic username.
userId: backend.UserId(defaultUserId + '2'),
name: USERNAME,
email: backend.EmailAddress(EMAIL),
},
},
],
})
},
})
.login()
.do(async (thePage) => {
await actions.passAgreementsDialog({ page: thePage })
})
.driveTable.clickRow(0)
.toggleAssetPanel()
.do(async () => {
await test.expect(actions.locateAssetPanelDescription(page)).toHaveText(DESCRIPTION)
// `getByText` is required so that this assertion works if there are multiple permissions.
// This is not visible; "Shared with" should only be visible on the Enterprise plan.
// await test.expect(actions.locateAssetPanelPermissions(page).getByText(USERNAME)).toBeVisible()
}),
)