Skip to content

Commit

Permalink
✅ Added e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MiloradFilipovic committed Dec 19, 2023
1 parent 7725df8 commit 418655c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 22 additions & 1 deletion cypress/e2e/29-templates.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,33 @@ describe('Templates', () => {
cy.url().then(($url) => {
expect($url).to.include('/workflow/new?templateId=1234');
});

workflowPage.getters.canvasNodes().should('have.length', 4);
workflowPage.getters.stickies().should('have.length', 1);
workflowPage.actions.shouldHaveWorkflowName(OnboardingWorkflow.name);
});

it('should save template id with the workflow', () => {
cy.intercept('POST', '/rest/workflows').as('saveWorkflow');
cy.visit(templatesPage.url);
templatesPage.getters.firstTemplateCard().click();
cy.url().should('include', '/templates/');

cy.url().then(($url) => {
const templateId = $url.split('/').pop();

templatesPage.getters.useTemplateButton().click();
cy.url().should('include', '/workflow/new');
workflowPage.actions.saveWorkflowOnButtonClick();

cy.wait('@saveWorkflow').then((interception) => {
expect(interception.request.body.meta.templateId).to.equal(templateId);
});
});


});

it('can open template with images and hides workflow screenshots', () => {
templateWorkflowPage.actions.openTemplate(WorkflowTemplate);

Expand Down
4 changes: 3 additions & 1 deletion cypress/pages/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export class TemplatesPage extends BasePage {
url = '/templates';

getters = {
useTemplateButton: () => cy.get('[data-testid="use-template-button"]'),
useTemplateButton: () => cy.getByTestId('use-template-button'),
templateCards: () => cy.getByTestId('template-card'),
firstTemplateCard: () => this.getters.templateCards().first(),
};

actions = {
Expand Down

0 comments on commit 418655c

Please sign in to comment.