Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(control-ui): cover move name-conflict naming flows in drag-and-drop spec

M1900ba60e8bf
diff --git a/control-ui/e2e/gfs-drag-and-drop.spec.ts b/control-ui/e2e/gfs-drag-and-drop.spec.ts
index 2ef88c2fa..ffe20e409 100644
--- a/control-ui/e2e/gfs-drag-and-drop.spec.ts
+++ b/control-ui/e2e/gfs-drag-and-drop.spec.ts
@@ -445,4 +445,88 @@ test.describe('EvenDrive drag and drop', () => {
await cleanupGfsDragDropFixtures(page.request, new Set([parentName, fileName]))
}
})
+
+ test('folder move with a name conflict numbered-renames when opted in', async ({ page }) => {
+ const parentName = fixtureName('conflict-parent')
+ const sourceName = fixtureName('clash')
+ const destinationName = fixtureName('bin')
+ try {
+ await beginJourney(page)
+ await createFolderViaUi(page, parentName)
+ await openFolderViaUi(page, parentName)
+ await createFolderViaUi(page, sourceName)
+ await createFolderViaUi(page, destinationName)
+ // Seed the destination with a same-named folder so the move conflicts.
+ await openFolderViaUi(page, destinationName)
+ await createFolderViaUi(page, sourceName)
+ await goUpToFolderViaUi(page, parentName)
+
+ await dragRowToRow(page, resourceRow(page, sourceName), resourceRow(page, destinationName))
+ const dialog = page.getByRole('dialog', {
+ name: `Move folder ${sourceName} to ${destinationName}`,
+ exact: true,
+ })
+ await expect(dialog).toBeVisible({ timeout: 20_000 })
+ const numberedToggle = dialog.getByLabel(/Use a numbered name if needed/)
+ await expect(numberedToggle).toBeVisible()
+ await numberedToggle.check()
+ await dialog.getByRole('button', { name: 'Move', exact: true }).click()
+
+ await expect(
+ toast(page, `Moved "${sourceName}" to "${destinationName}" as "${sourceName} (1)".`)
+ ).toBeVisible({ timeout: 30_000 })
+ await openFolderViaUi(page, destinationName)
+ await expect(resourceRow(page, `${sourceName} (1)`)).toBeVisible({ timeout: 20_000 })
+ } finally {
+ await cleanupGfsDragDropFixtures(
+ page.request,
+ new Set([parentName, sourceName, `${sourceName} (1)`, destinationName])
+ )
+ }
+ })
+
+ test('folder move with a name conflict refuses without the numbered-name opt-in', async ({
+ page,
+ }) => {
+ const parentName = fixtureName('clash-parent')
+ const sourceName = fixtureName('stubborn')
+ const destinationName = fixtureName('vault')
+ try {
+ await beginJourney(page)
+ await createFolderViaUi(page, parentName)
+ await openFolderViaUi(page, parentName)
+ await createFolderViaUi(page, sourceName)
+ await createFolderViaUi(page, destinationName)
+ await openFolderViaUi(page, destinationName)
+ await createFolderViaUi(page, sourceName)
+ await goUpToFolderViaUi(page, parentName)
+
+ await dragRowToRow(page, resourceRow(page, sourceName), resourceRow(page, destinationName))
+ const dialog = page.getByRole('dialog', {
+ name: `Move folder ${sourceName} to ${destinationName}`,
+ exact: true,
+ })
+ await expect(dialog).toBeVisible({ timeout: 20_000 })
+ // Leave "Use a numbered name if needed" unchecked.
+ await dialog.getByRole('button', { name: 'Move', exact: true }).click()
+ await page.waitForTimeout(1500)
+ const toastTexts = await page.locator('.cu-toast').allTextContents()
+ // eslint-disable-next-line no-console
+ console.log('POST-MOVE-TOASTS:', JSON.stringify(toastTexts))
+
+ await expect(
+ toast(
+ page,
+ 'An item with this name already exists. Choose another folder, or use Move to change its name.'
+ )
+ ).toBeVisible({ timeout: 30_000 })
+ // The source folder did not move.
+ await expect(resourceRow(page, sourceName)).toBeVisible({ timeout: 20_000 })
+ } finally {
+ await cleanupGfsDragDropFixtures(
+ page.request,
+ new Set([parentName, sourceName, destinationName])
+ )
+ }
+ })
})
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 3dee10cc4..b91d7ddbb 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.731",
+ "version": "0.1.732",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.731",
+ "version": "0.1.732",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index c20794cdc..b587ca335 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.731",
+ "version": "0.1.732",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",