Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(editor): Fix deletion of last execution at execution preview #7883

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion cypress/e2e/19-execution.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { v4 as uuid } from 'uuid';
import { NDV, WorkflowPage as WorkflowPageClass, WorkflowsPage } from '../pages';
import { NDV, WorkflowExecutionsTab, WorkflowPage as WorkflowPageClass } from '../pages';

const workflowPage = new WorkflowPageClass();
const executionsTab = new WorkflowExecutionsTab();
const ndv = new NDV();

describe('Execution', () => {
Expand Down Expand Up @@ -274,4 +275,17 @@ describe('Execution', () => {
// Check success toast (works because Cypress waits enough for the element to show after the http request node has finished)
workflowPage.getters.successToast().should('be.visible');
});

describe('execution preview', () => {
it('when deleting the last execution, it should show empty state', () => {
workflowPage.actions.addInitialNodeToCanvas('Manual Trigger');
workflowPage.actions.executeWorkflow();
executionsTab.actions.switchToExecutionsTab();

executionsTab.actions.deleteExecutionInPreview();

executionsTab.getters.successfulExecutionListItems().should('have.length', 0);
workflowPage.getters.successToast().contains('Execution deleted');
});
});
});
5 changes: 5 additions & 0 deletions cypress/pages/workflow-executions-tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class WorkflowExecutionsTab extends BasePage {
failedExecutionListItems: () => cy.get('[data-test-execution-status="error"]'),
executionCard: (executionId: string) => cy.getByTestId(`execution-details-${executionId}`),
executionPreviewDetails: () => cy.get('[data-test-id^="execution-preview-details-"]'),
executionPreviewDeleteButton: () => cy.get('[data-test-id="execution-preview-delete-button"]'),
executionPreviewDetailsById: (executionId: string) =>
cy.getByTestId(`execution-preview-details-${executionId}`),
executionPreviewTime: () =>
Expand Down Expand Up @@ -42,5 +43,9 @@ export class WorkflowExecutionsTab extends BasePage {
switchToEditorTab: () => {
workflowPage.getters.editorTabButton().click();
},
deleteExecutionInPreview: () => {
this.getters.executionPreviewDeleteButton().click();
cy.get('button.btn--confirm').click();
},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ export default defineComponent({
this.executions[0];

await this.workflowsStore.deleteExecutions({ ids: [this.$route.params.executionId] });
this.workflowsStore.deleteExecution(this.executions[executionIndex]);
if (this.temporaryExecution?.id === this.$route.params.executionId) {
this.temporaryExecution = null;
}
Expand All @@ -293,6 +294,7 @@ export default defineComponent({
})
.catch(() => {});
this.workflowsStore.activeWorkflowExecution = nextExecution;
await this.setExecutions();
} else {
// If there are no executions left, show empty state and clear active execution from the store
this.workflowsStore.activeWorkflowExecution = null;
Expand All @@ -301,7 +303,6 @@ export default defineComponent({
params: { name: this.currentWorkflow },
});
}
await this.setExecutions();
} catch (error) {
this.loading = false;
this.showError(
Expand Down
Loading