mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 04:34:06 -08:00
39 lines
917 B
TypeScript
39 lines
917 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 }[];
|
|
};
|
|
}, templateHost: string) => {
|
|
cy.intercept('GET', `${templateHost}/api/templates/workflows/${template.workflow.id}`, {
|
|
statusCode: 200,
|
|
body: template,
|
|
}).as('getTemplate');
|
|
|
|
this.actions.visit(template.workflow.id);
|
|
cy.wait('@getTemplate');
|
|
},
|
|
};
|
|
}
|