enso/app/dashboard/e2e/labelsPanel.spec.ts
somebody1234 cad50a5b63
Dashboard fixes (#11059)
- Fix https://github.com/enso-org/cloud-v2/issues/1482
- Fix "clear trash" not doing anything
- Show "shared with" column as "root folder", but only owners (TODO: actually it should only show the first item in the permissions list)
- Fix https://github.com/enso-org/cloud-v2/issues/1480
- Fix importing .enso-projects not doing anything
- Could not repro crash. Also note that we do want to be able to upload files
- Partly address https://github.com/enso-org/cloud-v2/issues/1479
- Remove "invite" and "share" buttons on top right
- Hide "upgrade" button on top right if on Team or Enterprise plan
- Warn when deleting folder (for now warns for all folders otherwise we may need to expand the folder to know whether it is empty)
- Fix importing projects via upload button
- Fix importing projects via drag
- Hide cut on running projects
- Partly address https://github.com/enso-org/cloud-v2/issues/1481
- Fix "edit secret" not showing dialog
- Fix multiple selection context menu in Team space

# Important Notes
None
2024-09-16 09:03:49 +00:00

65 lines
2.4 KiB
TypeScript

/** @file Test the labels sidebar panel. */
import * as test from '@playwright/test'
import {
locateCreateButton,
locateLabelsPanel,
locateLabelsPanelLabels,
locateModalBackground,
locateNewLabelButton,
locateNewLabelModal,
locateNewLabelModalColorButtons,
locateNewLabelModalNameInput,
mockAllAndLogin,
TEXT,
} from './actions'
test.test.beforeEach(({ page }) => mockAllAndLogin({ page }))
test.test('labels', async ({ page }) => {
// Empty labels panel
await test.expect(locateLabelsPanel(page)).toBeVisible()
// "Create label" modal
await locateNewLabelButton(page).click()
await test.expect(locateNewLabelModal(page)).toBeVisible()
await page.press('body', 'Escape')
await test.expect(locateNewLabelModal(page)).not.toBeVisible()
await locateNewLabelButton(page).click()
await locateModalBackground(page).click()
await test.expect(locateNewLabelModal(page)).not.toBeVisible()
await locateNewLabelButton(page).click()
// "Create label" modal with name set
await locateNewLabelModalNameInput(page).fill('New Label')
await test.expect(locateNewLabelModal(page)).toHaveText(/^New Label/)
await page.press('body', 'Escape')
// "Create label" modal with color set
// The exact number is allowed to vary; but to click the fourth color, there must be at least
// four colors.
await locateNewLabelButton(page).click()
test.expect(await locateNewLabelModalColorButtons(page).count()).toBeGreaterThanOrEqual(4)
// `force: true` is required because the `label` needs to handle the click event, not the
// `button`.
await locateNewLabelModalColorButtons(page).nth(4).click({ force: true })
await test.expect(locateNewLabelModal(page)).toBeVisible()
// "Create label" modal with name and color set
await locateNewLabelModalNameInput(page).fill('New Label')
await test.expect(locateNewLabelModal(page)).toHaveText(/^New Label/)
// Labels panel with one entry
await locateCreateButton(locateNewLabelModal(page)).click()
await test.expect(locateLabelsPanel(page)).toBeVisible()
// Empty labels panel again, after deleting the only entry
await locateLabelsPanelLabels(page).first().hover()
const labelsPanel = locateLabelsPanel(page)
await labelsPanel.getByRole('button').and(labelsPanel.getByLabel(TEXT.delete)).click()
await page.getByRole('button', { name: TEXT.delete }).getByText(TEXT.delete).click()
test.expect(await locateLabelsPanelLabels(page).count()).toBeGreaterThanOrEqual(1)
})