mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
test: Migrate NPS from Cypress -> Playwright (#18535)
This commit is contained in:
@@ -423,4 +423,15 @@ export class CanvasPage extends BasePage {
|
||||
await this.canvasPane().focus();
|
||||
await this.page.keyboard.press(keyMap[direction]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Visit the workflow page with a specific timestamp for NPS survey testing.
|
||||
* Uses Playwright's clock API to set a fixed time.
|
||||
*/
|
||||
async visitWithTimestamp(timestamp: number): Promise<void> {
|
||||
// Set fixed time using Playwright's clock API
|
||||
await this.page.clock.setFixedTime(timestamp);
|
||||
|
||||
await this.page.goto('/workflow/new');
|
||||
}
|
||||
}
|
||||
|
||||
57
packages/testing/playwright/pages/NpsSurveyPage.ts
Normal file
57
packages/testing/playwright/pages/NpsSurveyPage.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import type { Locator, Page } from '@playwright/test';
|
||||
|
||||
import { BasePage } from './BasePage';
|
||||
|
||||
export class NpsSurveyPage extends BasePage {
|
||||
constructor(page: Page) {
|
||||
super(page);
|
||||
}
|
||||
|
||||
getNpsSurveyModal(): Locator {
|
||||
return this.page.getByTestId('nps-survey-modal');
|
||||
}
|
||||
|
||||
getNpsSurveyRatings(): Locator {
|
||||
return this.page.getByTestId('nps-survey-ratings');
|
||||
}
|
||||
|
||||
getNpsSurveyFeedback(): Locator {
|
||||
return this.page.getByTestId('nps-survey-feedback');
|
||||
}
|
||||
|
||||
getNpsSurveySubmitButton(): Locator {
|
||||
return this.page.getByTestId('nps-survey-feedback-button');
|
||||
}
|
||||
|
||||
getNpsSurveyCloseButton(): Locator {
|
||||
return this.getNpsSurveyModal().locator('button.el-drawer__close-btn');
|
||||
}
|
||||
|
||||
getRatingButton(rating: number): Locator {
|
||||
return this.getNpsSurveyRatings().locator('button').nth(rating);
|
||||
}
|
||||
|
||||
getFeedbackTextarea(): Locator {
|
||||
return this.getNpsSurveyFeedback().locator('textarea');
|
||||
}
|
||||
|
||||
async clickRating(rating: number): Promise<void> {
|
||||
await this.getRatingButton(rating).click();
|
||||
}
|
||||
|
||||
async fillFeedback(feedback: string): Promise<void> {
|
||||
await this.getFeedbackTextarea().fill(feedback);
|
||||
}
|
||||
|
||||
async clickSubmitButton(): Promise<void> {
|
||||
await this.getNpsSurveySubmitButton().click();
|
||||
}
|
||||
|
||||
async closeSurvey(): Promise<void> {
|
||||
await this.getNpsSurveyCloseButton().click();
|
||||
}
|
||||
|
||||
async getRatingButtonCount(): Promise<number> {
|
||||
return await this.getNpsSurveyRatings().locator('button').count();
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import { ExecutionsPage } from './ExecutionsPage';
|
||||
import { IframePage } from './IframePage';
|
||||
import { NodeDisplayViewPage } from './NodeDisplayViewPage';
|
||||
import { NotificationsPage } from './NotificationsPage';
|
||||
import { NpsSurveyPage } from './NpsSurveyPage';
|
||||
import { ProjectSettingsPage } from './ProjectSettingsPage';
|
||||
import { SettingsPage } from './SettingsPage';
|
||||
import { SidebarPage } from './SidebarPage';
|
||||
@@ -31,6 +32,7 @@ export class n8nPage {
|
||||
|
||||
readonly iframe: IframePage;
|
||||
readonly ndv: NodeDisplayViewPage;
|
||||
readonly npsSurvey: NpsSurveyPage;
|
||||
readonly projectSettings: ProjectSettingsPage;
|
||||
readonly settings: SettingsPage;
|
||||
readonly versions: VersionsPage;
|
||||
@@ -60,6 +62,7 @@ export class n8nPage {
|
||||
|
||||
this.iframe = new IframePage(page);
|
||||
this.ndv = new NodeDisplayViewPage(page);
|
||||
this.npsSurvey = new NpsSurveyPage(page);
|
||||
this.projectSettings = new ProjectSettingsPage(page);
|
||||
this.settings = new SettingsPage(page);
|
||||
this.versions = new VersionsPage(page);
|
||||
|
||||
Reference in New Issue
Block a user