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"]'),
|
2024-01-12 02:10:39 -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
|
|
|
|
2024-01-12 02:10:39 -08:00
|
|
|
openTemplate: (template: {
|
|
|
|
workflow: {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
description: string;
|
|
|
|
user: { username: string };
|
|
|
|
image: { id: number; url: string }[];
|
|
|
|
};
|
2024-02-09 04:47:43 -08:00
|
|
|
}, templateHost: string) => {
|
|
|
|
cy.intercept('GET', `${templateHost}/api/templates/workflows/${template.workflow.id}`, {
|
2023-12-18 08:40:00 -08:00
|
|
|
statusCode: 200,
|
|
|
|
body: template,
|
|
|
|
}).as('getTemplate');
|
|
|
|
|
|
|
|
this.actions.visit(template.workflow.id);
|
|
|
|
cy.wait('@getTemplate');
|
|
|
|
},
|
2023-11-27 07:18:10 -08:00
|
|
|
};
|
|
|
|
}
|