n8n/cypress/pages/template-workflow.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
860 B
TypeScript
Raw Normal View History

import { BasePage } from './base';
export class TemplateWorkflowPage extends BasePage {
url = '/templates';
getters = {
useTemplateButton: () => cy.get('[data-test-id="use-template-button"]'),
description: () => cy.get('[data-test-id="template-description"]')
};
actions = {
visit: (templateId: number) => {
cy.visit(`${this.url}/${templateId}`);
},
clickUseThisWorkflowButton: () => {
this.getters.useTemplateButton().click();
},
openTemplate: (template: {workflow: {id: number, name: string, description: string, user: {username: string}, image: {id: number, url: string}[] }}) => {
cy.intercept('GET', `https://api.n8n.io/api/templates/workflows/${template.workflow.id}`, {
statusCode: 200,
body: template,
}).as('getTemplate');
this.actions.visit(template.workflow.id);
cy.wait('@getTemplate');
},
};
}