mirror of
https://github.com/n8n-io/n8n.git
synced 2026-07-28 19:45:09 +02:00
Some checks are pending
CI: Master (Build, Test, Lint) / Build for Github Cache (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (22.22.3) (push) Waiting to run
CI: Master (Build, Test, Lint) / Unit tests (24.16.0) (push) Waiting to run
CI: Master (Build, Test, Lint) / Lint (push) Waiting to run
CI: Master (Build, Test, Lint) / Performance (push) Waiting to run
CI: Master (Build, Test, Lint) / Notify Slack on failure (push) Blocked by required conditions
Co-authored-by: n8n-cat-bot[bot] <n8n-cat-bot[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import type { Locator } from '@playwright/test';
|
|
|
|
import { FloatingUiHelper } from './FloatingUiHelper';
|
|
|
|
/**
|
|
* Page object for interacting with move resource modals (MoveToFolderModal for workflows, ProjectMoveResourceModal for credentials).
|
|
*/
|
|
export class ResourceMoveModal extends FloatingUiHelper {
|
|
getProjectSelect(): Locator {
|
|
return this.page.getByTestId('project-sharing-select');
|
|
}
|
|
|
|
getProjectSelectCredential(): Locator {
|
|
return this.page.getByTestId('project-move-resource-modal-select');
|
|
}
|
|
|
|
getMoveConfirmButton(): Locator {
|
|
return this.page.getByTestId('confirm-move-folder-button');
|
|
}
|
|
|
|
getMoveCredentialButton(): Locator {
|
|
return this.page.getByRole('button', { name: 'Move credential' });
|
|
}
|
|
|
|
getFolderSelect(): Locator {
|
|
return this.page.getByTestId('move-to-folder-dropdown');
|
|
}
|
|
|
|
getFolderOption(folderName: string): Locator {
|
|
// move-to-folder options teleport out of the modal root (el-select popper), so resolve page-scoped
|
|
return this.page.getByTestId('move-to-folder-option').filter({ hasText: folderName });
|
|
}
|
|
|
|
async openProjectSelect(): Promise<void> {
|
|
await this.getProjectSelectCredential().locator('input').click();
|
|
}
|
|
|
|
getProjectOptions(): Locator {
|
|
return this.getVisiblePopoverOption();
|
|
}
|
|
|
|
async selectProjectOption(projectNameOrEmail: string): Promise<void> {
|
|
const options = this.getVisiblePopoverOption();
|
|
// Try to find by exact text (project name or email)
|
|
const byExact = options.filter({ hasText: projectNameOrEmail });
|
|
if ((await byExact.count()) > 0) {
|
|
await byExact.click();
|
|
} else {
|
|
// For personal projects, the email is not shown, so try matching by name part of email
|
|
const namePart = projectNameOrEmail.split('@')[0].replace(/[.-]/g, ' ');
|
|
await options
|
|
.filter({ hasText: new RegExp(namePart, 'i') })
|
|
.first()
|
|
.click();
|
|
}
|
|
}
|
|
|
|
async clickMoveCredentialButton(): Promise<void> {
|
|
await this.getMoveCredentialButton().click();
|
|
}
|
|
|
|
async clickConfirmMoveButton(): Promise<void> {
|
|
await this.getMoveConfirmButton().click();
|
|
}
|
|
}
|