mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-17 13:39:44 +02:00
test: Stabilize the project move-resources spec (no-changelog) (#39906)
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
6918fda018
commit
834202d124
|
|
@ -108,7 +108,15 @@ export class WorkflowComposer {
|
|||
await this.selectFolderInMoveModal(folder);
|
||||
}
|
||||
|
||||
// The list only refetches after the transfer has completed. Waiting for the
|
||||
// request keeps the next navigation from reading the pre-move state.
|
||||
const transferred = this.n8n.page.waitForResponse(
|
||||
(response) =>
|
||||
response.request().method() === 'PUT' &&
|
||||
/\/rest\/workflows\/[^/]+\/transfer$/.test(response.url()),
|
||||
);
|
||||
await this.n8n.resourceMoveModal.clickConfirmMoveButton();
|
||||
expect((await transferred).ok()).toBe(true);
|
||||
}
|
||||
|
||||
private async selectProjectInMoveModal(projectNameOrEmail: string): Promise<void> {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@ import { expect, type Locator } from '@playwright/test';
|
|||
|
||||
import { BasePage } from './BasePage';
|
||||
|
||||
/** Any page of a project: /projects/<id>/workflows, /projects/<id>/credentials, ... */
|
||||
const PROJECT_ROUTE = /\/projects\/[^/]+\//;
|
||||
|
||||
export class SidebarPage extends BasePage {
|
||||
get container() {
|
||||
return this.page.locator('#side-menu');
|
||||
|
|
@ -36,8 +39,15 @@ export class SidebarPage extends BasePage {
|
|||
await this.container.getByTestId('project-home-menu-item').click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Both project clicks wait for the project route. A click issued while a list
|
||||
* view is still initializing can be cancelled by that view's own
|
||||
* `router.replace` of its query string; then the page stays where it was and
|
||||
* the caller's assertions run against the wrong list.
|
||||
*/
|
||||
async clickPersonalMenuItem() {
|
||||
await this.container.getByTestId('project-personal-menu-item').click();
|
||||
await this.page.waitForURL(PROJECT_ROUTE);
|
||||
}
|
||||
|
||||
async clickWorkflowsLink(): Promise<void> {
|
||||
|
|
@ -92,6 +102,7 @@ export class SidebarPage extends BasePage {
|
|||
async clickProjectMenuItem(projectName: string) {
|
||||
await this.expand();
|
||||
await this.getProjectMenuItems().filter({ hasText: projectName }).click();
|
||||
await this.page.waitForURL(PROJECT_ROUTE);
|
||||
}
|
||||
|
||||
getSettings(): Locator {
|
||||
|
|
|
|||
|
|
@ -63,6 +63,11 @@ test.describe(
|
|||
|
||||
// Navigate to home to load sidebar with new projects
|
||||
await n8n.goHome();
|
||||
// The Overview lists the three workflows created above. Waiting for them
|
||||
// lets the view finish its first initialization, which ends with a
|
||||
// `router.replace` of the query string. A sidebar click that lands during
|
||||
// that replace is cancelled and the page stays on the Overview.
|
||||
await expect(n8n.workflows.cards.getWorkflows()).toHaveCount(3);
|
||||
});
|
||||
|
||||
test('should move the workflow to expected projects @auth:owner', async ({ n8n }) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user