Skip to content
Snippets Groups Projects
Unverified Commit 464902f8 authored by Kamil Mielnik's avatar Kamil Mielnik Committed by GitHub
Browse files

Fix flaky dashcards test (#48676)

* Revert "fix flakiness during resize (#48556)"

This reverts commit 03b6584b.

* Move .should call up to fix flaky test

* Use consistent naming
parent c172fe43
No related branches found
No related tags found
No related merge requests found
...@@ -34,18 +34,14 @@ export const assertDescendantNotOverflowsContainer = ( ...@@ -34,18 +34,14 @@ export const assertDescendantNotOverflowsContainer = (
return; return;
} }
cy.wrap(descendantRect).should($descendantRect => { expect(descendantRect.bottom, `${message} bottom`).to.be.lte(
expect($descendantRect.bottom, `${message} bottom`).to.be.lte( containerRect.bottom,
containerRect.bottom, );
); expect(descendantRect.top, `${message} top`).to.be.gte(containerRect.top);
expect($descendantRect.top, `${message} top`).to.be.gte(containerRect.top); expect(descendantRect.left, `${message} left`).to.be.gte(containerRect.left);
expect($descendantRect.left, `${message} left`).to.be.gte( expect(descendantRect.right, `${message} right`).to.be.lte(
containerRect.left, containerRect.right,
); );
expect($descendantRect.right, `${message} right`).to.be.lte(
containerRect.right,
);
});
}; };
export const assertIsEllipsified = element => { export const assertIsEllipsified = element => {
......
...@@ -1095,15 +1095,17 @@ describe("issue 31628", () => { ...@@ -1095,15 +1095,17 @@ describe("issue 31628", () => {
}; };
const assertDescendantsNotOverflowDashcards = descendantsSelector => { const assertDescendantsNotOverflowDashcards = descendantsSelector => {
cy.findAllByTestId("dashcard").each((dashcard, dashcardIndex) => { cy.findAllByTestId("dashcard").should(dashcards => {
const descendants = dashcard.find(descendantsSelector); dashcards.each((dashcardIndex, dashcard) => {
const descendants = dashcard.querySelectorAll(descendantsSelector);
descendants.each((_descendantIndex, descendant) => {
assertDescendantNotOverflowsContainer( descendants.forEach(descendant => {
descendant, assertDescendantNotOverflowsContainer(
dashcard[0], descendant,
`dashcard[${dashcardIndex}] [data-testid="${descendant.dataset.testid}"]`, dashcard,
); `dashcard[${dashcardIndex}] [data-testid="${descendant.dataset.testid}"]`,
);
});
}); });
}); });
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment