mirror of
https://github.com/enso-org/enso.git
synced 2024-12-21 04:51:38 +03:00
4a249688e8
Fixes #10668 Fixes #8484 Summary of changes: * `gui2` and `dashboard` are merged to `gui` directory. Various configs were merged (package.json, playwrigth, TS...). The src and e2e directories are split to `dashboard` and `project-view` for now. * E2E tests run two servers on different ports. The tests are organized in projects. This is also to be changed soon, as we plan to [use better mocking in GUI/ProjectView](#9726) * ESlint configs were merged to central `eslint.config.mjs`, and that file was moved to repository root. We kept the dashboard lints, but they can be relaxed. The dashboard code was changed to meet GUI lints. * Also, the versions of linter plugins were bumped, and code fixed. * The ide-desktop/client no longer has `dashboard` dependency - the only type used there was moved to common package. * `common` package moved to `app`.
74 lines
2.9 KiB
TypeScript
74 lines
2.9 KiB
TypeScript
/** @file Test dragging of labels. */
|
|
import * as test from '@playwright/test'
|
|
|
|
import * as backend from '#/services/Backend'
|
|
|
|
import * as actions from './actions'
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
export const ASSET_ROW_SAFE_POSITION = { x: 300, y: 16 }
|
|
|
|
/** Click an asset row. The center must not be clicked as that is the button for adding a label. */
|
|
export async function clickAssetRow(assetRow: test.Locator) {
|
|
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
await assetRow.click({ position: ASSET_ROW_SAFE_POSITION })
|
|
}
|
|
|
|
test.test('drag labels onto single row', async ({ page }) => {
|
|
const label = 'aaaa'
|
|
await actions.mockAllAndLogin({
|
|
page,
|
|
setupAPI: (api) => {
|
|
api.addLabel(label, backend.COLORS[0])
|
|
api.addLabel('bbbb', backend.COLORS[1])
|
|
api.addLabel('cccc', backend.COLORS[2])
|
|
api.addLabel('dddd', backend.COLORS[3])
|
|
api.addDirectory('foo')
|
|
api.addSecret('bar')
|
|
api.addFile('baz')
|
|
api.addSecret('quux')
|
|
},
|
|
})
|
|
const assetRows = actions.locateAssetRows(page)
|
|
const labelEl = actions.locateLabelsPanelLabels(page, label)
|
|
await actions.relog({ page })
|
|
|
|
await test.expect(labelEl).toBeVisible()
|
|
await labelEl.dragTo(assetRows.nth(1))
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(0)).getByText(label)).not.toBeVisible()
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(1)).getByText(label)).toBeVisible()
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(2)).getByText(label)).not.toBeVisible()
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(3)).getByText(label)).not.toBeVisible()
|
|
})
|
|
|
|
test.test('drag labels onto multiple rows', async ({ page }) => {
|
|
const label = 'aaaa'
|
|
await actions.mockAllAndLogin({
|
|
page,
|
|
setupAPI: (api) => {
|
|
api.addLabel(label, backend.COLORS[0])
|
|
api.addLabel('bbbb', backend.COLORS[1])
|
|
api.addLabel('cccc', backend.COLORS[2])
|
|
api.addLabel('dddd', backend.COLORS[3])
|
|
api.addDirectory('foo')
|
|
api.addSecret('bar')
|
|
api.addFile('baz')
|
|
api.addSecret('quux')
|
|
},
|
|
})
|
|
const assetRows = actions.locateAssetRows(page)
|
|
const labelEl = actions.locateLabelsPanelLabels(page, label)
|
|
|
|
await page.keyboard.down(await actions.modModifier(page))
|
|
await test.expect(assetRows).toHaveCount(4)
|
|
await clickAssetRow(assetRows.nth(0))
|
|
await clickAssetRow(assetRows.nth(2))
|
|
await test.expect(labelEl).toBeVisible()
|
|
await labelEl.dragTo(assetRows.nth(2))
|
|
await page.keyboard.up(await actions.modModifier(page))
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(0)).getByText(label)).toBeVisible()
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(1)).getByText(label)).not.toBeVisible()
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(2)).getByText(label)).toBeVisible()
|
|
await test.expect(actions.locateAssetLabels(assetRows.nth(3)).getByText(label)).not.toBeVisible()
|
|
})
|