2023-09-22 04:17:54 -07:00
|
|
|
import { WorkflowPage, NDV } from '../pages';
|
|
|
|
|
|
|
|
const workflowPage = new WorkflowPage();
|
|
|
|
const ndv = new NDV();
|
|
|
|
|
|
|
|
describe('SQL editors', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
workflowPage.actions.visit();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should preserve changes when opening-closing Postgres node', () => {
|
2023-10-06 06:31:18 -07:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Postgres', {
|
|
|
|
action: 'Execute a SQL query',
|
|
|
|
keepNdvOpen: true,
|
|
|
|
});
|
|
|
|
ndv.getters
|
|
|
|
.sqlEditorContainer()
|
|
|
|
.click()
|
|
|
|
.find('.cm-content')
|
|
|
|
.type('SELECT * FROM `testTable`')
|
|
|
|
.type('{esc}');
|
2023-09-22 04:17:54 -07:00
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.actions.openNode('Postgres');
|
2023-10-05 03:31:52 -07:00
|
|
|
ndv.getters.sqlEditorContainer().find('.cm-content').type('{end} LIMIT 10').type('{esc}');
|
2023-09-22 04:17:54 -07:00
|
|
|
ndv.actions.close();
|
|
|
|
workflowPage.actions.openNode('Postgres');
|
2023-10-05 03:31:52 -07:00
|
|
|
ndv.getters.sqlEditorContainer().should('contain', 'SELECT * FROM `testTable` LIMIT 10');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not push NDV header out with a lot of code in Postgres editor', () => {
|
2023-10-06 06:31:18 -07:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('Postgres', {
|
|
|
|
action: 'Execute a SQL query',
|
|
|
|
keepNdvOpen: true,
|
|
|
|
});
|
2023-10-05 03:31:52 -07:00
|
|
|
cy.fixture('Dummy_javascript.txt').then((code) => {
|
|
|
|
ndv.getters.sqlEditorContainer().find('.cm-content').paste(code);
|
|
|
|
});
|
|
|
|
ndv.getters.nodeExecuteButton().should('be.visible');
|
|
|
|
});
|
2023-09-22 04:17:54 -07:00
|
|
|
|
2023-10-05 03:31:52 -07:00
|
|
|
it('should not push NDV header out with a lot of code in MySQL editor', () => {
|
2023-10-06 06:31:18 -07:00
|
|
|
workflowPage.actions.addInitialNodeToCanvas('MySQL', {
|
|
|
|
action: 'Execute a SQL query',
|
|
|
|
keepNdvOpen: true,
|
|
|
|
});
|
2023-10-05 03:31:52 -07:00
|
|
|
cy.fixture('Dummy_javascript.txt').then((code) => {
|
|
|
|
ndv.getters.sqlEditorContainer().find('.cm-content').paste(code);
|
|
|
|
});
|
|
|
|
ndv.getters.nodeExecuteButton().should('be.visible');
|
2023-09-22 04:17:54 -07:00
|
|
|
});
|
|
|
|
});
|