1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-07-14 16:30:27 +03:00

Adding workflow history tests

This commit is contained in:
Milorad Filipovic 2024-06-05 16:45:50 +02:00
parent 7622c72022
commit dfc0133d59
2 changed files with 45 additions and 0 deletions

View File

@ -0,0 +1,43 @@
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
import { getVisibleSelect } from '../utils';
const WorkflowPage = new WorkflowPageClass();
describe('Editor actions should work', () => {
beforeEach(() => {
cy.enableFeature('workflowHistory');
WorkflowPage.actions.visit();
});
afterEach(() => {
cy.disableFeature('workflowHistory');
});
it('should create new workflow version when settings are updated', () => {
WorkflowPage.actions.addInitialNodeToCanvas('Manual');
WorkflowPage.actions.saveWorkflowOnButtonClick();
WorkflowPage.getters.workflowHistoryButton().should('be.enabled');
WorkflowPage.getters.workflowHistoryButton().click();
cy.url().should('include', '/history');
WorkflowPage.getters.workflowHistoryItems().its('length').should('be.greaterThan', 0);
WorkflowPage.getters.workflowHistoryItems().its('length').then((initialVersionCount) => {
WorkflowPage.getters.workflowHistoryCloseButton().click();
WorkflowPage.getters.workflowMenu().should('be.visible');
WorkflowPage.getters.workflowMenu().click();
WorkflowPage.getters.workflowMenuItemSettings().should('be.visible');
WorkflowPage.getters.workflowMenuItemSettings().click();
// Update manual executions settings
WorkflowPage.getters.workflowSettingsSaveManualExecutionsSelect().click();
getVisibleSelect().find('li').should('have.length', 3);
getVisibleSelect().find('li').last().click({ force: true });
// Save settings
WorkflowPage.getters.workflowSettingsSaveButton().click();
WorkflowPage.getters.workflowSettingsModal().should('not.exist');
WorkflowPage.getters.successToast().should('exist');
// Check if new version was created
WorkflowPage.getters.workflowHistoryButton().should('be.enabled');
WorkflowPage.getters.workflowHistoryButton().click();
WorkflowPage.getters.workflowHistoryItems().its('length').should('be.greaterThan', initialVersionCount);
});
});
});

View File

@ -131,6 +131,8 @@ export class WorkflowPage extends BasePage {
stickies: () => cy.getByTestId('sticky'),
editorTabButton: () => cy.getByTestId('radio-button-workflow'),
workflowHistoryButton: () => cy.getByTestId('workflow-history-button'),
workflowHistoryItems: () => cy.getByTestId('workflow-history-list-item'),
workflowHistoryCloseButton: () => cy.getByTestId('workflow-history-close-button'),
colors: () => cy.getByTestId('color'),
contextMenuAction: (action: string) => cy.getByTestId(`context-menu-item-${action}`),
};