enso/app/gui/e2e/dashboard/assetPanel.spec.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

79 lines
2.4 KiB
TypeScript
Raw Normal View History

More E2E tests; `export default` classes from modules (#8730) This is a prerequisite for adding a CI action for E2E tests. - Fix E2E tests - Remove visual regression testing (VRT) and associated fixtures (screenshots) for now - Switch dashboard almost fully to Vite, from ESBuild, to match GUI2's build tooling. - Add some new E2E tests: - Creating assets - Deleting assets - Creating assets from the samples on the home page - Sort assets - Includes fixes for sorting: - Group sorted assets by type again (regression) (see https://github.com/enso-org/cloud-v2/issues/554) - Make sorting by title, case insensitive. This is because it is more intuitive for non-programmers if all items with uppercase names *aren't* separated from those with lowercase names - especially since the Windows FS is case-insensitive. - Normalization of Unicode letters is *not* currently being done. It can potentially be added later. - Double-clicking *anywhere* on a directory row now expands it. Previously it was only being expanded when double clicking - Add recursive label adding/removal to mirror backend - Note: The current implementation is not exactly the same as the backend's implementation. - Fix https://github.com/enso-org/cloud-v2/issues/872 - Unset "saved project details" (for opening the last open project) if fetching it produces an error. # Important Notes - All tests pass. (run `npm run test:e2e` in `app/ide-desktop/lib/dashboard`) - All `npm` commands should be run in `app/ide-desktop/lib/dashboard`. `dashboard:*` npm scripts have been removed from `app/ide-desktop` to prevent a mess. - `npm run dev` confirmed to still work. Note that it has not been changed as it was already using Vite. - `npm run build` now uses `vite build`. This has been tested using a local HTTP server that supports `404.html`. - Other cases have been tested: - `npm run test:e2e` works (all tests pass) - `./run ide build` works - `./run ide watch` works - `./run ide2 build` works - `./run gui watch` works
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'
// =================
// === 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.
Dashboard improvements (8 Oct 2024) (#11268) - :warning: 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) :information_source: fixed in #11219 - (2) :x: backend issue - (3) :x: out of scope - (4) :x: backend issue - (5) :x: out of scope - (6) :x: [wontfix]? i think this is intentional, it's not so much slow scrolling and moreso snapped scrolling - (7) :x: backend issue - (8) :information_source: fixed in #11126 - (9) :x: out of scope (potentially requires a way to trigger a tooltip on a disabled button) - (10) :x: (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) :x: (will check later) Drag from user space to team should move (and swap ownership) - (13) :information_source: fixed in #11219 - (14) :information_source: fixed somewhere (?) - (15) :information_source: fixed somewhere (?) - (16) Show correct (and up-to-date) description for projects - (17) :information_source: fixed in #11219 - (18) :information_source: 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 https://github.com/enso-org/enso/commit/51733ee87677fb47e7a123c98660bc72abe1a9fd#diff-f3e29bffcda342ab6a9dbafc58dde88ce26638eaecda1f17f40ca7e319c90cc8L89 # Important Notes None
2024-10-21 13:30:19 +03:00
// This is not visible; "Shared with" should only be visible on the Enterprise plan.
// await test.expect(actions.locateAssetPanelPermissions(page).getByText(USERNAME)).toBeVisible()
}),
)