From 616fcc3838a2430ebc9ff0f06e5630e74f470cc3 Mon Sep 17 00:00:00 2001 From: argshook Date: Fri, 25 Mar 2022 09:26:23 +0200 Subject: [PATCH 1/2] wip test for error range --- .../cypress/integration/console/editor.spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/browser-tests/cypress/integration/console/editor.spec.js b/packages/browser-tests/cypress/integration/console/editor.spec.js index b580cfc95..b99bcaaff 100644 --- a/packages/browser-tests/cypress/integration/console/editor.spec.js +++ b/packages/browser-tests/cypress/integration/console/editor.spec.js @@ -128,3 +128,15 @@ describe("autocomplete", () => { cy.runQuery('drop table "my_publics"'); }); }); + +describe("errors", () => { + it.only("should work when tables list is empty", () => { + cy.visit("http://localhost:9999"); + const query = ` +create table test ( +ts timestamp, +col symbol index CAPACITY (200000), +) timestamp (ts) partition by hour;{downArrow}{backspace}`.trim(); + cy.runQuery(query); + }); +}); From 9c4c9aa611a1a2363ec7163dc20c6b8e16a5ae0a Mon Sep 17 00:00:00 2001 From: argshook Date: Fri, 25 Mar 2022 09:57:35 +0200 Subject: [PATCH 2/2] add another test to assert error marker --- .../integration/console/editor.spec.js | 22 ++++++++++++++----- .../browser-tests/cypress/support/commands.js | 2 ++ packages/browser-tests/snapshots.js | 8 +++++++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/packages/browser-tests/cypress/integration/console/editor.spec.js b/packages/browser-tests/cypress/integration/console/editor.spec.js index b99bcaaff..7bd9419b6 100644 --- a/packages/browser-tests/cypress/integration/console/editor.spec.js +++ b/packages/browser-tests/cypress/integration/console/editor.spec.js @@ -130,13 +130,23 @@ describe("autocomplete", () => { }); describe("errors", () => { - it.only("should work when tables list is empty", () => { + before(() => { cy.visit("http://localhost:9999"); - const query = ` -create table test ( -ts timestamp, -col symbol index CAPACITY (200000), -) timestamp (ts) partition by hour;{downArrow}{backspace}`.trim(); + }); + + beforeEach(() => { + cy.clearEditor(); + }); + + it("should mark '(200000)' as error", () => { + const query = `create table test (\ncol symbol index CAPACITY (200000)`; + cy.runQuery(query); + cy.getErrorMarker().snapshot(); + }); + + it("should mark 'telemetry' as error", () => { + const query = `CREATE TABLE 'telemetry' (id LONG256)`; cy.runQuery(query); + cy.getErrorMarker().snapshot(); }); }); diff --git a/packages/browser-tests/cypress/support/commands.js b/packages/browser-tests/cypress/support/commands.js index f88b54e54..9c584f04c 100644 --- a/packages/browser-tests/cypress/support/commands.js +++ b/packages/browser-tests/cypress/support/commands.js @@ -41,3 +41,5 @@ Cypress.Commands.add("getEditor", () => cy.get(".monaco-editor textarea")); Cypress.Commands.add("getAutocomplete", () => cy.get('[widgetid="editor.widget.suggestWidget"]') ); + +Cypress.Commands.add("getErrorMarker", () => cy.get(".squiggly-error")); diff --git a/packages/browser-tests/snapshots.js b/packages/browser-tests/snapshots.js index e7ca52386..0e4ed1aff 100644 --- a/packages/browser-tests/snapshots.js +++ b/packages/browser-tests/snapshots.js @@ -53,5 +53,13 @@ module.exports = { "should correctly append and select query after multiple inserts": { "1": "" } + }, + "errors": { + "should work when tables list is empty": { + "1": "
" + }, + "should mark 'telemetry' as error": { + "1": "
" + } } }