Skip to content
Snippets Groups Projects
Unverified Commit 704d45bf authored by Nemanja Glumac's avatar Nemanja Glumac Committed by GitHub
Browse files

Fix newly created E2E CSV flakes (#35579)

* Fix newly created E2E CSV flakes

* Do not use `.within()` on multiple elements

* Always isolate the correct status element before assertions
parent 35718bb7
No related branches found
No related tags found
No related merge requests found
......@@ -263,17 +263,21 @@ function uploadFile(testFile, valid = true) {
);
});
cy.findByRole("status").within(() => {
cy.findByText(/Uploading/i);
cy.findByText(testFile.fileName);
});
// After #35498 has been merged, we now sometimes encounter two elements with the "status" role in UI.
// The first (older) one is related to the sync that didn't finish, and the second one is related to CSV upload.
// This is the reason we have to start using `findAllByRole` rather than `findByRole`.
// Since CSV status element is newer, we can and must use `.last()` to yield only one element within we perform the search.
cy.findAllByRole("status")
.last()
.should("contain", "Uploading data to")
.and("contain", testFile.fileName);
if (valid) {
cy.findByRole("status").within(() => {
cy.findByText("Data added to Uploads Collection", {
cy.findAllByRole("status")
.last()
.findByText("Data added to Uploads Collection", {
timeout: 10 * 1000,
});
});
cy.get("main").within(() => cy.findByText("Uploads Collection"));
......@@ -281,16 +285,12 @@ function uploadFile(testFile, valid = true) {
cy.findByText(testFile.humanName);
});
cy.findByRole("status").within(() => {
cy.findByText("Start exploring").click();
});
cy.findAllByRole("status").last().findByText("Start exploring").click();
cy.url().should("include", `/model/`);
cy.findByTestId("TableInteractive-root");
} else {
cy.findByRole("status").within(() => {
cy.findByText("Error uploading your File");
});
cy.findAllByRole("status").last().findByText("Error uploading your File");
}
}
......
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