mirror of
				https://github.com/datahub-project/datahub.git
				synced 2025-11-04 04:39:10 +00:00 
			
		
		
		
	fix(test): replace arbitrary waits with conditional waits in cypress tests (#14410)
Co-authored-by: Jay <159848059+jayacryl@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									6787d83fa6
								
							
						
					
					
						commit
						ec220f0802
					
				@ -31,7 +31,7 @@ export const GroupSidebarOwnersSection = ({ ownership, refetch, urn }: Props) =>
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
            extra={
 | 
					            extra={
 | 
				
			||||||
                <SectionActionButton
 | 
					                <SectionActionButton
 | 
				
			||||||
                    button={<PlusOutlined />}
 | 
					                    button={<PlusOutlined data-testid="add-owners-sidebar-button" />}
 | 
				
			||||||
                    onClick={(event) => {
 | 
					                    onClick={(event) => {
 | 
				
			||||||
                        setShowAddOwnerModal(true);
 | 
					                        setShowAddOwnerModal(true);
 | 
				
			||||||
                        event.stopPropagation();
 | 
					                        event.stopPropagation();
 | 
				
			||||||
 | 
				
			|||||||
@ -70,10 +70,10 @@ describe("incidents", () => {
 | 
				
			|||||||
      .first()
 | 
					      .first()
 | 
				
			||||||
      .click();
 | 
					      .click();
 | 
				
			||||||
    cy.get('[data-testid="incident-create-button"]').click();
 | 
					    cy.get('[data-testid="incident-create-button"]').click();
 | 
				
			||||||
    cy.wait(3000);
 | 
					    // Wait for the incident to be created and appear in the list
 | 
				
			||||||
    cy.get(
 | 
					    cy.get(`[data-testid="incident-row-${newIncidentNameWithTimeStamp}"]`, {
 | 
				
			||||||
      `[data-testid="incident-row-${newIncidentNameWithTimeStamp}"]`,
 | 
					      timeout: 15000,
 | 
				
			||||||
    ).should("exist");
 | 
					    }).should("exist");
 | 
				
			||||||
    cy.get(`[data-testid="${newIncidentNameWithTimeStamp}"]`)
 | 
					    cy.get(`[data-testid="${newIncidentNameWithTimeStamp}"]`)
 | 
				
			||||||
      .scrollIntoView()
 | 
					      .scrollIntoView()
 | 
				
			||||||
      .should("be.visible");
 | 
					      .should("be.visible");
 | 
				
			||||||
@ -101,9 +101,10 @@ describe("incidents", () => {
 | 
				
			|||||||
      .should("exist")
 | 
					      .should("exist")
 | 
				
			||||||
      .click();
 | 
					      .click();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cy.wait(1000);
 | 
					    // Wait for the incident details to load
 | 
				
			||||||
 | 
					    cy.get('[data-testid="edit-incident-icon"]', { timeout: 10000 })
 | 
				
			||||||
    cy.get('[data-testid="edit-incident-icon"]').click();
 | 
					      .should("be.visible")
 | 
				
			||||||
 | 
					      .click();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cy.get('[data-testid="incident-name-input"]')
 | 
					    cy.get('[data-testid="incident-name-input"]')
 | 
				
			||||||
      .clear()
 | 
					      .clear()
 | 
				
			||||||
@ -134,8 +135,12 @@ describe("incidents", () => {
 | 
				
			|||||||
    cy.get('[data-testid="status-select-input-type"]').click();
 | 
					    cy.get('[data-testid="status-select-input-type"]').click();
 | 
				
			||||||
    cy.get('[data-testid="status-options-list"]').contains("Resolved").click();
 | 
					    cy.get('[data-testid="status-options-list"]').contains("Resolved").click();
 | 
				
			||||||
    cy.get('[data-testid="incident-create-button"]').click();
 | 
					    cy.get('[data-testid="incident-create-button"]').click();
 | 
				
			||||||
    cy.wait(3000);
 | 
					    // Wait for the incident to be updated and page to reload
 | 
				
			||||||
    cy.get('[data-testid="nested-options-dropdown-container"]').click();
 | 
					    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="child-option-RESOLVED"]').click();
 | 
				
			||||||
    cy.get('[data-testid="nested-options-dropdown-container"]').click();
 | 
					    cy.get('[data-testid="nested-options-dropdown-container"]').click();
 | 
				
			||||||
    cy.get('[data-testid="incident-group-HIGH"]').scrollIntoView();
 | 
					    cy.get('[data-testid="incident-group-HIGH"]').scrollIntoView();
 | 
				
			||||||
@ -174,9 +179,24 @@ describe("incidents", () => {
 | 
				
			|||||||
    cy.visit(
 | 
					    cy.visit(
 | 
				
			||||||
      "/dataset/urn:li:dataset:(urn:li:dataPlatform:bigquery,cypress_project.jaffle_shop.customers,PROD)/Incidents?is_lineage_mode=false&separate_siblings=false",
 | 
					      "/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();
 | 
					    // Wait for the page to load properly and button to be interactive
 | 
				
			||||||
    cy.get('[data-testid="drawer-header-title"]').should(
 | 
					    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",
 | 
					      "contain.text",
 | 
				
			||||||
      "Create New Incident",
 | 
					      "Create New Incident",
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
@ -213,8 +233,10 @@ describe("incidents", () => {
 | 
				
			|||||||
      .first()
 | 
					      .first()
 | 
				
			||||||
      .click();
 | 
					      .click();
 | 
				
			||||||
    cy.get('[data-testid="incident-create-button"]').click();
 | 
					    cy.get('[data-testid="incident-create-button"]').click();
 | 
				
			||||||
    cy.wait(3000);
 | 
					    // Wait for the incident to be created and incident groups to load
 | 
				
			||||||
    cy.get('[data-testid="incident-group-CRITICAL"]').scrollIntoView();
 | 
					    cy.get('[data-testid="incident-group-CRITICAL"]', { timeout: 15000 })
 | 
				
			||||||
 | 
					      .should("exist")
 | 
				
			||||||
 | 
					      .scrollIntoView();
 | 
				
			||||||
    cy.get('[data-testid="incident-group-CRITICAL"]').within(() => {
 | 
					    cy.get('[data-testid="incident-group-CRITICAL"]').within(() => {
 | 
				
			||||||
      cy.get('[data-testid="group-header-collapsed-icon"]')
 | 
					      cy.get('[data-testid="group-header-collapsed-icon"]')
 | 
				
			||||||
        .should(Cypress._.noop) // Prevent Cypress from failing if the element is missing
 | 
					        .should(Cypress._.noop) // Prevent Cypress from failing if the element is missing
 | 
				
			||||||
@ -285,8 +307,10 @@ describe("incidents", () => {
 | 
				
			|||||||
      .first()
 | 
					      .first()
 | 
				
			||||||
      .click();
 | 
					      .click();
 | 
				
			||||||
    cy.get('[data-testid="incident-create-button"]').click();
 | 
					    cy.get('[data-testid="incident-create-button"]').click();
 | 
				
			||||||
    cy.wait(3000);
 | 
					    // Wait for the incident to be created and incident groups to load
 | 
				
			||||||
    cy.get('[data-testid="incident-group-CRITICAL"]').scrollIntoView();
 | 
					    cy.get('[data-testid="incident-group-CRITICAL"]', { timeout: 15000 })
 | 
				
			||||||
 | 
					      .should("exist")
 | 
				
			||||||
 | 
					      .scrollIntoView();
 | 
				
			||||||
    cy.get('[data-testid="incident-group-CRITICAL"]').within(() => {
 | 
					    cy.get('[data-testid="incident-group-CRITICAL"]').within(() => {
 | 
				
			||||||
      cy.get('[data-testid="group-header-collapsed-icon"]')
 | 
					      cy.get('[data-testid="group-header-collapsed-icon"]')
 | 
				
			||||||
        .should(Cypress._.noop) // Prevent Cypress from failing if the element is missing
 | 
					        .should(Cypress._.noop) // Prevent Cypress from failing if the element is missing
 | 
				
			||||||
 | 
				
			|||||||
@ -13,8 +13,9 @@ describe("create and manage group", () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  it("add test user", () => {
 | 
					  it("add test user", () => {
 | 
				
			||||||
    cy.visitWithLogin("/settings/identities/users");
 | 
					    cy.visitWithLogin("/settings/identities/users");
 | 
				
			||||||
    cy.get('[data-testid="manage-users-groups-v2"]');
 | 
					    cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should(
 | 
				
			||||||
    cy.wait(3000);
 | 
					      "be.visible",
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
    cy.clickOptionWithText("Invite Users");
 | 
					    cy.clickOptionWithText("Invite Users");
 | 
				
			||||||
    cy.waitTextVisible(/signup\?invite_token=\w{32}/).then(($elem) => {
 | 
					    cy.waitTextVisible(/signup\?invite_token=\w{32}/).then(($elem) => {
 | 
				
			||||||
      const inviteLink = $elem.text();
 | 
					      const inviteLink = $elem.text();
 | 
				
			||||||
@ -37,8 +38,9 @@ describe("create and manage group", () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  it("create a group", () => {
 | 
					  it("create a group", () => {
 | 
				
			||||||
    cy.visitWithLogin("/settings/identities/groups");
 | 
					    cy.visitWithLogin("/settings/identities/groups");
 | 
				
			||||||
    cy.get('[data-testid="manage-users-groups-v2"]');
 | 
					    cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should(
 | 
				
			||||||
    cy.wait(1000);
 | 
					      "be.visible",
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
    cy.clickOptionWithText("Create group");
 | 
					    cy.clickOptionWithText("Create group");
 | 
				
			||||||
    cy.waitTextVisible("Create new group");
 | 
					    cy.waitTextVisible("Create new group");
 | 
				
			||||||
    cy.get("#name").type(group_name);
 | 
					    cy.get("#name").type(group_name);
 | 
				
			||||||
@ -53,33 +55,90 @@ describe("create and manage group", () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  it("add test user to a group", () => {
 | 
					  it("add test user to a group", () => {
 | 
				
			||||||
    cy.visitWithLogin("/settings/identities/users");
 | 
					    cy.visitWithLogin("/settings/identities/users");
 | 
				
			||||||
    cy.get('[data-testid="manage-users-groups-v2"]');
 | 
					    cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should(
 | 
				
			||||||
    cy.wait(1000);
 | 
					      "be.visible",
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
    cy.get(".ant-tabs-tab-btn").contains("Groups").click();
 | 
					    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.clickOptionWithText(group_name);
 | 
				
			||||||
    cy.clickTextOptionWithClass(".ant-typography", group_name);
 | 
					    cy.clickTextOptionWithClass(".ant-typography", group_name);
 | 
				
			||||||
    // cy.get(".ant-typography").contains(group_name).should("be.visible");
 | 
					    // cy.get(".ant-typography").contains(group_name).should("be.visible");
 | 
				
			||||||
    cy.clickTextOptionWithClass(".ant-tabs-tab", "Members");
 | 
					    // Click on the Members tab and wait for it to load
 | 
				
			||||||
    // cy.get(".ant-tabs-tab").contains("Members").click();
 | 
					    cy.get(".ant-tabs-tab").contains("Members").click();
 | 
				
			||||||
    cy.waitTextVisible("No members in this group yet.");
 | 
					
 | 
				
			||||||
    cy.clickOptionWithText("Add Member");
 | 
					    // Wait for tab content to be fully loaded by looking for specific content
 | 
				
			||||||
    // cy.clickOptionWithText('Search for users...')
 | 
					    cy.get("body").then(($body) => {
 | 
				
			||||||
    cy.contains("Search for users...").click({ force: true });
 | 
					      if ($body.text().includes(Cypress.env("ADMIN_DISPLAYNAME"))) {
 | 
				
			||||||
    cy.focused().type(username);
 | 
					        cy.contains(Cypress.env("ADMIN_DISPLAYNAME"), {
 | 
				
			||||||
    // cy.clickOptionWithText('Add group members')
 | 
					          timeout: 10000,
 | 
				
			||||||
    // cy.clickTextOptionWithClass(".ant-select-item-option", username)
 | 
					        }).should("be.visible");
 | 
				
			||||||
    cy.get(".ant-select-item-option").contains(username).click();
 | 
					      } else {
 | 
				
			||||||
    cy.focused().blur();
 | 
					        // Tab is loaded, continue
 | 
				
			||||||
    cy.contains(username).should("have.length", 1);
 | 
					        cy.wait(1000); // Give it a moment to settle
 | 
				
			||||||
    cy.get('[role="dialog"] button').contains("Add").click({ force: true });
 | 
					      }
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // 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.waitTextVisible("Group members added!");
 | 
				
			||||||
    cy.contains(username, { timeout: 10000 }).should("be.visible");
 | 
					    cy.contains(username, { timeout: 10000 }).should("be.visible");
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  it("update group info", () => {
 | 
					  it("update group info", () => {
 | 
				
			||||||
    cy.visitWithLogin("/settings/identities/groups");
 | 
					    cy.visitWithLogin("/settings/identities/groups");
 | 
				
			||||||
    cy.get('[data-testid="manage-users-groups-v2"]');
 | 
					    cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should(
 | 
				
			||||||
    cy.wait(1000);
 | 
					      "be.visible",
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
 | 
					    cy.contains(group_name, { timeout: 10000 }).should("be.visible");
 | 
				
			||||||
    cy.clickOptionWithText(group_name);
 | 
					    cy.clickOptionWithText(group_name);
 | 
				
			||||||
    cy.clickOptionWithSpecificClass(".ant-typography", 0);
 | 
					    cy.clickOptionWithSpecificClass(".ant-typography", 0);
 | 
				
			||||||
    cy.clickOptionWithTestId("EditOutlinedIcon");
 | 
					    cy.clickOptionWithTestId("EditOutlinedIcon");
 | 
				
			||||||
@ -97,9 +156,13 @@ describe("create and manage group", () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  it("user verify to edit the discription", () => {
 | 
					  it("user verify to edit the discription", () => {
 | 
				
			||||||
    cy.visitWithLogin("/settings/identities/groups");
 | 
					    cy.visitWithLogin("/settings/identities/groups");
 | 
				
			||||||
    cy.get('[data-testid="manage-users-groups-v2"]');
 | 
					    cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should(
 | 
				
			||||||
    cy.wait(1000);
 | 
					      "be.visible",
 | 
				
			||||||
    cy.contains(`Test group EDITED ${test_id}`).should("be.visible").click();
 | 
					    );
 | 
				
			||||||
 | 
					    cy.contains(`Test group EDITED ${test_id}`, { timeout: 10000 })
 | 
				
			||||||
 | 
					      .should("be.visible")
 | 
				
			||||||
 | 
					      .first()
 | 
				
			||||||
 | 
					      .click();
 | 
				
			||||||
    cy.get('[data-testid="EditOutlinedIcon"]').eq(1).click();
 | 
					    cy.get('[data-testid="EditOutlinedIcon"]').eq(1).click();
 | 
				
			||||||
    cy.contains("Test group description").should("be.visible").type(" EDITED");
 | 
					    cy.contains("Test group description").should("be.visible").type(" EDITED");
 | 
				
			||||||
    cy.clickOptionWithText("Test group");
 | 
					    cy.clickOptionWithText("Test group");
 | 
				
			||||||
@ -111,16 +174,24 @@ describe("create and manage group", () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  it("user verify to add the owner", () => {
 | 
					  it("user verify to add the owner", () => {
 | 
				
			||||||
    cy.visitWithLogin("/settings/identities/groups");
 | 
					    cy.visitWithLogin("/settings/identities/groups");
 | 
				
			||||||
    cy.get('[data-testid="manage-users-groups-v2"]');
 | 
					    cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should(
 | 
				
			||||||
    cy.wait(1000);
 | 
					      "be.visible",
 | 
				
			||||||
    cy.contains(`Test group EDITED ${test_id}`).should("be.visible").click();
 | 
					    );
 | 
				
			||||||
    cy.get(".anticon.anticon-plus").click();
 | 
					    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('[aria-label="Close"]').should("be.visible");
 | 
				
			||||||
    cy.get('[id="owner"]').click();
 | 
					    cy.get('[id="owner"]').click();
 | 
				
			||||||
    cy.contains("Add Owners").click();
 | 
					    cy.contains("Add Owners").click();
 | 
				
			||||||
    cy.get('[id="owner"]').click();
 | 
					    cy.get('[id="owner"]').click();
 | 
				
			||||||
    cy.focused().type(username);
 | 
					    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.focused().blur();
 | 
				
			||||||
    cy.contains(username, { matchCase: false }).should("have.length", 1);
 | 
					    cy.contains(username, { matchCase: false }).should("have.length", 1);
 | 
				
			||||||
    cy.get('[role="dialog"] button').contains("Add").click();
 | 
					    cy.get('[role="dialog"] button').contains("Add").click();
 | 
				
			||||||
@ -130,21 +201,51 @@ describe("create and manage group", () => {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  it("test User verify group participation", () => {
 | 
					  it("test User verify group participation", () => {
 | 
				
			||||||
    cy.visitWithLogin("/settings/identities/groups");
 | 
					    cy.visitWithLogin("/settings/identities/groups");
 | 
				
			||||||
    cy.get('[data-testid="manage-users-groups-v2"]');
 | 
					    cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should(
 | 
				
			||||||
    cy.wait(1000);
 | 
					      "be.visible",
 | 
				
			||||||
 | 
					    );
 | 
				
			||||||
    cy.hideOnboardingTour();
 | 
					    cy.hideOnboardingTour();
 | 
				
			||||||
    cy.clickOptionWithText(`Test group EDITED ${test_id}`);
 | 
					
 | 
				
			||||||
    cy.get(".ant-tabs-tab").contains("Members").click();
 | 
					    // Add debugging and robust existence check
 | 
				
			||||||
    cy.waitTextVisible(username);
 | 
					    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", () => {
 | 
					  it("remove group", () => {
 | 
				
			||||||
    cy.visitWithLogin("/settings/identities/groups");
 | 
					    cy.visitWithLogin("/settings/identities/groups");
 | 
				
			||||||
    cy.get('[data-testid="manage-users-groups-v2"]');
 | 
					    cy.get('[data-testid="manage-users-groups-v2"]', { timeout: 10000 }).should(
 | 
				
			||||||
    cy.wait(1000);
 | 
					      "be.visible",
 | 
				
			||||||
    cy.get(
 | 
					    );
 | 
				
			||||||
      `[href="/group/urn:li:corpGroup:${test_id}"]`,
 | 
					
 | 
				
			||||||
    ).openThreeDotDropdown();
 | 
					    // 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("Delete");
 | 
				
			||||||
    cy.clickOptionWithText("Yes");
 | 
					    cy.clickOptionWithText("Yes");
 | 
				
			||||||
    cy.waitTextVisible("Deleted Group!");
 | 
					    cy.waitTextVisible("Deleted Group!");
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user