2023-11-27 07:18:10 -08:00
|
|
|
import { BasePage } from './base';
|
|
|
|
|
|
|
|
export class TemplateWorkflowPage extends BasePage {
|
|
|
|
url = '/templates';
|
|
|
|
|
|
|
|
getters = {
|
|
|
|
useTemplateButton: () => cy.get('[data-test-id="use-template-button"]'),
|
2023-12-18 08:40:00 -08:00
|
|
|
description: () => cy.get('[data-test-id="template-description"]')
|
2023-11-27 07:18:10 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
actions = {
|
|
|
|
visit: (templateId: number) => {
|
|
|
|
cy.visit(`${this.url}/${templateId}`);
|
|
|
|
},
|
|
|
|
|
|
|
|
clickUseThisWorkflowButton: () => {
|
|
|
|
this.getters.useTemplateButton().click();
|
|
|
|
},
|
2023-12-18 08:40:00 -08:00
|
|
|
|
|
|
|
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');
|
|
|
|
},
|
2023-11-27 07:18:10 -08:00
|
|
|
};
|
|
|
|
}
|