n8n/cypress/pages/workflows.ts
OlegIvaniv f89ef83c76
feat(editor): Prevent saving of workflow when canvas is loading (#6497)
* feat(editor): Prevent saving of pristine workflow

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Prevent saving if loading

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Fix 7-workflow-actions spec

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Restrict delay intercept to GET only

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Wait for WF patch

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Add helper to remove all active WFs in e2e

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Use META_KEY env var

* Remove cy.wait

* Delete debugging DB reset console log

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Fix clashin mixins `isReadOnly` property

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

---------

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
2023-06-27 13:05:20 +02:00

46 lines
1.8 KiB
TypeScript

import { BasePage } from './base';
export class WorkflowsPage extends BasePage {
url = '/workflows';
getters = {
newWorkflowButtonCard: () => cy.getByTestId('new-workflow-card'),
newWorkflowTemplateCard: () => cy.getByTestId('new-workflow-template-card'),
searchBar: () => cy.getByTestId('resources-list-search').find('input'),
createWorkflowButton: () => cy.getByTestId('resources-list-add'),
workflowCards: () => cy.getByTestId('resources-list-item'),
workflowCard: (workflowName: string) =>
this.getters
.workflowCards()
.contains(workflowName)
.parents('[data-test-id="resources-list-item"]'),
workflowTags: (workflowName: string) =>
this.getters.workflowCard(workflowName).findChildByTestId('workflow-card-tags'),
workflowActivator: (workflowName: string) =>
this.getters.workflowCard(workflowName).findChildByTestId('workflow-card-activator'),
workflowActivatorStatus: (workflowName: string) =>
this.getters.workflowActivator(workflowName).findChildByTestId('workflow-activator-status'),
workflowCardActions: (workflowName: string) =>
this.getters.workflowCard(workflowName).findChildByTestId('workflow-card-actions'),
workflowDeleteButton: () =>
cy.getByTestId('action-toggle-dropdown').filter(':visible').contains('Delete'),
// Not yet implemented
// myWorkflows: () => cy.getByTestId('my-workflows'),
// allWorkflows: () => cy.getByTestId('all-workflows'),
};
actions = {
createWorkflowFromCard: () => {
this.getters.newWorkflowButtonCard().click();
},
deleteWorkFlow: (name: string) => {
cy.visit(this.url);
this.getters.workflowCardActions(name).click();
this.getters.workflowDeleteButton().click();
cy.intercept('DELETE', '/rest/workflows/*').as('deleteWorkflow');
cy.get('button').contains('delete').click();
cy.wait('@deleteWorkflow');
},
};
}