fix(cypress): fix ingestion_source cypress test (#15154)

This commit is contained in:
Purnima Garg 2025-10-30 21:27:58 +05:30 committed by GitHub
parent 46d2063091
commit 2bcbd76ede
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,3 +1,5 @@
import { hasOperationName } from "../utils";
const number = crypto.getRandomValues(new Uint32Array(1))[0]; const number = crypto.getRandomValues(new Uint32Array(1))[0];
const accound_id = `account${number}`; const accound_id = `account${number}`;
const warehouse_id = `warehouse${number}`; const warehouse_id = `warehouse${number}`;
@ -6,7 +8,21 @@ const password = `password${number}`;
const role = `role${number}`; const role = `role${number}`;
const ingestion_source_name = `ingestion source ${number}`; const ingestion_source_name = `ingestion source ${number}`;
export const setIngestionRedesignFlag = (isOn) => {
cy.intercept("POST", "/api/v2/graphql", (req) => {
if (hasOperationName(req, "appConfig")) {
req.reply((res) => {
res.body.data.appConfig.featureFlags.showIngestionPageRedesign = isOn;
});
}
});
};
describe("ingestion source creation flow", () => { describe("ingestion source creation flow", () => {
beforeEach(() => {
setIngestionRedesignFlag(false); // Set the ingestion redesign flag to false
});
it("create a ingestion source using ui, verify ingestion source details saved correctly, remove ingestion source", () => { it("create a ingestion source using ui, verify ingestion source details saved correctly, remove ingestion source", () => {
// Go to ingestion page, create a snowflake source // Go to ingestion page, create a snowflake source
cy.loginWithCredentials(); cy.loginWithCredentials();
@ -45,8 +61,8 @@ describe("ingestion source creation flow", () => {
.should("be.visible"); .should("be.visible");
// Verify ingestion source details are saved correctly // Verify ingestion source details are saved correctly
cy.get('[data-testid="ingestion-source-table-edit-button"]') cy.contains("tr", ingestion_source_name)
.first() .find('[data-testid="ingestion-source-table-edit-button"]')
.click(); .click();
cy.waitTextVisible("Edit Data Source"); cy.waitTextVisible("Edit Data Source");
cy.get("#account_id").should("have.value", accound_id); cy.get("#account_id").should("have.value", accound_id);