Skip to content

Commit cb9e047

Browse files
committed
Add E2E test for Move (F6)
1 parent 682d33a commit cb9e047

1 file changed

Lines changed: 62 additions & 9 deletions

File tree

apps/desktop/test/e2e-linux/app.spec.ts

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ async function pressSpaceKey(): Promise<void> {
103103
// ModalDialog renders as .modal-overlay[data-dialog-id] > .modal-dialog,
104104
// with no dialog-specific CSS class. Use data-dialog-id to target each dialog.
105105
const MKDIR_DIALOG = '[data-dialog-id="mkdir-confirmation"]'
106-
const COPY_DIALOG = '[data-dialog-id="copy-confirmation"]'
106+
const TRANSFER_DIALOG = '[data-dialog-id="transfer-confirmation"]'
107107

108108
// ─── Tests ──────────────────────────────────────────────────────────────────
109109

@@ -443,7 +443,7 @@ describe('New folder dialog', () => {
443443
})
444444
})
445445

446-
describe('Copy dialog', () => {
446+
describe('Transfer dialogs', () => {
447447
it('opens copy dialog with F5', async () => {
448448
await ensureAppReadyWithFocus()
449449

@@ -459,21 +459,74 @@ describe('Copy dialog', () => {
459459
// Press F5 to open copy dialog
460460
await browser.keys('F5')
461461

462-
// Wait for copy dialog to appear
462+
// Wait for transfer dialog to appear
463463
const modalOverlay = await browser.$('.modal-overlay')
464464
await modalOverlay.waitForExist({ timeout: 5000 })
465465

466-
const copyDialog = await browser.$(COPY_DIALOG)
467-
await copyDialog.waitForExist({ timeout: 5000 })
466+
const dialog = await browser.$(TRANSFER_DIALOG)
467+
await dialog.waitForExist({ timeout: 5000 })
468+
469+
// Verify title contains "Copy"
470+
const title = await browser.$(`${TRANSFER_DIALOG} h2`)
471+
expect(await title.getText()).toContain('Copy')
468472

469473
// Verify dialog has path input
470-
const pathInput = await browser.$(`${COPY_DIALOG} .path-input`)
474+
const pathInput = await browser.$(`${TRANSFER_DIALOG} .path-input`)
471475
expect(await pathInput.isExisting()).toBe(true)
472476

473-
// Verify dialog has Copy and Cancel buttons
474-
const copyButton = await browser.$(`${COPY_DIALOG} button.primary`)
475-
const cancelButton = await browser.$(`${COPY_DIALOG} button.secondary`)
477+
// Verify primary button says "Copy"
478+
const copyButton = await browser.$(`${TRANSFER_DIALOG} button.primary`)
479+
const cancelButton = await browser.$(`${TRANSFER_DIALOG} button.secondary`)
476480
expect(await copyButton.isExisting()).toBe(true)
481+
expect(await copyButton.getText()).toBe('Copy')
482+
expect(await cancelButton.isExisting()).toBe(true)
483+
484+
// Close dialog with Escape
485+
await browser.keys('Escape')
486+
await browser.pause(300)
487+
488+
// Verify dialog is closed
489+
const modalAfter = await browser.$('.modal-overlay')
490+
expect(await modalAfter.isExisting()).toBe(false)
491+
})
492+
493+
it('opens move dialog with F6', async () => {
494+
await ensureAppReadyWithFocus()
495+
496+
// Move cursor to a file (skip ".." entry)
497+
const cursorEntry = (await browser.$('.file-entry.is-under-cursor')) as unknown as WebdriverIO.Element
498+
const cursorText = await getEntryName(cursorEntry)
499+
500+
if (cursorText === '..') {
501+
await browser.keys('ArrowDown')
502+
await browser.pause(300)
503+
}
504+
505+
// Press F6 to open move dialog
506+
await browser.keys('F6')
507+
508+
// Wait for transfer dialog to appear
509+
const modalOverlay = await browser.$('.modal-overlay')
510+
await modalOverlay.waitForExist({ timeout: 5000 })
511+
512+
const dialog = await browser.$(TRANSFER_DIALOG)
513+
await dialog.waitForExist({ timeout: 5000 })
514+
515+
// Verify title contains "Move" (not "Copy")
516+
const title = await browser.$(`${TRANSFER_DIALOG} h2`)
517+
const titleText = await title.getText()
518+
expect(titleText).toContain('Move')
519+
expect(titleText).not.toContain('Copy')
520+
521+
// Verify dialog has path input
522+
const pathInput = await browser.$(`${TRANSFER_DIALOG} .path-input`)
523+
expect(await pathInput.isExisting()).toBe(true)
524+
525+
// Verify primary button says "Move"
526+
const moveButton = await browser.$(`${TRANSFER_DIALOG} button.primary`)
527+
const cancelButton = await browser.$(`${TRANSFER_DIALOG} button.secondary`)
528+
expect(await moveButton.isExisting()).toBe(true)
529+
expect(await moveButton.getText()).toBe('Move')
477530
expect(await cancelButton.isExisting()).toBe(true)
478531

479532
// Close dialog with Escape

0 commit comments

Comments
 (0)