fix: fix log streaming e2e race condition

This commit is contained in:
Alex Grozav 2023-07-26 16:46:10 +03:00
parent 4f87d2d533
commit dab3d3a400
5 changed files with 14 additions and 12 deletions

View file

@ -46,6 +46,7 @@ describe('Log Streaming Settings', () => {
it('should create a destination and delete it', () => {
cy.enableFeature('logStreaming');
cy.visit('/settings/log-streaming');
cy.wait(1000); // Race condition with getDestinationDataFromBackend()
settingsLogStreamingPage.actions.clickAddFirstDestination();
cy.wait(100);
settingsLogStreamingPage.getters.getDestinationModal().should('be.visible');
@ -73,6 +74,7 @@ describe('Log Streaming Settings', () => {
it('should create a destination and delete it via card actions', () => {
cy.enableFeature('logStreaming');
cy.visit('/settings/log-streaming');
cy.wait(1000); // Race condition with getDestinationDataFromBackend()
settingsLogStreamingPage.actions.clickAddFirstDestination();
cy.wait(100);
settingsLogStreamingPage.getters.getDestinationModal().should('be.visible');

View file

@ -189,7 +189,7 @@ import {
defaultMessageEventBusDestinationSentryOptions,
} from 'n8n-workflow';
import type { PropType } from 'vue';
import { defineComponent, nextTick } from 'vue';
import { defineComponent } from 'vue';
import { LOG_STREAM_MODAL_KEY, MODAL_CONFIRM } from '@/constants';
import Modal from '@/components/Modal.vue';
import { useMessage } from '@/composables';
@ -378,9 +378,7 @@ export default defineComponent({
if (newDestination) {
this.headerLabel = newDestination?.label ?? this.headerLabel;
void nextTick(() => {
this.setupNode(newDestination);
});
this.setupNode(newDestination);
}
},
valueChanged(parameterData: IUpdateInformation) {

View file

@ -155,12 +155,11 @@ export default defineComponent({
} else if (keyboardEvent.key === 'Enter' && filter.value.length === 0) {
preventUpdate.value = true;
// Disable blur event due to element-plus handler changes
// emit('blur');
//
// if (typeof selectRef.value?.blur === 'function') {
// selectRef.value.blur();
// }
emit('blur');
if (typeof selectRef.value?.blur === 'function') {
selectRef.value.blur();
}
}
});
}

View file

@ -67,7 +67,7 @@ export const useLogStreamingStore = defineStore('logStreaming', {
state.items[destination.id].destination = destination;
}
// to trigger refresh
state.items = deepCopy(state.items);
state.items = { ...state.items };
});
}
},
@ -162,6 +162,8 @@ export const useLogStreamingStore = defineStore('logStreaming', {
delete this.items[id];
},
clearDestinationItemTrees() {
console.log('clearing destinations');
this.items = {} as DestinationSettingsStore;
},
setSelectionAndBuildItems(destination: MessageEventBusDestinationOptions) {

View file

@ -73,7 +73,7 @@
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { defineComponent, nextTick } from 'vue';
import { mapStores } from 'pinia';
import { v4 as uuid } from 'uuid';
import { useWorkflowsStore } from '../stores/workflows.store';
@ -197,6 +197,7 @@ export default defineComponent({
const newDestination = deepCopy(defaultMessageEventBusDestinationOptions);
newDestination.id = uuid();
this.logStreamingStore.addDestination(newDestination);
await nextTick();
this.uiStore.openModalWithData({
name: LOG_STREAM_MODAL_KEY,
data: {