Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
insmac committed Jan 2, 2025
1 parent f506b0a commit b1158a6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/browser-tests/cypress/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ Cypress.Commands.add("getAutocomplete", () =>
cy.get('[widgetid="editor.widget.suggestWidget"]')
);

Cypress.Commands.add("getMonacoListRow", () => cy.get(".monaco-list-row"));

Cypress.Commands.add("getErrorMarker", () => cy.get(".squiggly-error"));

Cypress.Commands.add("getCursorQueryDecoration", () =>
Expand Down
24 changes: 24 additions & 0 deletions packages/browser-tests/cypress/integration/console/editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,21 @@ describe("autocomplete", () => {
cy.matchImageSnapshot();
});

it("should be case insensitive", () => {
const assertFrom = () =>
cy.getAutocomplete().within(() => {
cy.getMonacoListRow()
.should("have.length", 3)
.eq(0)
.should("contain", "FROM");
});
cy.typeQuery("select * from");
assertFrom();
cy.clearEditor();
cy.typeQuery("SELECT * FROM");
assertFrom();
});

it("should suggest the existing tables on 'from' clause", () => {
cy.typeQuery("select * from ");
cy.getAutocomplete()
Expand All @@ -227,6 +242,15 @@ describe("autocomplete", () => {
.clearEditor();
});

it("should suggest columns on SELECT only when applicable", () => {
cy.typeQuery("select secret");
cy.getAutocomplete().should("contain", "secret").eq(0).click();
cy.typeQuery(", public");
cy.getAutocomplete().should("contain", "public").eq(0).click();
cy.typeQuery(" ");
cy.getAutocomplete().should("not.be.visible");
});

it("should suggest correct columns on 'where' filter", () => {
cy.typeQuery("select * from my_secrets where ");
cy.getAutocomplete()
Expand Down

0 comments on commit b1158a6

Please sign in to comment.