|
| 1 | +import {Organization} from '../../../src/types' |
| 2 | + |
| 3 | +// to see list of monaco-editor widgets to check: |
| 4 | +// document.querySelectorAll('[widgetid]') |
| 5 | + |
| 6 | +describe('Editor+LSP communication', () => { |
| 7 | + const runTest = editorSelector => { |
| 8 | + it('receives LSP-triggered server events', () => { |
| 9 | + cy.getByTestID(editorSelector).then(() => { |
| 10 | + cy.getByTestID('flux-editor', {timeout: 30000}) |
| 11 | + .should('be.visible') |
| 12 | + .monacoType('foo |> bar') |
| 13 | + .within(() => { |
| 14 | + cy.get('.squiggly-error', {timeout: 30000}).should('be.visible') |
| 15 | + }) |
| 16 | + cy.getByTestID('flux-editor').monacoType('{selectall}{del}') |
| 17 | + }) |
| 18 | + }) |
| 19 | + |
| 20 | + it('has a roundtrip request-response, from the editor to the LSP server', () => { |
| 21 | + cy.getByTestID(editorSelector).then(() => { |
| 22 | + cy.getByTestID('flux-editor', {timeout: 30000}) |
| 23 | + .monacoType('{selectall} {backspace}') |
| 24 | + .monacoType('from(') |
| 25 | + .within(() => { |
| 26 | + cy.get('[widgetid="editor.widget.suggestWidget"]', { |
| 27 | + timeout: 30000, |
| 28 | + }).should('be.visible') |
| 29 | + }) |
| 30 | + .monacoType(`{selectall}{del}`) |
| 31 | + }) |
| 32 | + }) |
| 33 | + } |
| 34 | + |
| 35 | + describe('in Flows:', () => { |
| 36 | + before(() => { |
| 37 | + cy.flush() |
| 38 | + cy.signin() |
| 39 | + cy.get('@org').then(({id}: Organization) => |
| 40 | + cy.fixture('routes').then(({orgs}) => { |
| 41 | + cy.visit(`${orgs}/${id}`) |
| 42 | + }) |
| 43 | + ) |
| 44 | + cy.getByTestID('version-info') |
| 45 | + cy.getByTestID('nav-item-flows').should('be.visible') |
| 46 | + cy.getByTestID('nav-item-flows').click() |
| 47 | + |
| 48 | + cy.getByTestID('preset-new') |
| 49 | + .first() |
| 50 | + .click() |
| 51 | + cy.getByTestID('time-machine-submit-button').should('be.visible') |
| 52 | + |
| 53 | + cy.get('.flow-divider--button') |
| 54 | + .first() |
| 55 | + .click() |
| 56 | + cy.get('.insert-cell-menu.always-on').contains('Add Another Panel') |
| 57 | + cy.getByTestID('add-flow-btn--rawFluxEditor') |
| 58 | + .last() |
| 59 | + .click() |
| 60 | + cy.getByTestID('flux-editor').should('be.visible') |
| 61 | + }) |
| 62 | + |
| 63 | + runTest('flux-editor') |
| 64 | + }) |
| 65 | + |
| 66 | + describe('in DataExplorer', () => { |
| 67 | + before(() => { |
| 68 | + cy.flush() |
| 69 | + cy.signin() |
| 70 | + cy.get('@org').then(({id}: Organization) => { |
| 71 | + cy.createMapVariable(id) |
| 72 | + cy.fixture('routes').then(({orgs, explorer}) => { |
| 73 | + cy.visit(`${orgs}/${id}${explorer}`) |
| 74 | + cy.getByTestID('tree-nav').should('be.visible') |
| 75 | + }) |
| 76 | + }) |
| 77 | + cy.getByTestID('switch-to-script-editor') |
| 78 | + .should('be.visible') |
| 79 | + .click() |
| 80 | + }) |
| 81 | + |
| 82 | + runTest('time-machine--bottom') |
| 83 | + }) |
| 84 | +}) |
0 commit comments