2024-01-31 14:35:41 +03:00
|
|
|
/** @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'
|
|
|
|
|
2024-06-20 19:19:01 +03:00
|
|
|
// =================
|
|
|
|
// === 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 }).then(
|
|
|
|
async ({ pageActions }) =>
|
|
|
|
await pageActions
|
|
|
|
.createFolder()
|
|
|
|
.driveTable.clickRow(0)
|
|
|
|
.withAssetPanel(async assetPanel => {
|
|
|
|
await test.expect(assetPanel).not.toBeVisible()
|
|
|
|
})
|
|
|
|
.toggleAssetPanel()
|
|
|
|
.withAssetPanel(async assetPanel => {
|
|
|
|
await test.expect(assetPanel).toBeVisible()
|
|
|
|
})
|
|
|
|
.toggleAssetPanel()
|
|
|
|
.withAssetPanel(async assetPanel => {
|
|
|
|
await test.expect(assetPanel).not.toBeVisible()
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
test.test('asset panel contents', ({ page }) =>
|
|
|
|
actions.mockAll({ page }).then(
|
|
|
|
async ({ pageActions, api }) =>
|
|
|
|
await pageActions
|
|
|
|
.do(() => {
|
|
|
|
const { defaultOrganizationId, defaultUserId } = api
|
|
|
|
api.addProject('project', {
|
|
|
|
description: DESCRIPTION,
|
|
|
|
permissions: [
|
|
|
|
{
|
|
|
|
permission: permissions.PermissionAction.own,
|
|
|
|
user: {
|
|
|
|
organizationId: defaultOrganizationId,
|
Fix various issues on the Dashboard (#10256)
- Fix React DevTools not working in Firefox
- Fix selection of asset names when editing them, not working at all in Firefox
- Convert tick/cross buttons when editing assets, and the "plus" and "reload" buttons on the "shared with" column, "labels" column, and keyboard shortcuts table, to match more with the rest of the design
- Update clip path when the container resizes, so that the icons for hidden columns never overlap the actual table header
- Fix #10184
- Fix renames being committed even when cancelling
- Fix duplicate name detection - previously, all asset types only checked folders with the same name, not assets with the same name
- I'm not 100% sure this is the correct behavior still
- Stop using `kbd` (`aria.Keyboard`) to display keyboard shortcuts, since they should not be displayed in a monospace font.
- Fix "plus" and "reload" buttons going past the right side of their parent table cell
- Limit length of `PermissionDisplay` - if the username of a user with permission is too long, it uses a tooltip instead
- Update the username dynamically for all permissions owned by self, when changing username in the settings.
- This avoids having to fully invalidate the directory tree every time the username changes, given that nothing changes about the assets' metadata themselves.
- Cache children in the Drive tree
- This avoids loading spinners when closing a folder and immediately reopening it.
- Note that children are still re-fetched on reopen to ensure freshness
# Important Notes
- This MAY be split into multiple smaller PRs. However, I think it's better to QA as a single PR, to avoid duplicating work checking behavior that may be changed by a sibling PR (assuming the PR was split into multiple).
2024-06-20 21:30:24 +03:00
|
|
|
// Using the default ID causes the asset to have a dynamic username.
|
|
|
|
userId: backend.UserId(defaultUserId + '2'),
|
2024-06-20 19:19:01 +03:00
|
|
|
name: USERNAME,
|
|
|
|
email: backend.EmailAddress(EMAIL),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.login()
|
|
|
|
.do(async thePage => {
|
|
|
|
await actions.passTermsAndConditionsDialog({ 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.
|
|
|
|
await test
|
|
|
|
.expect(actions.locateAssetPanelPermissions(page).getByText(USERNAME))
|
|
|
|
.toBeVisible()
|
|
|
|
})
|
|
|
|
)
|
|
|
|
)
|