mirror of
https://github.com/enso-org/enso.git
synced 2024-12-22 16:11:45 +03:00
5b5279b896
- Fix #10393 - Use correct background color - Make background of Asset Panel white to match Figma design # Important Notes None
82 lines
2.6 KiB
TypeScript
82 lines
2.6 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 }).then(
|
|
async ({ pageActions }) =>
|
|
await pageActions
|
|
.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 }).then(
|
|
async ({ pageActions, api }) =>
|
|
await pageActions
|
|
.do(() => {
|
|
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.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()
|
|
})
|
|
)
|
|
)
|