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-06-10 06:49:50 -07:00
|
|
|
openTemplate: (
|
|
|
|
template: {
|
|
|
|
workflow: {
|
|
|
|
id: number;
|
|
|
|
name: string;
|
|
|
|
description: string;
|
|
|
|
user: { username: string };
|
|
|
|
image: Array<{ id: number; url: string }>;
|
|
|
|
};
|
|
|
|
},
|
|
|
|
templateHost: string,
|
|
|
|
) => {
|
2024-02-09 04:47:43 -08:00
|
|
|
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
|
|
|
};
|
|
|
|
}
|