2023-02-24 09:07:35 -08:00
|
|
|
import { WorkflowPage } from '../pages';
|
|
|
|
import { WorkflowExecutionsTab } from '../pages/workflow-executions-tab';
|
2023-12-14 02:50:00 -08:00
|
|
|
import type { RouteHandler } from 'cypress/types/net-stubbing';
|
2024-05-29 05:57:01 -07:00
|
|
|
import executionOutOfMemoryServerResponse from '../fixtures/responses/execution-out-of-memory-server-response.json';
|
2023-02-14 02:39:19 -08:00
|
|
|
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const executionsTab = new WorkflowExecutionsTab();
|
2023-12-14 02:50:00 -08:00
|
|
|
const executionsRefreshInterval = 4000;
|
2023-02-14 02:39:19 -08:00
|
|
|
|
|
|
|
// Test suite for executions tab
|
|
|
|
describe('Current Workflow Executions', () => {
|
2023-02-24 09:07:35 -08:00
|
|
|
beforeEach(() => {
|
2023-02-14 02:39:19 -08:00
|
|
|
workflowPage.actions.visit();
|
|
|
|
cy.createFixtureWorkflow('Test_workflow_4_executions_view.json', `My test workflow`);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should render executions tab correctly', () => {
|
2023-12-14 02:50:00 -08:00
|
|
|
createMockExecutions();
|
2023-03-02 07:50:21 -08:00
|
|
|
cy.intercept('GET', '/rest/executions?filter=*').as('getExecutions');
|
|
|
|
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
|
2024-04-18 22:50:18 -07:00
|
|
|
cy.wait(['@getExecutions']);
|
|
|
|
|
|
|
|
executionsTab.getters.executionsList().scrollTo(0, 500).wait(0);
|
2023-03-02 07:50:21 -08:00
|
|
|
|
2023-02-14 02:39:19 -08:00
|
|
|
executionsTab.getters.executionListItems().should('have.length', 11);
|
|
|
|
executionsTab.getters.successfulExecutionListItems().should('have.length', 9);
|
|
|
|
executionsTab.getters.failedExecutionListItems().should('have.length', 2);
|
2023-02-24 09:07:35 -08:00
|
|
|
executionsTab.getters
|
|
|
|
.executionListItems()
|
|
|
|
.first()
|
|
|
|
.invoke('attr', 'class')
|
|
|
|
.should('match', /_active_/);
|
2023-02-14 02:39:19 -08:00
|
|
|
});
|
2023-12-14 02:50:00 -08:00
|
|
|
|
|
|
|
it('should not redirect back to execution tab when request is not done before leaving the page', () => {
|
|
|
|
cy.intercept('GET', '/rest/executions?filter=*');
|
2024-01-23 00:48:50 -08:00
|
|
|
cy.intercept('GET', '/rest/executions/active?filter=*');
|
2023-12-14 02:50:00 -08:00
|
|
|
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
executionsTab.actions.switchToEditorTab();
|
|
|
|
cy.wait(executionsRefreshInterval);
|
|
|
|
cy.url().should('not.include', '/executions');
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
executionsTab.actions.switchToEditorTab();
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
executionsTab.actions.switchToEditorTab();
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
executionsTab.actions.switchToEditorTab();
|
|
|
|
cy.wait(executionsRefreshInterval);
|
|
|
|
cy.url().should('not.include', '/executions');
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
cy.wait(1000);
|
|
|
|
executionsTab.actions.switchToEditorTab();
|
|
|
|
cy.wait(executionsRefreshInterval);
|
|
|
|
cy.url().should('not.include', '/executions');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not redirect back to execution tab when slow request is not done before leaving the page', () => {
|
|
|
|
const throttleResponse: RouteHandler = (req) => {
|
|
|
|
return new Promise((resolve) => {
|
|
|
|
setTimeout(() => resolve(req.continue()), 2000);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
cy.intercept('GET', '/rest/executions?filter=*', throttleResponse);
|
2024-01-23 00:48:50 -08:00
|
|
|
cy.intercept('GET', '/rest/executions/active?filter=*', throttleResponse);
|
2023-12-14 02:50:00 -08:00
|
|
|
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
executionsTab.actions.switchToEditorTab();
|
|
|
|
cy.wait(executionsRefreshInterval);
|
|
|
|
cy.url().should('not.include', '/executions');
|
|
|
|
});
|
2024-05-27 03:44:04 -07:00
|
|
|
|
2024-05-29 05:57:01 -07:00
|
|
|
it('should error toast when server error message returned without stack trace', () => {
|
|
|
|
executionsTab.actions.createManualExecutions(1);
|
|
|
|
const message = 'Workflow did not finish, possible out-of-memory issue';
|
|
|
|
cy.intercept('GET', '/rest/executions/*', {
|
|
|
|
statusCode: 200,
|
|
|
|
body: executionOutOfMemoryServerResponse,
|
|
|
|
}).as('getExecution');
|
|
|
|
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
cy.wait(['@getExecution']);
|
|
|
|
|
|
|
|
cy.getByTestId('workflow-preview-iframe')
|
|
|
|
.should('be.visible')
|
|
|
|
.its('0.contentDocument.body') // Access the body of the iframe document
|
|
|
|
.should('not.be.empty') // Ensure the body is not empty
|
|
|
|
.then(cy.wrap)
|
|
|
|
.find('.el-notification:has(.el-notification--error)')
|
|
|
|
.should('be.visible')
|
|
|
|
.filter(`:contains("${message}")`)
|
|
|
|
.should('be.visible');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should auto load more items if there is space and auto scroll', () => {
|
2024-05-27 03:44:04 -07:00
|
|
|
cy.viewport(1280, 960);
|
|
|
|
executionsTab.actions.createManualExecutions(24);
|
|
|
|
|
|
|
|
cy.intercept('GET', '/rest/executions?filter=*').as('getExecutions');
|
|
|
|
cy.intercept('GET', '/rest/executions/*').as('getExecution');
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
|
|
|
|
cy.wait(['@getExecutions']);
|
|
|
|
executionsTab.getters.executionListItems().its('length').should('be.gte', 10);
|
|
|
|
|
|
|
|
cy.getByTestId('current-executions-list').scrollTo('bottom');
|
|
|
|
cy.wait(['@getExecutions']);
|
|
|
|
executionsTab.getters.executionListItems().should('have.length', 24);
|
|
|
|
|
|
|
|
executionsTab.getters.executionListItems().eq(14).click();
|
|
|
|
cy.wait(['@getExecution']);
|
|
|
|
cy.reload();
|
|
|
|
|
|
|
|
cy.wait(['@getExecutions']);
|
|
|
|
executionsTab.getters.executionListItems().eq(14).should('not.be.visible');
|
|
|
|
executionsTab.getters.executionListItems().should('have.length', 24);
|
|
|
|
executionsTab.getters.executionListItems().first().should('not.be.visible');
|
|
|
|
cy.getByTestId('current-executions-list').scrollTo(0, 0);
|
|
|
|
executionsTab.getters.executionListItems().first().should('be.visible');
|
|
|
|
executionsTab.getters.executionListItems().eq(14).should('not.be.visible');
|
|
|
|
|
|
|
|
executionsTab.actions.switchToEditorTab();
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
|
|
|
|
cy.wait(['@getExecutions']);
|
|
|
|
executionsTab.getters.executionListItems().eq(14).should('not.be.visible');
|
|
|
|
executionsTab.getters.executionListItems().should('have.length', 24);
|
|
|
|
executionsTab.getters.executionListItems().first().should('not.be.visible');
|
|
|
|
cy.getByTestId('current-executions-list').scrollTo(0, 0);
|
|
|
|
executionsTab.getters.executionListItems().first().should('be.visible');
|
|
|
|
executionsTab.getters.executionListItems().eq(14).should('not.be.visible');
|
|
|
|
});
|
2024-05-30 07:47:02 -07:00
|
|
|
|
|
|
|
it('should show workflow data in executions tab after hard reload', () => {
|
|
|
|
executionsTab.actions.switchToExecutionsTab();
|
|
|
|
checkMainHeaderELements();
|
|
|
|
|
|
|
|
cy.reload();
|
|
|
|
checkMainHeaderELements();
|
|
|
|
|
|
|
|
executionsTab.actions.switchToEditorTab();
|
|
|
|
checkMainHeaderELements();
|
|
|
|
});
|
2023-02-14 02:39:19 -08:00
|
|
|
});
|
|
|
|
|
|
|
|
const createMockExecutions = () => {
|
|
|
|
executionsTab.actions.createManualExecutions(5);
|
|
|
|
// Make some failed executions by enabling Code node with syntax error
|
|
|
|
executionsTab.actions.toggleNodeEnabled('Error');
|
|
|
|
executionsTab.actions.createManualExecutions(2);
|
|
|
|
// Then add some more successful ones
|
|
|
|
executionsTab.actions.toggleNodeEnabled('Error');
|
|
|
|
executionsTab.actions.createManualExecutions(4);
|
2023-02-24 09:07:35 -08:00
|
|
|
};
|
2024-05-30 07:47:02 -07:00
|
|
|
|
|
|
|
const checkMainHeaderELements = () => {
|
|
|
|
workflowPage.getters.workflowNameInputContainer().should('be.visible');
|
|
|
|
workflowPage.getters.workflowTagsContainer().should('be.visible');
|
|
|
|
workflowPage.getters.workflowMenu().should('be.visible');
|
|
|
|
workflowPage.getters.saveButton().should('be.visible');
|
|
|
|
};
|