Add waits in Spotlight Cypress tests, hoping this unflakes them (#11590)
Attempt to fix: * https://github.com/vector-im/element-web/issues/26053 * https://github.com/vector-im/element-web/issues/26140 * https://github.com/vector-im/element-web/issues/26139 * https://github.com/vector-im/element-web/issues/26138
This commit is contained in:
parent
0ee2eac0e5
commit
f1f8c6bf2c
1 changed files with 15 additions and 0 deletions
|
@ -226,6 +226,7 @@ describe("Spotlight", () => {
|
||||||
cy.get(".mx_SpotlightDialog_filter").should("contain", "Public spaces");
|
cy.get(".mx_SpotlightDialog_filter").should("contain", "Public spaces");
|
||||||
cy.spotlightSearch().type("{backspace}");
|
cy.spotlightSearch().type("{backspace}");
|
||||||
cy.get(".mx_SpotlightDialog_filter").should("not.exist");
|
cy.get(".mx_SpotlightDialog_filter").should("not.exist");
|
||||||
|
cy.wait(200); // Again, wait to settle so keypresses arrive correctly
|
||||||
|
|
||||||
cy.spotlightSearch().type("{downArrow}");
|
cy.spotlightSearch().type("{downArrow}");
|
||||||
cy.get("#mx_SpotlightDialog_button_explorePublicRooms").should("have.attr", "aria-selected", "true");
|
cy.get("#mx_SpotlightDialog_button_explorePublicRooms").should("have.attr", "aria-selected", "true");
|
||||||
|
@ -239,6 +240,7 @@ describe("Spotlight", () => {
|
||||||
it("should find joined rooms", () => {
|
it("should find joined rooms", () => {
|
||||||
cy.openSpotlightDialog()
|
cy.openSpotlightDialog()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightSearch().clear().type(room1Name);
|
cy.spotlightSearch().clear().type(room1Name);
|
||||||
cy.spotlightResults().should("have.length", 1);
|
cy.spotlightResults().should("have.length", 1);
|
||||||
cy.spotlightResults().eq(0).should("contain", room1Name);
|
cy.spotlightResults().eq(0).should("contain", room1Name);
|
||||||
|
@ -253,6 +255,7 @@ describe("Spotlight", () => {
|
||||||
it("should find known public rooms", () => {
|
it("should find known public rooms", () => {
|
||||||
cy.openSpotlightDialog()
|
cy.openSpotlightDialog()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.PublicRooms);
|
cy.spotlightFilter(Filter.PublicRooms);
|
||||||
cy.spotlightSearch().clear().type(room1Name);
|
cy.spotlightSearch().clear().type(room1Name);
|
||||||
cy.spotlightResults().should("have.length", 1);
|
cy.spotlightResults().should("have.length", 1);
|
||||||
|
@ -269,6 +272,7 @@ describe("Spotlight", () => {
|
||||||
it("should find unknown public rooms", () => {
|
it("should find unknown public rooms", () => {
|
||||||
cy.openSpotlightDialog()
|
cy.openSpotlightDialog()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.PublicRooms);
|
cy.spotlightFilter(Filter.PublicRooms);
|
||||||
cy.spotlightSearch().clear().type(room2Name);
|
cy.spotlightSearch().clear().type(room2Name);
|
||||||
cy.spotlightResults().should("have.length", 1);
|
cy.spotlightResults().should("have.length", 1);
|
||||||
|
@ -286,6 +290,7 @@ describe("Spotlight", () => {
|
||||||
it("should find unknown public world readable rooms", () => {
|
it("should find unknown public world readable rooms", () => {
|
||||||
cy.openSpotlightDialog()
|
cy.openSpotlightDialog()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.PublicRooms);
|
cy.spotlightFilter(Filter.PublicRooms);
|
||||||
cy.spotlightSearch().clear().type(room3Name);
|
cy.spotlightSearch().clear().type(room3Name);
|
||||||
cy.spotlightResults().should("have.length", 1);
|
cy.spotlightResults().should("have.length", 1);
|
||||||
|
@ -305,6 +310,7 @@ describe("Spotlight", () => {
|
||||||
it.skip("should find unknown public rooms on other homeservers", () => {
|
it.skip("should find unknown public rooms on other homeservers", () => {
|
||||||
cy.openSpotlightDialog()
|
cy.openSpotlightDialog()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.PublicRooms);
|
cy.spotlightFilter(Filter.PublicRooms);
|
||||||
cy.spotlightSearch().clear().type(room3Name);
|
cy.spotlightSearch().clear().type(room3Name);
|
||||||
cy.get("[aria-haspopup=true][role=button]").click();
|
cy.get("[aria-haspopup=true][role=button]").click();
|
||||||
|
@ -317,6 +323,7 @@ describe("Spotlight", () => {
|
||||||
})
|
})
|
||||||
.then(() =>
|
.then(() =>
|
||||||
cy.spotlightDialog().within(() => {
|
cy.spotlightDialog().within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightResults().should("have.length", 1);
|
cy.spotlightResults().should("have.length", 1);
|
||||||
cy.spotlightResults().eq(0).should("contain", room3Name);
|
cy.spotlightResults().eq(0).should("contain", room3Name);
|
||||||
cy.spotlightResults().eq(0).should("contain", room3Id);
|
cy.spotlightResults().eq(0).should("contain", room3Id);
|
||||||
|
@ -327,6 +334,7 @@ describe("Spotlight", () => {
|
||||||
it("should find known people", () => {
|
it("should find known people", () => {
|
||||||
cy.openSpotlightDialog()
|
cy.openSpotlightDialog()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.People);
|
cy.spotlightFilter(Filter.People);
|
||||||
cy.spotlightSearch().clear().type(bot1Name);
|
cy.spotlightSearch().clear().type(bot1Name);
|
||||||
cy.spotlightResults().should("have.length", 1);
|
cy.spotlightResults().should("have.length", 1);
|
||||||
|
@ -341,6 +349,7 @@ describe("Spotlight", () => {
|
||||||
it("should find unknown people", () => {
|
it("should find unknown people", () => {
|
||||||
cy.openSpotlightDialog()
|
cy.openSpotlightDialog()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.People);
|
cy.spotlightFilter(Filter.People);
|
||||||
cy.spotlightSearch().clear().type(bot2Name);
|
cy.spotlightSearch().clear().type(bot2Name);
|
||||||
cy.spotlightResults().should("have.length", 1);
|
cy.spotlightResults().should("have.length", 1);
|
||||||
|
@ -358,6 +367,7 @@ describe("Spotlight", () => {
|
||||||
|
|
||||||
// Starting a DM with ByteBot (will be turned into a group dm later)
|
// Starting a DM with ByteBot (will be turned into a group dm later)
|
||||||
cy.openSpotlightDialog().within(() => {
|
cy.openSpotlightDialog().within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.People);
|
cy.spotlightFilter(Filter.People);
|
||||||
cy.spotlightSearch().clear().type(bot2Name);
|
cy.spotlightSearch().clear().type(bot2Name);
|
||||||
cy.spotlightResults().should("have.length", 1);
|
cy.spotlightResults().should("have.length", 1);
|
||||||
|
@ -413,6 +423,7 @@ describe("Spotlight", () => {
|
||||||
// Test against https://github.com/vector-im/element-web/issues/22851
|
// Test against https://github.com/vector-im/element-web/issues/22851
|
||||||
it("should show each person result only once", () => {
|
it("should show each person result only once", () => {
|
||||||
cy.openSpotlightDialog().within(() => {
|
cy.openSpotlightDialog().within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.People);
|
cy.spotlightFilter(Filter.People);
|
||||||
|
|
||||||
// 2 rounds of search to simulate the bug conditions. Specifically, the first search
|
// 2 rounds of search to simulate the bug conditions. Specifically, the first search
|
||||||
|
@ -433,6 +444,7 @@ describe("Spotlight", () => {
|
||||||
it("should allow opening group chat dialog", () => {
|
it("should allow opening group chat dialog", () => {
|
||||||
cy.openSpotlightDialog()
|
cy.openSpotlightDialog()
|
||||||
.within(() => {
|
.within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.People);
|
cy.spotlightFilter(Filter.People);
|
||||||
cy.spotlightSearch().clear().type(bot2Name);
|
cy.spotlightSearch().clear().type(bot2Name);
|
||||||
cy.wait(3000); // wait for the dialog code to settle
|
cy.wait(3000); // wait for the dialog code to settle
|
||||||
|
@ -456,6 +468,7 @@ describe("Spotlight", () => {
|
||||||
cy.visit("/#/home");
|
cy.visit("/#/home");
|
||||||
|
|
||||||
cy.openSpotlightDialog().within(() => {
|
cy.openSpotlightDialog().within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.People);
|
cy.spotlightFilter(Filter.People);
|
||||||
cy.spotlightSearch().clear().type(bot1Name);
|
cy.spotlightSearch().clear().type(bot1Name);
|
||||||
cy.wait(3000); // wait for the dialog code to settle
|
cy.wait(3000); // wait for the dialog code to settle
|
||||||
|
@ -466,6 +479,7 @@ describe("Spotlight", () => {
|
||||||
|
|
||||||
it("should be able to navigate results via keyboard", () => {
|
it("should be able to navigate results via keyboard", () => {
|
||||||
cy.openSpotlightDialog().within(() => {
|
cy.openSpotlightDialog().within(() => {
|
||||||
|
cy.wait(500); // Wait for dialog to settle
|
||||||
cy.spotlightFilter(Filter.People);
|
cy.spotlightFilter(Filter.People);
|
||||||
cy.spotlightSearch().clear().type("b");
|
cy.spotlightSearch().clear().type("b");
|
||||||
// our debouncing logic only starts the search after a short timeout,
|
// our debouncing logic only starts the search after a short timeout,
|
||||||
|
@ -474,6 +488,7 @@ describe("Spotlight", () => {
|
||||||
cy.get(".mx_Spinner")
|
cy.get(".mx_Spinner")
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
cy.wait(500); // Wait to settle again
|
||||||
cy.spotlightResults()
|
cy.spotlightResults()
|
||||||
.should("have.length", 2)
|
.should("have.length", 2)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
Loading…
Reference in a new issue