diff --git a/packages/browser-tests/cypress/integration/console/editor.spec.js b/packages/browser-tests/cypress/integration/console/editor.spec.js
index 75962ba51..152e4ad17 100644
--- a/packages/browser-tests/cypress/integration/console/editor.spec.js
+++ b/packages/browser-tests/cypress/integration/console/editor.spec.js
@@ -1,6 +1,6 @@
///
-const baseUrl = "http://localhost:9999"
+const baseUrl = "http://localhost:9999";
describe("appendQuery", () => {
const consoleConfiguration = {
@@ -128,7 +128,11 @@ describe("&query URL param", () => {
it("should append and select multiline query", () => {
cy.visit(baseUrl);
- cy.runQuery(`select x\nfrom long_sequence(1);\n\n-- a\n-- b\n-- c\n${'{upArrow}'.repeat(5)}`);
+ cy.runQuery(
+ `select x\nfrom long_sequence(1);\n\n-- a\n-- b\n-- c\n${"{upArrow}".repeat(
+ 5
+ )}`
+ );
const query = encodeURIComponent("select x+1\nfrom\nlong_sequence(1);");
cy.visit(`${baseUrl}?query=${query}&executeQuery=true`);
cy.getGridRow(0).should("contain", "2").snapshot();
@@ -148,8 +152,7 @@ describe("autocomplete", () => {
it("should work when tables list is empty", () => {
cy.visit(baseUrl);
cy.typeQuery("select * from tel");
- cy.getAutocomplete().should("not.contain", "telemetry");
- cy.getAutocomplete().should("contain", "TABLE");
+ cy.getAutocomplete().should("not.be.visible");
cy.clearEditor();
cy.runQuery('create table "my_secrets" ("secret" string)');
cy.typeQuery("select * from my_");
@@ -194,3 +197,36 @@ describe("errors", () => {
cy.getErrorMarker().snapshot();
});
});
+
+describe("running query with F9", () => {
+ beforeEach(() => {
+ Cypress.on("uncaught:exception", (err) => {
+ // this error can be safely ignored
+ if (err.message.includes("ResizeObserver loop limit exceeded")) {
+ return false;
+ }
+ });
+ });
+
+ it("should execute correct query, when text cursor is on query which has no semicolon", () => {
+ cy.visit(baseUrl);
+ cy.typeQuery("select * from long_sequence(1)").F9();
+ cy.getGridRow(0).should("contain", "1");
+ cy.clearEditor();
+ cy.typeQuery(`select * from long_sequence(2);{leftArrow}`).F9();
+ cy.wait(100).getGridRow(1).should("contain", "2");
+ });
+
+ it("should execute correct query, when multiple queries exist", () => {
+ cy.visit(baseUrl);
+ cy.typeQuery(
+ "long_sequence(10) where x = 3;\n\nlong_sequence(5) limit 2;{upArrow}{upArrow}{end}{leftArrow}"
+ ).F9();
+ cy.getGridRow(0).should("contain", "3");
+ cy.clearEditor();
+ cy.typeQuery(
+ "long_sequence(10) where x = 3;\n\nlong_sequence(5) limit 2{upArrow}{upArrow}{end}{leftArrow}"
+ ).F9();
+ cy.getGridRow(0).should("contain", "3");
+ });
+});
diff --git a/packages/browser-tests/cypress/support/commands.js b/packages/browser-tests/cypress/support/commands.js
index 1b2a136ac..4b052804f 100644
--- a/packages/browser-tests/cypress/support/commands.js
+++ b/packages/browser-tests/cypress/support/commands.js
@@ -9,13 +9,7 @@ Cypress.Commands.add("getGridViewport", () => cy.get(".qg-viewport"));
Cypress.Commands.add("getGridRow", (n) => cy.get(".qg-r").eq(n));
Cypress.Commands.add("typeQuery", (query) =>
- cy
- .get(".monaco-editor")
- .first()
- .click()
- .focused()
- .type("{ctrl}a")
- .type(`${query}`)
+ cy.get(".monaco-editor").first().click().focused().type("{ctrl}a").type(query)
);
Cypress.Commands.add("runQuery", (query) => {
@@ -43,3 +37,9 @@ Cypress.Commands.add("getAutocomplete", () =>
);
Cypress.Commands.add("getErrorMarker", () => cy.get(".squiggly-error"));
+
+Cypress.Commands.add("F9", () =>
+ cy.getEditor().trigger("keydown", {
+ keyCode: 120,
+ })
+);
diff --git a/packages/browser-tests/snapshots.js b/packages/browser-tests/snapshots.js
index c3aac4751..6f25782c5 100644
--- a/packages/browser-tests/snapshots.js
+++ b/packages/browser-tests/snapshots.js
@@ -1,5 +1,5 @@
module.exports = {
- "__version": "9.5.1",
+ "__version": "9.6.1",
"questdb grid": {
"works": {
"1": "
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
\n
",