fix(cypress) Fix flakiness in nested_domains and v2_nested_domains cypress tests (#13304)

This commit is contained in:
Chris Collins 2025-04-23 17:59:06 -04:00 committed by GitHub
parent f3a41201f2
commit 050d003169
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 17 additions and 6 deletions

View File

@ -104,6 +104,7 @@ export const EntitySearchResults = ({
)
: isSelectMode && (
<StyledCheckbox
data-testid={`checkbox-${entity.urn}`}
checked={selectedEntityUrns.indexOf(entity.urn) >= 0}
onChange={(e) =>
onSelectEntity({ urn: entity.urn, type: entity.type }, e.target.checked)

View File

@ -392,6 +392,7 @@ export const EditOwnersModal = ({
label: owner.label,
}))}
optionLabelProp="label"
data-testid="users-group-search"
>
{ownerSearchOptions}
</SelectInput>

View File

@ -179,6 +179,7 @@ export const EntitySearchResults = ({
!selectedEntityUrns.includes(entity.urn)
}
onChange={(e) => onSelectEntity(entity, e.target.checked)}
data-testid={`checkbox-${entity.urn}`}
/>
)}
{entityRegistry.renderSearchResult(entity.type, searchResult)}

View File

@ -1,4 +1,5 @@
const domainName = "CypressNestedDomain";
const chartUrn = "urn:li:chart:(looker,cypress_baz1)";
const createDomain = () => {
cy.get(".anticon-plus").first().click();
@ -60,6 +61,7 @@ const verifyEditAndPerformAddAndRemoveActionForDomain = (
) => {
cy.clickOptionWithText(entity);
cy.clickOptionWithText(action);
cy.wait(500);
cy.get('[data-testid="tag-term-modal-input"]').type(text);
cy.get('[data-testid="tag-term-option"]').contains(text).click();
cy.clickOptionWithText(body);
@ -135,6 +137,9 @@ describe("Verify nested domains test functionalities", () => {
cy.waitTextVisible("Test Label");
cy.clickOptionWithTestId("add-owners-button");
cy.waitTextVisible("Find a user or group");
cy.get('[data-testid="users-group-search"]').type(
Cypress.env("ADMIN_DISPLAYNAME"),
);
cy.clickTextOptionWithClass(
".rc-virtual-list-holder-inner",
Cypress.env("ADMIN_DISPLAYNAME"),
@ -224,25 +229,26 @@ describe("Verify nested domains test functionalities", () => {
cy.clickOptionWithText("Add assets");
cy.waitTextVisible("Add assets to Domain");
cy.enterTextInSpecificTestId("search-bar", 3, "Baz Chart 1");
cy.clickOptionWithSpecificClass(".ant-checkbox", 1);
cy.clickFirstOptionWithTestId(`checkbox-${chartUrn}`);
cy.clickOptionWithId("#continueButton");
cy.waitTextVisible("Added assets to Domain!");
cy.openThreeDotMenu();
cy.clickOptionWithText("Edit");
cy.clickOptionWithSpecificClass(".ant-checkbox", 1);
cy.clickFirstOptionWithTestId(`checkbox-${chartUrn}`);
verifyEditAndPerformAddAndRemoveActionForDomain(
"Tags",
"Add tags",
"Cypress",
"Add Tags",
);
cy.wait(3000); // give time for elastic to update before going to page
cy.clickOptionWithText("Baz Chart 1");
cy.waitTextVisible("Cypress");
cy.waitTextVisible("Marketing");
cy.go("back");
cy.openThreeDotMenu();
cy.clickOptionWithText("Edit");
cy.clickOptionWithSpecificClass(".ant-checkbox", 1);
cy.clickFirstOptionWithTestId(`checkbox-${chartUrn}`);
verifyEditAndPerformAddAndRemoveActionForDomain(
"Tags",
"Remove tags",

View File

@ -1,4 +1,5 @@
const domainName = "CypressNestedDomain";
const chartUrn = "urn:li:chart:(looker,cypress_baz2)";
const handledResizeLoopErrors = () => {
const resizeObserverLoopLimitErrRe = "ResizeObserver loop limit exceeded";
@ -282,7 +283,7 @@ describe("Verify nested domains test functionalities", () => {
cy.waitTextVisible("Add assets to Domain");
cy.get("[data-testid='search-input']").last().type("Baz Chart 2");
cy.get('[data-testid="preview-urn:li:chart:(looker,cypress_baz2)"]');
cy.clickOptionWithSpecificClass(".ant-checkbox", 1);
cy.clickFirstOptionWithTestId(`checkbox-${chartUrn}`);
cy.clickOptionWithId("#continueButton");
cy.waitTextVisible("Added assets to Domain!");
cy.get('[data-node-key="Assets"]').click();
@ -293,13 +294,14 @@ describe("Verify nested domains test functionalities", () => {
}).click();
cy.waitTextVisible("0 selected");
cy.get("[data-testid='search-input']").last().type("Baz Chart 2");
cy.clickOptionWithSpecificClass(".ant-checkbox", 1);
cy.clickFirstOptionWithTestId(`checkbox-${chartUrn}`);
verifyEditAndPerformAddAndRemoveActionForDomain(
"Tags",
"Add tags",
"Cypress",
"Add Tags",
);
cy.wait(3000); // give time for elastic to update before going to page
cy.clickOptionWithText("Baz Chart 2");
cy.waitTextVisible("Cypress");
cy.waitTextVisible("Marketing");
@ -307,7 +309,7 @@ describe("Verify nested domains test functionalities", () => {
cy.get('[data-testid="search-results-edit-button"]', {
timeout: 10000,
}).click();
cy.clickOptionWithSpecificClass(".ant-checkbox", 1);
cy.clickFirstOptionWithTestId(`checkbox-${chartUrn}`);
verifyEditAndPerformAddAndRemoveActionForDomain(
"Tags",
"Remove tags",