diff --git a/datahub-web-react/src/app/entityV2/group/GroupSidebarOwnersSection.tsx b/datahub-web-react/src/app/entityV2/group/GroupSidebarOwnersSection.tsx index 65da8af6fe..399192e281 100644 --- a/datahub-web-react/src/app/entityV2/group/GroupSidebarOwnersSection.tsx +++ b/datahub-web-react/src/app/entityV2/group/GroupSidebarOwnersSection.tsx @@ -31,7 +31,7 @@ export const GroupSidebarOwnersSection = ({ ownership, refetch, urn }: Props) => } extra={ } + button={} onClick={(event) => { setShowAddOwnerModal(true); event.stopPropagation(); diff --git a/smoke-test/tests/cypress/cypress/e2e/incidentsV2/v2_incidents.js b/smoke-test/tests/cypress/cypress/e2e/incidentsV2/v2_incidents.js index 9ae80e3837..ffbb779f2b 100644 --- a/smoke-test/tests/cypress/cypress/e2e/incidentsV2/v2_incidents.js +++ b/smoke-test/tests/cypress/cypress/e2e/incidentsV2/v2_incidents.js @@ -70,10 +70,10 @@ describe("incidents", () => { .first() .click(); cy.get('[data-testid="incident-create-button"]').click(); - cy.wait(3000); - cy.get( - `[data-testid="incident-row-${newIncidentNameWithTimeStamp}"]`, - ).should("exist"); + // Wait for the incident to be created and appear in the list + cy.get(`[data-testid="incident-row-${newIncidentNameWithTimeStamp}"]`, { + timeout: 15000, + }).should("exist"); cy.get(`[data-testid="${newIncidentNameWithTimeStamp}"]`) .scrollIntoView() .should("be.visible"); @@ -101,9 +101,10 @@ describe("incidents", () => { .should("exist") .click(); - cy.wait(1000); - - cy.get('[data-testid="edit-incident-icon"]').click(); + // Wait for the incident details to load + cy.get('[data-testid="edit-incident-icon"]', { timeout: 10000 }) + .should("be.visible") + .click(); cy.get('[data-testid="incident-name-input"]') .clear() @@ -134,8 +135,12 @@ describe("incidents", () => { cy.get('[data-testid="status-select-input-type"]').click(); cy.get('[data-testid="status-options-list"]').contains("Resolved").click(); cy.get('[data-testid="incident-create-button"]').click(); - cy.wait(3000); - cy.get('[data-testid="nested-options-dropdown-container"]').click(); + // Wait for the incident to be updated and page to reload + cy.get('[data-testid="nested-options-dropdown-container"]', { + timeout: 15000, + }) + .should("be.visible") + .click(); cy.get('[data-testid="child-option-RESOLVED"]').click(); cy.get('[data-testid="nested-options-dropdown-container"]').click(); cy.get('[data-testid="incident-group-HIGH"]').scrollIntoView(); @@ -174,9 +179,24 @@ describe("incidents", () => { cy.visit( "/dataset/urn:li:dataset:(urn:li:dataPlatform:bigquery,cypress_project.jaffle_shop.customers,PROD)/Incidents?is_lineage_mode=false&separate_siblings=false", ); - cy.findByTestId("create-incident-btn-main").as("btn"); - cy.get("@btn").click(); - cy.get('[data-testid="drawer-header-title"]').should( + + // Wait for the page to load properly and button to be interactive + cy.findByTestId("create-incident-btn-main", { timeout: 10000 }).should( + "be.visible", + ); + + // Click the button (this opens a dropdown when separate_siblings=false and siblings exist) + cy.findByTestId("create-incident-btn-main").click(); + + // For separate_siblings=false mode, we need to select a sibling from the dropdown first + // Wait for dropdown to appear and select the first option + cy.get(".ant-dropdown-menu-item", { timeout: 10000 }) + .first() + .should("be.visible") + .click(); + + // Now the incident builder should open + cy.get('[data-testid="drawer-header-title"]', { timeout: 30000 }).should( "contain.text", "Create New Incident", ); @@ -213,8 +233,10 @@ describe("incidents", () => { .first() .click(); cy.get('[data-testid="incident-create-button"]').click(); - cy.wait(3000); - cy.get('[data-testid="incident-group-CRITICAL"]').scrollIntoView(); + // Wait for the incident to be created and incident groups to load + cy.get('[data-testid="incident-group-CRITICAL"]', { timeout: 15000 }) + .should("exist") + .scrollIntoView(); cy.get('[data-testid="incident-group-CRITICAL"]').within(() => { cy.get('[data-testid="group-header-collapsed-icon"]') .should(Cypress._.noop) // Prevent Cypress from failing if the element is missing @@ -285,8 +307,10 @@ describe("incidents", () => { .first() .click(); cy.get('[data-testid="incident-create-button"]').click(); - cy.wait(3000); - cy.get('[data-testid="incident-group-CRITICAL"]').scrollIntoView(); + // Wait for the incident to be created and incident groups to load + cy.get('[data-testid="incident-group-CRITICAL"]', { timeout: 15000 }) + .should("exist") + .scrollIntoView(); cy.get('[data-testid="incident-group-CRITICAL"]').within(() => { cy.get('[data-testid="group-header-collapsed-icon"]') .should(Cypress._.noop) // Prevent Cypress from failing if the element is missing diff --git a/smoke-test/tests/cypress/cypress/e2e/settingsV2/v2_managing_groups.js b/smoke-test/tests/cypress/cypress/e2e/settingsV2/v2_managing_groups.js index 7757c6bde9..bb1421c44c 100644 --- a/smoke-test/tests/cypress/cypress/e2e/settingsV2/v2_managing_groups.js +++ b/smoke-test/tests/cypress/cypress/e2e/settingsV2/v2_managing_groups.js @@ -13,8 +13,9 @@ describe("create and manage group", () => { it("add test user", () => { cy.visitWithLogin("/settings/identities/users"); - cy.get('[data-testid="manage-users-groups-v2"]'); - cy.wait(3000); + cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should( + "be.visible", + ); cy.clickOptionWithText("Invite Users"); cy.waitTextVisible(/signup\?invite_token=\w{32}/).then(($elem) => { const inviteLink = $elem.text(); @@ -37,8 +38,9 @@ describe("create and manage group", () => { it("create a group", () => { cy.visitWithLogin("/settings/identities/groups"); - cy.get('[data-testid="manage-users-groups-v2"]'); - cy.wait(1000); + cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should( + "be.visible", + ); cy.clickOptionWithText("Create group"); cy.waitTextVisible("Create new group"); cy.get("#name").type(group_name); @@ -53,33 +55,90 @@ describe("create and manage group", () => { it("add test user to a group", () => { cy.visitWithLogin("/settings/identities/users"); - cy.get('[data-testid="manage-users-groups-v2"]'); - cy.wait(1000); + cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should( + "be.visible", + ); cy.get(".ant-tabs-tab-btn").contains("Groups").click(); + // Wait for groups tab to load and group to be visible + cy.contains(group_name, { timeout: 10000 }).should("be.visible"); cy.clickOptionWithText(group_name); cy.clickTextOptionWithClass(".ant-typography", group_name); // cy.get(".ant-typography").contains(group_name).should("be.visible"); - cy.clickTextOptionWithClass(".ant-tabs-tab", "Members"); - // cy.get(".ant-tabs-tab").contains("Members").click(); - cy.waitTextVisible("No members in this group yet."); - cy.clickOptionWithText("Add Member"); - // cy.clickOptionWithText('Search for users...') - cy.contains("Search for users...").click({ force: true }); - cy.focused().type(username); - // cy.clickOptionWithText('Add group members') - // cy.clickTextOptionWithClass(".ant-select-item-option", username) - cy.get(".ant-select-item-option").contains(username).click(); - cy.focused().blur(); - cy.contains(username).should("have.length", 1); - cy.get('[role="dialog"] button').contains("Add").click({ force: true }); + // Click on the Members tab and wait for it to load + cy.get(".ant-tabs-tab").contains("Members").click(); + + // Wait for tab content to be fully loaded by looking for specific content + cy.get("body").then(($body) => { + if ($body.text().includes(Cypress.env("ADMIN_DISPLAYNAME"))) { + cy.contains(Cypress.env("ADMIN_DISPLAYNAME"), { + timeout: 10000, + }).should("be.visible"); + } else { + // Tab is loaded, continue + cy.wait(1000); // Give it a moment to settle + } + }); + + // Look for the Add Member button (it should be visible regardless of existing members) + cy.get("button", { timeout: 10000 }) + .contains("Add Member") + .should("be.visible") + .click(); + // Wait for the modal to appear and ensure it's fully loaded + cy.get('[role="dialog"]', { timeout: 10000 }).should("be.visible"); + + // Try multiple approaches to interact with the user search dropdown + cy.get("body").then(($body) => { + // First try to find the ant-select component directly + if ($body.find(".ant-select:not(.ant-select-disabled)").length > 0) { + cy.get(".ant-select:not(.ant-select-disabled)") + .first() + .click({ force: true }); + } else { + // Fallback: try to find the search input or placeholder + cy.get('[role="dialog"]').within(() => { + cy.get( + '.ant-select-selector, .ant-select-selection-search-input, [placeholder*="user"]', + ) + .first() + .click({ force: true }); + }); + } + }); + + // Type the username into the search field (ensure we get only the visible one in the dialog) + cy.get('[role="dialog"]').within(() => { + cy.get('.ant-select-selection-search-input, input[role="combobox"]') + .first() + .should("be.visible") + .type(username, { force: true }); + }); + + // Wait for search results and select the user + cy.get(".ant-select-item-option", { timeout: 10000 }) + .contains(username) + .should("be.visible") + .click(); + + // Wait for dropdown to close and verify the user was selected + cy.get('[role="dialog"]').within(() => { + // Wait for the dropdown to close + cy.get(".ant-select-dropdown", { timeout: 5000 }).should("not.exist"); + // Verify the user was selected + cy.contains(username).should("be.visible"); + // Click the Add button with force to handle any lingering overlay issues + cy.get("button").contains("Add").click({ force: true }); + }); cy.waitTextVisible("Group members added!"); cy.contains(username, { timeout: 10000 }).should("be.visible"); }); it("update group info", () => { cy.visitWithLogin("/settings/identities/groups"); - cy.get('[data-testid="manage-users-groups-v2"]'); - cy.wait(1000); + cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should( + "be.visible", + ); + cy.contains(group_name, { timeout: 10000 }).should("be.visible"); cy.clickOptionWithText(group_name); cy.clickOptionWithSpecificClass(".ant-typography", 0); cy.clickOptionWithTestId("EditOutlinedIcon"); @@ -97,9 +156,13 @@ describe("create and manage group", () => { it("user verify to edit the discription", () => { cy.visitWithLogin("/settings/identities/groups"); - cy.get('[data-testid="manage-users-groups-v2"]'); - cy.wait(1000); - cy.contains(`Test group EDITED ${test_id}`).should("be.visible").click(); + cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should( + "be.visible", + ); + cy.contains(`Test group EDITED ${test_id}`, { timeout: 10000 }) + .should("be.visible") + .first() + .click(); cy.get('[data-testid="EditOutlinedIcon"]').eq(1).click(); cy.contains("Test group description").should("be.visible").type(" EDITED"); cy.clickOptionWithText("Test group"); @@ -111,16 +174,24 @@ describe("create and manage group", () => { it("user verify to add the owner", () => { cy.visitWithLogin("/settings/identities/groups"); - cy.get('[data-testid="manage-users-groups-v2"]'); - cy.wait(1000); - cy.contains(`Test group EDITED ${test_id}`).should("be.visible").click(); - cy.get(".anticon.anticon-plus").click(); + cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should( + "be.visible", + ); + cy.contains(`Test group EDITED ${test_id}`, { timeout: 10000 }) + .should("be.visible") + .first() + .click(); + cy.get('[data-testid="add-owners-sidebar-button"]', { timeout: 10000 }) + .should("be.visible") + .click(); cy.get('[aria-label="Close"]').should("be.visible"); cy.get('[id="owner"]').click(); cy.contains("Add Owners").click(); cy.get('[id="owner"]').click(); cy.focused().type(username); - cy.get(`[data-testid="owner-${username}"]`).click(); + cy.get(`[data-testid="owner-${username}"]`, { timeout: 10000 }) + .should("be.visible") + .click(); cy.focused().blur(); cy.contains(username, { matchCase: false }).should("have.length", 1); cy.get('[role="dialog"] button').contains("Add").click(); @@ -130,21 +201,51 @@ describe("create and manage group", () => { it("test User verify group participation", () => { cy.visitWithLogin("/settings/identities/groups"); - cy.get('[data-testid="manage-users-groups-v2"]'); - cy.wait(1000); + cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should( + "be.visible", + ); cy.hideOnboardingTour(); - cy.clickOptionWithText(`Test group EDITED ${test_id}`); - cy.get(".ant-tabs-tab").contains("Members").click(); - cy.waitTextVisible(username); + + // Add debugging and robust existence check + cy.get("body").then(($body) => { + if ($body.text().includes(`Test group EDITED ${test_id}`)) { + cy.log("Found group:", `Test group EDITED ${test_id}`); + } else { + cy.log( + "Group not found in page, available text:", + $body.text().substring(0, 500), + ); + } + }); + + // Wait for and verify the group exists before clicking + // Use first() to ensure we only click on one element if multiple exist + cy.contains(`Test group EDITED ${test_id}`, { timeout: 10000 }) + .should("be.visible") + .first() + .click(); + + // Wait for Members tab to be visible before clicking + cy.get(".ant-tabs-tab", { timeout: 10000 }) + .contains("Members") + .should("be.visible") + .click(); + + // Verify the user is in the group with explicit timeout + cy.contains(username, { timeout: 10000 }).should("be.visible"); }); it("remove group", () => { cy.visitWithLogin("/settings/identities/groups"); - cy.get('[data-testid="manage-users-groups-v2"]'); - cy.wait(1000); - cy.get( - `[href="/group/urn:li:corpGroup:${test_id}"]`, - ).openThreeDotDropdown(); + cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should( + "be.visible", + ); + + // Wait for the group link to be present before trying to interact + cy.get(`[href="/group/urn:li:corpGroup:${test_id}"]`, { timeout: 10000 }) + .should("be.visible") + .openThreeDotDropdown(); + cy.clickOptionWithText("Delete"); cy.clickOptionWithText("Yes"); cy.waitTextVisible("Deleted Group!");