mirror of
https://github.com/n8n-io/n8n.git
synced 2026-09-21 04:37:50 +08:00
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
955 B
TypeScript
29 lines
955 B
TypeScript
import { BasePage } from './BasePage';
|
|
|
|
export class DemoPage extends BasePage {
|
|
async goto(options?: { theme?: 'dark' | 'light'; canExecute?: boolean }) {
|
|
const params = new URLSearchParams();
|
|
if (options?.theme) params.set('theme', options.theme);
|
|
if (options?.canExecute) params.set('canExecute', 'true');
|
|
const query = params.toString() ? `?${params.toString()}` : '';
|
|
await this.page.goto('/workflows/demo' + query);
|
|
await this.page.getByTestId('canvas-background').waitFor({ state: 'visible' });
|
|
}
|
|
|
|
/**
|
|
* Import a workflow into the demo page
|
|
* @param workflow - The workflow to import
|
|
*/
|
|
async importWorkflow(workflow: object) {
|
|
const OPEN_WORKFLOW = { command: 'openWorkflow', workflow };
|
|
await this.page.evaluate((message) => {
|
|
console.log('Posting message:', JSON.stringify(message));
|
|
window.postMessage(JSON.stringify(message), '*');
|
|
}, OPEN_WORKFLOW);
|
|
}
|
|
|
|
getBody() {
|
|
return this.page.locator('body');
|
|
}
|
|
}
|