mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-15 09:04:07 -08:00
39 lines
898 B
TypeScript
39 lines
898 B
TypeScript
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');
|
|
},
|
|
};
|
|
}
|