enso/app/dashboard/e2e/labelsPanel.spec.ts
somebody1234 ebf4cd5c1f
Inline modules in app/ide-desktop/ (#10305)
- Remove unnecessary modules
- Remove `ts-plugin-namespace-auto-import` as it was a workaround to use the non-conventional `import *` convention
- Remove `esbuild-plugin-copy-directories` as it is unuse
- Inline modules that are only ever used once
- Inline `project-manager-shim` into `gui2` - it is only used during `gui2`'s dev mode
- Inline `content-config` into `client`
- Flatten `app/ide-desktop/lib/` to `app/ide-desktop/`
- Flatten `app/ide-desktop/lib/dashboard/` to `app/dashboard/`

# Important Notes
- As mentioned above, all remaining modules have been moved up from `app/ide-desktop/lib/` to `app/ide-desktop/`. It's not ideal but I'd rather hold off on moving them anywhere else before we have a consensus on what should go where.
- (That is to say, this may not be the final directory structure - but I figure it's fine to get *something* done so that hopefully the rest of the restructuring is simpler.)
2024-07-17 09:10:42 +00:00

52 lines
2.3 KiB
TypeScript

/** @file Test the labels sidebar panel. */
import * as test from '@playwright/test'
import * as actions from './actions'
test.test.beforeEach(({ page }) => actions.mockAllAndLogin({ page }))
test.test('labels', async ({ page }) => {
// Empty labels panel
await test.expect(actions.locateLabelsPanel(page)).toBeVisible()
// "Create label" modal
await actions.locateNewLabelButton(page).click()
await test.expect(actions.locateNewLabelModal(page)).toBeVisible()
await page.press('body', 'Escape')
await test.expect(actions.locateNewLabelModal(page)).not.toBeVisible()
await actions.locateNewLabelButton(page).click()
await actions.locateModalBackground(page).click()
await test.expect(actions.locateNewLabelModal(page)).not.toBeVisible()
await actions.locateNewLabelButton(page).click()
// "Create label" modal with name set
await actions.locateNewLabelModalNameInput(page).fill('New Label')
await test.expect(actions.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 actions.locateNewLabelButton(page).click()
test.expect(await actions.locateNewLabelModalColorButtons(page).count()).toBeGreaterThanOrEqual(4)
// `force: true` is required because the `label` needs to handle the click event, not the
// `button`.
await actions.locateNewLabelModalColorButtons(page).nth(4).click({ force: true })
await test.expect(actions.locateNewLabelModal(page)).toBeVisible()
// "Create label" modal with name and color set
await actions.locateNewLabelModalNameInput(page).fill('New Label')
await test.expect(actions.locateNewLabelModal(page)).toHaveText(/^New Label/)
// Labels panel with one entry
await actions.locateCreateButton(actions.locateNewLabelModal(page)).click()
await test.expect(actions.locateLabelsPanel(page)).toBeVisible()
// Empty labels panel again, after deleting the only entry
await actions.locateLabelsPanelLabels(page).first().hover()
await actions.locateDeleteIcon(actions.locateLabelsPanel(page)).first().click()
await actions.locateDeleteButton(page).click()
test.expect(await actions.locateLabelsPanelLabels(page).count()).toBeGreaterThanOrEqual(1)
})