n8n/cypress/pages/demo.ts
Iván Ovejero af3ac2db28
refactor: Set up Cypress as pnpm workspace (no-changelog) (#6049)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2024-06-10 15:49:50 +02:00

21 lines
499 B
TypeScript

/**
* Actions
*/
export function vistDemoPage(theme?: 'dark' | 'light') {
const query = theme ? `?theme=${theme}` : '';
cy.visit('/workflows/demo' + query);
cy.waitForLoad();
cy.window().then((win) => {
win.preventNodeViewBeforeUnload = true;
});
}
export function importWorkflow(workflow: object) {
const OPEN_WORKFLOW = { command: 'openWorkflow', workflow };
cy.window().then(($window) => {
const message = JSON.stringify(OPEN_WORKFLOW);
$window.postMessage(message, '*');
});
}