fix(editor): Fix switching between connected SQL/HTML editors (#15297)

This commit is contained in:
Elias Meire
2025-05-13 19:21:46 +02:00
committed by GitHub
parent 102c67628c
commit bb2cfc209c
6 changed files with 109 additions and 63 deletions

View File

@@ -110,6 +110,40 @@ describe('Editors', () => {
ndv.actions.close();
workflowPage.getters.isWorkflowSaved().should('not.be.true');
});
it('should allow switching between SQL editors in connected nodes', () => {
workflowPage.actions.addInitialNodeToCanvas('Postgres', {
action: 'Execute a SQL query',
keepNdvOpen: true,
});
ndv.getters
.sqlEditorContainer()
.click()
.find('.cm-content')
.paste('SELECT * FROM `firstTable`');
ndv.actions.close();
workflowPage.actions.addNodeToCanvas('Postgres', true, true, 'Execute a SQL query');
ndv.getters
.sqlEditorContainer()
.click()
.find('.cm-content')
.paste('SELECT * FROM `secondTable`');
ndv.actions.close();
workflowPage.actions.openNode('Postgres');
ndv.actions.clickFloatingNode('Postgres1');
ndv.getters
.sqlEditorContainer()
.find('.cm-content')
.should('have.text', 'SELECT * FROM `secondTable`');
ndv.actions.clickFloatingNode('Postgres');
ndv.getters
.sqlEditorContainer()
.find('.cm-content')
.should('have.text', 'SELECT * FROM `firstTable`');
});
});
describe('HTML Editor', () => {
@@ -173,5 +207,38 @@ describe('Editors', () => {
ndv.actions.close();
workflowPage.getters.isWorkflowSaved().should('not.be.true');
});
it('should allow switching between HTML editors in connected nodes', () => {
workflowPage.actions.addInitialNodeToCanvas('HTML', {
action: 'Generate HTML template',
keepNdvOpen: true,
});
ndv.getters
.htmlEditorContainer()
.click()
.find('.cm-content')
.type('{selectall}')
.paste('<div>First</div>');
ndv.actions.close();
workflowPage.actions.addNodeToCanvas('HTML', true, true, 'Generate HTML template');
ndv.getters
.htmlEditorContainer()
.click()
.find('.cm-content')
.type('{selectall}')
.paste('<div>Second</div>');
ndv.actions.close();
workflowPage.actions.openNode('HTML');
ndv.actions.clickFloatingNode('HTML1');
ndv.getters
.htmlEditorContainer()
.find('.cm-content')
.should('have.text', '<div>Second</div>');
ndv.actions.clickFloatingNode('HTML');
ndv.getters.htmlEditorContainer().find('.cm-content').should('have.text', '<div>First</div>');
});
});
});

View File

@@ -387,7 +387,6 @@ describe('NDV', () => {
ndv.getters.codeEditorFullscreen().type('{selectall}').type('{backspace}').type('foo()');
ndv.getters.codeEditorFullscreen().should('contain.text', 'foo()');
cy.wait(200); // allow change to emit before closing modal
ndv.getters.codeEditorDialog().find('.el-dialog__close').click();
ndv.getters.parameterInput('jsCode').get('.cm-content').should('contain.text', 'foo()');
ndv.actions.close();
@@ -400,9 +399,8 @@ describe('NDV', () => {
.codeEditorFullscreen()
.type('{selectall}')
.type('{backspace}')
.type('SELECT * FROM workflows');
.paste('SELECT * FROM workflows');
ndv.getters.codeEditorFullscreen().should('contain.text', 'SELECT * FROM workflows');
cy.wait(200);
ndv.getters.codeEditorDialog().find('.el-dialog__close').click();
ndv.getters
.parameterInput('query')
@@ -418,10 +416,8 @@ describe('NDV', () => {
.codeEditorFullscreen()
.type('{selectall}')
.type('{backspace}')
.type('<div>Hello World');
.type('<div>Hello World</div>');
ndv.getters.codeEditorFullscreen().should('contain.text', '<div>Hello World</div>');
cy.wait(200);
ndv.getters.codeEditorDialog().find('.el-dialog__close').click();
ndv.getters
.parameterInput('html')