fix(editor): Fix opening executions tab from a new, unsaved workflow (#10652)

This commit is contained in:
Csaba Tuncsik 2024-09-04 15:32:03 +02:00 committed by GitHub
parent 746e7b89f7
commit cd0891e4f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 249 additions and 219 deletions

View file

@ -9,7 +9,8 @@ const executionsTab = new WorkflowExecutionsTab();
const executionsRefreshInterval = 4000; const executionsRefreshInterval = 4000;
// Test suite for executions tab // Test suite for executions tab
describe('Current Workflow Executions', () => { describe('Workflow Executions', () => {
describe('when workflow is saved', () => {
beforeEach(() => { beforeEach(() => {
workflowPage.actions.visit(); workflowPage.actions.visit();
cy.createFixtureWorkflow('Test_workflow_4_executions_view.json', 'My test workflow'); cy.createFixtureWorkflow('Test_workflow_4_executions_view.json', 'My test workflow');
@ -229,6 +230,34 @@ describe('Current Workflow Executions', () => {
}); });
}); });
describe('when new workflow is not saved', () => {
beforeEach(() => {
workflowPage.actions.visit();
});
it('should open executions tab', () => {
executionsTab.actions.switchToExecutionsTab();
executionsTab.getters.executionsSidebar().should('be.visible');
executionsTab.getters.executionsEmptyList().should('be.visible');
cy.getByTestId('workflow-execution-no-trigger-content').should('be.visible');
cy.get('button:contains("Add first step")').should('be.visible').click();
cy.getByTestId('node-creator-item-name')
.should('be.visible')
.filter(':contains("Trigger")')
.click();
executionsTab.actions.switchToExecutionsTab();
executionsTab.getters.executionsSidebar().should('be.visible');
executionsTab.getters.executionsEmptyList().should('be.visible');
cy.getByTestId('workflow-execution-no-content').should('be.visible');
workflowPage.getters.saveButton().find('button').should('be.enabled').click();
workflowPage.getters.isWorkflowSaved();
workflowPage.getters.nodeViewRoot().should('be.visible');
});
});
});
const createMockExecutions = () => { const createMockExecutions = () => {
executionsTab.actions.createManualExecutions(5); executionsTab.actions.createManualExecutions(5);
// Make some failed executions by enabling Code node with syntax error // Make some failed executions by enabling Code node with syntax error

View file

@ -7,6 +7,7 @@ export class WorkflowExecutionsTab extends BasePage {
getters = { getters = {
executionsTabButton: () => cy.getByTestId('radio-button-executions'), executionsTabButton: () => cy.getByTestId('radio-button-executions'),
executionsSidebar: () => cy.getByTestId('executions-sidebar'), executionsSidebar: () => cy.getByTestId('executions-sidebar'),
executionsEmptyList: () => cy.getByTestId('execution-list-empty'),
autoRefreshCheckBox: () => cy.getByTestId('auto-refresh-checkbox'), autoRefreshCheckBox: () => cy.getByTestId('auto-refresh-checkbox'),
executionsList: () => cy.getByTestId('current-executions-list'), executionsList: () => cy.getByTestId('current-executions-list'),
executionListItems: () => this.getters.executionsList().find('div.execution-card'), executionListItems: () => this.getters.executionsList().find('div.execution-card'),

View file

@ -36,7 +36,7 @@ function getWorkflowRoute(): { name: string; params: {} } {
<template> <template>
<div :class="['workflow-executions-container', $style.container]"> <div :class="['workflow-executions-container', $style.container]">
<div v-if="executionCount === 0" :class="[$style.messageContainer, $style.noExecutionsMessage]"> <div v-if="executionCount === 0" :class="[$style.messageContainer, $style.noExecutionsMessage]">
<div v-if="!containsTrigger"> <div v-if="!containsTrigger" data-test-id="workflow-execution-no-trigger-content">
<N8nHeading tag="h2" size="xlarge" color="text-dark" class="mb-2xs"> <N8nHeading tag="h2" size="xlarge" color="text-dark" class="mb-2xs">
{{ locale.baseText('executionsLandingPage.emptyState.noTrigger.heading') }} {{ locale.baseText('executionsLandingPage.emptyState.noTrigger.heading') }}
</N8nHeading> </N8nHeading>
@ -47,7 +47,7 @@ function getWorkflowRoute(): { name: string; params: {} } {
{{ locale.baseText('executionsLandingPage.emptyState.noTrigger.buttonText') }} {{ locale.baseText('executionsLandingPage.emptyState.noTrigger.buttonText') }}
</N8nButton> </N8nButton>
</div> </div>
<div v-else> <div v-else data-test-id="workflow-execution-no-content">
<N8nHeading tag="h2" size="xlarge" color="text-dark" class="mb-2xs"> <N8nHeading tag="h2" size="xlarge" color="text-dark" class="mb-2xs">
{{ locale.baseText('executionsLandingPage.emptyState.heading') }} {{ locale.baseText('executionsLandingPage.emptyState.heading') }}
</N8nHeading> </N8nHeading>

View file

@ -500,8 +500,8 @@ export const useWorkflowsStore = defineStore(STORES.WORKFLOWS, () => {
executingNode.value = executingNode.value.filter((name) => name !== nodeName); executingNode.value = executingNode.value.filter((name) => name !== nodeName);
} }
function setWorkflowId(id: string) { function setWorkflowId(id?: string) {
workflow.value.id = id === 'new' ? PLACEHOLDER_EMPTY_WORKFLOW_ID : id; workflow.value.id = !id || id === 'new' ? PLACEHOLDER_EMPTY_WORKFLOW_ID : id;
} }
function setUsedCredentials(data: IUsedCredential[]) { function setUsedCredentials(data: IUsedCredential[]) {