From 3ffa7aa8f205837a1cb0e3d695a75048c922c4c0 Mon Sep 17 00:00:00 2001 From: david-leifker <114954101+david-leifker@users.noreply.github.com> Date: Wed, 20 Aug 2025 12:12:16 -0500 Subject: [PATCH] fix(cypress): fix cypress test failure updating source (#14517) --- .../e2e/mutationsV2/v2_managed_ingestion.js | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/smoke-test/tests/cypress/cypress/e2e/mutationsV2/v2_managed_ingestion.js b/smoke-test/tests/cypress/cypress/e2e/mutationsV2/v2_managed_ingestion.js index 5ccf8874a9..115d539b60 100644 --- a/smoke-test/tests/cypress/cypress/e2e/mutationsV2/v2_managed_ingestion.js +++ b/smoke-test/tests/cypress/cypress/e2e/mutationsV2/v2_managed_ingestion.js @@ -1,30 +1,50 @@ -function readyToTypeEditor() { - return cy.get(".monaco-scrollable-element").first().click().focused(); +function clearMonacoEditor() { + const selectAllKey = Cypress.platform === "darwin" ? "{cmd}a" : "{ctrl}a"; + return cy + .get(".monaco-scrollable-element") + .first() + .click() + .focused() + .type(selectAllKey) + .type("{backspace}"); +} + +function typeInMonacoEditor(text) { + return cy + .get(".monaco-scrollable-element") + .first() + .click() + .focused() + .type(text); } describe("run managed ingestion", () => { beforeEach(() => { cy.setIsThemeV2Enabled(true); }); + it("create run managed ingestion source", () => { const number = Math.floor(Math.random() * 100000); const testName = `cypress test source ${number}`; const cli_version = "0.12.0"; + cy.login(); cy.goToIngestionPage(); cy.contains("Loading ingestion sources...").should("not.exist"); - // cy.clickOptionWithText("Create new source"); cy.clickOptionWithTestId("create-ingestion-source-button"); cy.get('[placeholder="Search data sources..."]').type("other"); cy.clickOptionWithTextToScrollintoView("Other"); cy.waitTextVisible("source-type"); - readyToTypeEditor().type("{ctrl}a").clear(); - readyToTypeEditor().type("source:{enter}"); - readyToTypeEditor().type(" type: demo-data"); - readyToTypeEditor().type("{enter}"); - // no space because the editor starts new line at same indentation - readyToTypeEditor().type("config: {}"); + + // Clear the editor first + clearMonacoEditor(); + + // Type your content + typeInMonacoEditor("source:{enter}"); + typeInMonacoEditor(" type: demo-data{enter}"); + typeInMonacoEditor("config: {}"); + cy.clickOptionWithText("Next"); cy.clickOptionWithText("Next");