n8n/cypress/pages/templates.ts
Mutasem Aldmour 2854a0cf46
fix(editor): Allow overriding theme from query params (#7591)
Allow overriding theme through query params.. to be able to override it
from preview iframe in webcomponent

Github issue / Community forum post (link here to close automatically):
2023-11-02 16:06:33 +01:00

49 lines
1.1 KiB
TypeScript

import { BasePage } from './base';
export class TemplatesPage extends BasePage {
url = '/templates';
getters = {
};
actions = {
openOnboardingFlow: (id: number, name: string , workflow: object) => {
const apiResponse = {
id,
name,
workflow,
};
cy.intercept('POST', '/rest/workflows').as('createWorkflow');
cy.intercept('GET', `https://api.n8n.io/api/workflows/templates/${id}`, {
statusCode: 200,
body: apiResponse,
}).as('getTemplate');
cy.intercept('GET', 'rest/workflows/**').as('getWorkflow');
cy.visit(`/workflows/onboarding/${id}`);
cy.wait('@getTemplate');
cy.wait(['@createWorkflow', '@getWorkflow']);
},
importTemplate: (id: number, name: string, workflow: object) => {
const apiResponse = {
id,
name,
workflow,
};
cy.intercept('GET', `https://api.n8n.io/api/workflows/templates/${id}`, {
statusCode: 200,
body: apiResponse,
}).as('getTemplate');
cy.intercept('GET', 'rest/workflows/**').as('getWorkflow');
cy.visit(`/workflows/templates/${id}`);
cy.wait('@getTemplate');
cy.wait( '@getWorkflow');
}
}
}