Skip to content
Snippets Groups Projects
Unverified Commit 1c9df6f7 authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Fix native editor flakes (#38755)

parent 999aa7be
Branches
Tags
No related merge requests found
......@@ -37,7 +37,16 @@ export function openNativeEditor({
databaseName && cy.findByText(databaseName).click();
return cy.findByTestId("native-query-editor").as(alias).should("be.visible");
return focusNativeEditor().as(alias);
}
export function focusNativeEditor() {
return cy
.findByTestId("native-query-editor")
.should("be.visible")
.should("have.class", "ace_editor")
.click()
.should("have.class", "ace_focus");
}
/**
......
import { filterWidget, popover } from "e2e/support/helpers";
import { filterWidget, focusNativeEditor, popover } from "e2e/support/helpers";
// FILTER TYPES
......@@ -92,11 +92,7 @@ export function runQuery(xhrAlias = "dataset") {
* @param {string} query
*/
export function enterParameterizedQuery(query, options = {}) {
// Both delay and a repeated sequence of `{arrowleft}{arrowright}` are there to prevent typing flakes
// Without them at least 1 in 10 test runs locally didn't type correctly
cy.get("@editor").type("{leftArrow}{rightArrow}{leftArrow}{rightArrow}", {
delay: 50,
});
focusNativeEditor();
cy.get("@editor").type(query, {
parseSpecialCharSequences: false,
...options,
......
......@@ -15,11 +15,12 @@ describe("issue 18148", () => {
});
it("should not offer to save the question before it is actually possible to save it (metabase#18148)", () => {
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Select a database");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Save").should("have.attr", "aria-disabled", "true");
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText("Select a database").click();
// eslint-disable-next-line no-unscoped-text-selectors -- deprecated usage
cy.findByText(dbName).click();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment