mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
fix(editor): Fix for broken selectors for workflows tests (no-changelog) (#4734)
Fixing broken selectors for workflows tests
This commit is contained in:
committed by
GitHub
parent
2d31720b82
commit
e3aeaa9a87
@@ -26,15 +26,14 @@ describe('Workflow Actions', () => {
|
||||
WorkflowPage.actions.visit();
|
||||
});
|
||||
|
||||
it('should be able to save on button slick', () => {
|
||||
it('should be able to save on button click', () => {
|
||||
WorkflowPage.actions.saveWorkflowOnButtonClick();
|
||||
// In Element UI, disabled button turn into spans 🤷♂️
|
||||
WorkflowPage.getters.saveButton().should('match', 'span');
|
||||
WorkflowPage.getters.isWorkflowSaved();
|
||||
});
|
||||
|
||||
it('should save workflow on keyboard shortcut', () => {
|
||||
WorkflowPage.actions.saveWorkflowUsingKeyboardShortcut();
|
||||
WorkflowPage.getters.saveButton().should('match', 'span');
|
||||
WorkflowPage.getters.isWorkflowSaved();
|
||||
});
|
||||
|
||||
it('should not be able to activate unsaved workflow', () => {
|
||||
@@ -52,19 +51,20 @@ describe('Workflow Actions', () => {
|
||||
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
|
||||
WorkflowPage.actions.saveWorkflowOnButtonClick();
|
||||
WorkflowPage.actions.activateWorkflow();
|
||||
WorkflowPage.getters.activatorSwitch().should('have.class', 'is-checked');
|
||||
WorkflowPage.getters.isWorkflowActivated();
|
||||
});
|
||||
|
||||
it('should save new workflow after renaming', () => {
|
||||
WorkflowPage.actions.renameWorkflow(NEW_WORKFLOW_NAME);
|
||||
WorkflowPage.getters.saveButton().should('match', 'span');
|
||||
WorkflowPage.getters.isWorkflowSaved();
|
||||
});
|
||||
|
||||
it('should rename workflow', () => {
|
||||
WorkflowPage.actions.addNodeToCanvas(SCHEDULE_TRIGGER_NODE_NAME);
|
||||
WorkflowPage.actions.saveWorkflowOnButtonClick();
|
||||
WorkflowPage.actions.renameWorkflow(NEW_WORKFLOW_NAME);
|
||||
WorkflowPage.getters.saveButton().should('match', 'span');
|
||||
WorkflowPage.getters.workflowNameInput().invoke('attr', 'title').should('eq', NEW_WORKFLOW_NAME);
|
||||
WorkflowPage.getters.isWorkflowSaved();
|
||||
WorkflowPage.getters.workflowNameInputContainer().invoke('attr', 'title').should('eq', NEW_WORKFLOW_NAME);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -3,9 +3,13 @@ import { BasePage } from './base';
|
||||
export class WorkflowPage extends BasePage {
|
||||
url = '/workflow/new';
|
||||
getters = {
|
||||
workflowNameInput: () => cy.getByTestId('workflow-name-input'),
|
||||
workflowNameInputContainer: () => cy
|
||||
.getByTestId('workflow-name-input', { timeout: 5000 }),
|
||||
workflowNameInput: () => this.getters.workflowNameInputContainer().then(($el) => cy.wrap($el.find('input'))),
|
||||
workflowImportInput: () => cy.getByTestId('workflow-import-input'),
|
||||
workflowTags: () => cy.getByTestId('workflow-tags'),
|
||||
workflowTagsContainer: () => cy.getByTestId('workflow-tags-container'),
|
||||
newTagLink: () => cy.getByTestId('new-tag-link'),
|
||||
saveButton: () => cy.getByTestId('workflow-save-button'),
|
||||
|
||||
nodeCreatorSearchBar: () => cy.getByTestId('node-creator-search-bar'),
|
||||
@@ -24,9 +28,15 @@ export class WorkflowPage extends BasePage {
|
||||
activatorSwitch: () => cy.getByTestId('workflow-activate-switch'),
|
||||
workflowMenu: () => cy.getByTestId('workflow-menu'),
|
||||
firstStepButton: () => cy.getByTestId('canvas-add-button'),
|
||||
isWorkflowSaved: () => this.getters.saveButton().should('match', 'span'), // In Element UI, disabled button turn into spans 🤷♂️
|
||||
isWorkflowActivated: () => this.getters.activatorSwitch().should('have.class', 'is-checked'),
|
||||
};
|
||||
|
||||
actions = {
|
||||
visit: () => {
|
||||
cy.visit(this.url);
|
||||
cy.getByTestId('node-view-loader', { timeout: 5000 }).should('not.exist');
|
||||
cy.get('.el-loading-mask', { timeout: 5000 }).should('not.exist');
|
||||
},
|
||||
addInitialNodeToCanvas: (nodeDisplayName: string) => {
|
||||
this.getters.canvasPlusButton().click();
|
||||
this.getters.nodeCreatorSearchBar().type(nodeDisplayName);
|
||||
@@ -46,11 +56,6 @@ export class WorkflowPage extends BasePage {
|
||||
executeNodeFromNdv: () => {
|
||||
cy.contains('Execute node').click();
|
||||
},
|
||||
visit: () => {
|
||||
cy.visit(this.url);
|
||||
cy.getByTestId('node-view-loader', { timeout: 5000 }).should('not.exist');
|
||||
cy.get('.el-loading-mask', { timeout: 5000 }).should('not.exist');
|
||||
},
|
||||
openWorkflowMenu: () => {
|
||||
this.getters.workflowMenu().click();
|
||||
},
|
||||
@@ -66,10 +71,18 @@ export class WorkflowPage extends BasePage {
|
||||
cy.get('body').type('{esc}');
|
||||
},
|
||||
renameWorkflow: (newName: string) => {
|
||||
this.getters.workflowNameInput().click();
|
||||
this.getters.workflowNameInputContainer().click();
|
||||
cy.get('body').type('{selectall}');
|
||||
cy.get('body').type(newName);
|
||||
cy.get('body').type('{enter}');
|
||||
},
|
||||
addTags: (tags: string[]) => {
|
||||
this.getters.newTagLink().click();
|
||||
tags.forEach(tag => {
|
||||
cy.get('body').type(tag);
|
||||
cy.get('body').type('{enter}');
|
||||
});
|
||||
cy.get('body').type('{enter}');
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user