Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into rav/element-r/01_d…
Browse files Browse the repository at this point in the history
…evice_verification_status
  • Loading branch information
richvdh committed Apr 17, 2023
2 parents a589fb7 + 7114f82 commit 66d666c
Show file tree
Hide file tree
Showing 93 changed files with 688 additions and 427 deletions.
4 changes: 2 additions & 2 deletions cypress/e2e/integration-manager/send_event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ const INTEGRATION_MANAGER_HTML = `
`;

function openIntegrationManager() {
cy.get(".mx_RightPanel_roomSummaryButton").click();
cy.findByRole("tab", { name: "Room info" }).click();
cy.get(".mx_RoomSummaryCard_appsGroup").within(() => {
cy.contains("Add widgets, bridges & bots").click();
cy.findByRole("button", { name: "Add widgets, bridges & bots" }).click();
});
}

Expand Down
8 changes: 4 additions & 4 deletions cypress/e2e/location/location.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe("Location sharing", () => {
let homeserver: HomeserverInstance;

const selectLocationShareTypeOption = (shareType: string): Chainable<JQuery> => {
return cy.get(`[data-test-id="share-location-option-${shareType}"]`);
return cy.findByTestId(`share-location-option-${shareType}`);
};

const submitShareLocation = (): void => {
cy.get('[data-testid="location-picker-submit-button"]').click();
cy.findByRole("button", { name: "Share location" }).click();
};

beforeEach(() => {
Expand All @@ -53,7 +53,7 @@ describe("Location sharing", () => {
});

cy.openMessageComposerOptions().within(() => {
cy.get('[aria-label="Location"]').click();
cy.findByRole("menuitem", { name: "Location" }).click();
});

selectLocationShareTypeOption("Pin").click();
Expand All @@ -67,7 +67,7 @@ describe("Location sharing", () => {
// clicking location tile opens maximised map
cy.get(".mx_LocationViewDialog_wrapper").should("exist");

cy.get('[aria-label="Close dialog"]').click();
cy.closeDialog();

cy.get(".mx_Marker").should("exist");
});
Expand Down
22 changes: 11 additions & 11 deletions cypress/e2e/login/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ describe("Login", () => {
it("logs in with an existing account and lands on the home screen", () => {
cy.injectAxe();

cy.get("#mx_LoginForm_username", { timeout: 15000 }).should("be.visible");
cy.findByRole("textbox", { name: "Username", timeout: 15000 }).should("be.visible");
// Disabled because flaky - see https://github.com/vector-im/element-web/issues/24688
//cy.percySnapshot("Login");
cy.checkA11y();

cy.get(".mx_ServerPicker_change").click();
cy.get(".mx_ServerPickerDialog_otherHomeserver").type(homeserver.baseUrl);
cy.get(".mx_ServerPickerDialog_continue").click();
cy.findByRole("button", { name: "Edit" }).click();
cy.findByRole("textbox", { name: "Other homeserver" }).type(homeserver.baseUrl);
cy.findByRole("button", { name: "Continue" }).click();
// wait for the dialog to go away
cy.get(".mx_ServerPickerDialog").should("not.exist");

cy.get("#mx_LoginForm_username").type(username);
cy.get("#mx_LoginForm_password").type(password);
cy.get(".mx_Login_submit").click();
cy.findByRole("textbox", { name: "Username" }).type(username);
cy.findByPlaceholderText("Password").type(password);
cy.findByRole("button", { name: "Sign in" }).click();

cy.url().should("contain", "/#/home", { timeout: 30000 });
});
Expand All @@ -72,13 +72,13 @@ describe("Login", () => {
});

it("should go to login page on logout", () => {
cy.get('[aria-label="User menu"]').click();
cy.findByRole("button", { name: "User menu" }).click();

// give a change for the outstanding requests queue to settle before logging out
cy.wait(2000);

cy.get(".mx_UserMenu_contextMenu").within(() => {
cy.get(".mx_UserMenu_iconSignOut").click();
cy.findByRole("menuitem", { name: "Sign out" }).click();
});

cy.url().should("contain", "/#/login");
Expand All @@ -94,13 +94,13 @@ describe("Login", () => {
logout_redirect_url: "/decoder-ring/",
});

cy.get('[aria-label="User menu"]').click();
cy.findByRole("button", { name: "User menu" }).click();

// give a change for the outstanding requests queue to settle before logging out
cy.wait(2000);

cy.get(".mx_UserMenu_contextMenu").within(() => {
cy.get(".mx_UserMenu_iconSignOut").click();
cy.findByRole("menuitem", { name: "Sign out" }).click();
});

cy.url().should("contains", "decoder-ring");
Expand Down
30 changes: 17 additions & 13 deletions cypress/e2e/polls/pollHistory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ describe("Poll history", () => {
};

function openPollHistory(): void {
cy.get('.mx_HeaderButtons [aria-label="Room info"]').click();
cy.findByRole("tab", { name: "Room info" }).click();
cy.get(".mx_RoomSummaryCard").within(() => {
cy.contains("Poll history").click();
cy.findByRole("button", { name: "Poll history" }).click();
});
}

Expand Down Expand Up @@ -124,7 +124,7 @@ describe("Poll history", () => {
cy.inviteUser(roomId, bot.getUserId());
cy.visit("/#/room/" + roomId);
// wait until Bob joined
cy.contains(".mx_TextualEvent", "BotBob joined the room").should("exist");
cy.findByText("BotBob joined the room").should("exist");
});

// active poll
Expand Down Expand Up @@ -153,19 +153,23 @@ describe("Poll history", () => {
cy.get(".mx_Dialog").within(() => {
// active poll is in active polls list
// open poll detail
cy.contains(pollParams1.title).click();
cy.findByText(pollParams1.title).click();

// vote in the poll
cy.contains("Yes").click();
cy.get('[data-testid="totalVotes"]').should("have.text", "Based on 2 votes");
cy.findByText("Yes").click();
cy.findByTestId("totalVotes").within(() => {
cy.findByText("Based on 2 votes");
});

// navigate back to list
cy.contains("Active polls").click();
cy.get(".mx_PollHistory_header").within(() => {
cy.findByRole("button", { name: "Active polls" }).click();
});

// go to past polls list
cy.contains("Past polls").click();
cy.findByText("Past polls").click();

cy.contains(pollParams2.title).should("exist");
cy.findByText(pollParams2.title).should("exist");
});

// end poll1 while dialog is open
Expand All @@ -175,13 +179,13 @@ describe("Poll history", () => {

cy.get(".mx_Dialog").within(() => {
// both ended polls are in past polls list
cy.contains(pollParams2.title).should("exist");
cy.contains(pollParams1.title).should("exist");
cy.findByText(pollParams2.title).should("exist");
cy.findByText(pollParams1.title).should("exist");

cy.contains("Active polls").click();
cy.findByText("Active polls").click();

// no more active polls
cy.contains("There are no active polls in this room").should("exist");
cy.findByText("There are no active polls in this room").should("exist");
});
});
});
4 changes: 2 additions & 2 deletions cypress/e2e/regression-tests/pills-click-in-app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ describe("Pills", () => {
cy.url().should("contain", `/#/room/${messageRoomId}`);

// send a message using the built-in room mention functionality (autocomplete)
cy.get(".mx_SendMessageComposer .mx_BasicMessageComposer_input").type(
cy.findByRole("textbox", { name: "Send a message…" }).type(
`Hello world! Join here: #${targetLocalpart.substring(0, 3)}`,
);
cy.get(".mx_Autocomplete_Completion_title").click();
cy.get(".mx_MessageComposer_sendMessage").click();
cy.findByRole("button", { name: "Send message" }).click();

// find the pill in the timeline and click it
cy.get(".mx_EventTile_body .mx_Pill").click();
Expand Down
27 changes: 14 additions & 13 deletions cypress/e2e/right-panel/file-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const NAME = "Alice";

const viewRoomSummaryByName = (name: string): Chainable<JQuery<HTMLElement>> => {
cy.viewRoomByName(name);
cy.get(".mx_RightPanel_roomSummaryButton").click();
cy.findByRole("tab", { name: "Room info" }).click();
return checkRoomSummaryCard(name);
};

Expand All @@ -38,8 +38,7 @@ const uploadFile = (file: string) => {
cy.get(".mx_MessageComposer_actions input[type='file']").selectFile(file, { force: true });

cy.get(".mx_Dialog").within(() => {
// Click "Upload" button
cy.get("[data-testid='dialog-primary-button']").should("have.text", "Upload").click();
cy.findByRole("button", { name: "Upload" }).click();
});

// Wait until the file is sent
Expand Down Expand Up @@ -106,8 +105,7 @@ describe("FilePanel", () => {
cy.get(".mx_MFileBody_download").should("have.length", 3);

// Assert that the sender of the files is rendered on all of the tiles
cy.get(".mx_EventTile_senderDetails .mx_DisambiguatedProfile_displayName").should("have.length", 3);
cy.contains(".mx_EventTile_senderDetails .mx_DisambiguatedProfile_displayName", NAME);
cy.findAllByText(NAME).should("have.length", 3);

// Detect the image file
cy.get(".mx_EventTile_mediaLine.mx_EventTile_image").within(() => {
Expand All @@ -123,16 +121,17 @@ describe("FilePanel", () => {
// Assert that the audio player is rendered
cy.get(".mx_AudioPlayer_container").within(() => {
// Assert that the play button is rendered
cy.get("[data-testid='play-pause-button']").should("exist");
cy.findByRole("button", { name: "Play" }).should("exist");
});
});

// Detect the JSON file
// Assert that the tile is rendered as a button
cy.get(".mx_EventTile_mediaLine .mx_MFileBody .mx_MFileBody_info[role='button']").within(() => {
// Assert that the file name is rendered inside the button
// File name: matrix-org-client-versions.json
cy.contains(".mx_MFileBody_info_filename", "matrix-org");
// Assert that the file name is rendered inside the button with ellipsis
cy.get(".mx_MFileBody_info_filename").within(() => {
cy.findByText(/matrix.*?\.json/);
});
});
});
});
Expand Down Expand Up @@ -186,7 +185,9 @@ describe("FilePanel", () => {
cy.get(".mx_AudioPlayer_container").within(() => {
// Assert that the audio file information is rendered
cy.get(".mx_AudioPlayer_mediaInfo").within(() => {
cy.get(".mx_AudioPlayer_mediaName").should("have.text", "1sec.ogg");
cy.get(".mx_AudioPlayer_mediaName").within(() => {
cy.findByText("1sec.ogg");
});
cy.contains(".mx_AudioPlayer_byline", "00:01").should("exist");
cy.contains(".mx_AudioPlayer_byline", "(3.56 KB)").should("exist"); // actual size
});
Expand All @@ -195,16 +196,16 @@ describe("FilePanel", () => {
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");

// Click the play button
cy.get("[data-testid='play-pause-button'][aria-label='Play']").click();
cy.findByRole("button", { name: "Play" }).click();

// Assert that the pause button is rendered
cy.get("[data-testid='play-pause-button'][aria-label='Pause']").should("exist");
cy.findByRole("button", { name: "Pause" }).should("exist");

// Assert that the timer is reset when the audio file finished playing
cy.contains(".mx_AudioPlayer_seek [role='timer']", "00:00").should("exist");

// Assert that the play button is rendered
cy.get("[data-testid='play-pause-button'][aria-label='Play']").should("exist");
cy.findByRole("button", { name: "Play" }).should("exist");
});
});
});
Expand Down
53 changes: 32 additions & 21 deletions cypress/e2e/right-panel/right-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ const getMemberTileByName = (name: string): Chainable<JQuery<HTMLElement>> => {
return cy.get(`.mx_EntityTile, [title="${name}"]`);
};

const goBack = (): Chainable<JQuery<HTMLElement>> => {
return cy.get(".mx_BaseCard_back").click();
};

const viewRoomSummaryByName = (name: string): Chainable<JQuery<HTMLElement>> => {
cy.viewRoomByName(name);
cy.get(".mx_RightPanel_roomSummaryButton").click();
Expand Down Expand Up @@ -65,74 +61,89 @@ describe("RightPanel", () => {
it("should handle clicking add widgets", () => {
viewRoomSummaryByName(ROOM_NAME);

cy.get(".mx_RoomSummaryCard_appsGroup .mx_AccessibleButton").click();
cy.findByRole("button", { name: "Add widgets, bridges & bots" }).click();
cy.get(".mx_IntegrationManager").should("have.length", 1);
});

it("should handle viewing export chat", () => {
viewRoomSummaryByName(ROOM_NAME);

cy.get(".mx_RoomSummaryCard_icon_export").click();
cy.findByRole("button", { name: "Export chat" }).click();
cy.get(".mx_ExportDialog").should("have.length", 1);
});

it("should handle viewing share room", () => {
viewRoomSummaryByName(ROOM_NAME);

cy.get(".mx_RoomSummaryCard_icon_share").click();
cy.findByRole("button", { name: "Share room" }).click();
cy.get(".mx_ShareDialog").should("have.length", 1);
});

it("should handle viewing room settings", () => {
viewRoomSummaryByName(ROOM_NAME);

cy.get(".mx_RoomSummaryCard_icon_settings").click();
cy.findByRole("button", { name: "Room settings" }).click();
cy.get(".mx_RoomSettingsDialog").should("have.length", 1);
cy.get(".mx_Dialog_title").should("contain", ROOM_NAME);
cy.get(".mx_Dialog_title").within(() => {
cy.findByText("Room Settings - " + ROOM_NAME).should("exist");
});
});

it("should handle viewing files", () => {
viewRoomSummaryByName(ROOM_NAME);

cy.get(".mx_RoomSummaryCard_icon_files").click();
cy.findByRole("button", { name: "Files" }).click();
cy.get(".mx_FilePanel").should("have.length", 1);
cy.get(".mx_FilePanel_empty").should("have.length", 1);

goBack();
cy.findByRole("button", { name: "Room information" }).click();
checkRoomSummaryCard(ROOM_NAME);
});

it("should handle viewing room member", () => {
viewRoomSummaryByName(ROOM_NAME);

cy.get(".mx_RoomSummaryCard_icon_people").click();
// \d represents the number of the room members inside mx_BaseCard_Button_sublabel
cy.findByRole("button", { name: /People \d/ }).click();
cy.get(".mx_MemberList").should("have.length", 1);

getMemberTileByName(NAME).click();
cy.get(".mx_UserInfo").should("have.length", 1);
cy.get(".mx_UserInfo_profile").should("contain", NAME);
cy.get(".mx_UserInfo_profile").within(() => {
cy.findByText(NAME);
});

goBack();
cy.findByRole("button", { name: "Room members" }).click();
cy.get(".mx_MemberList").should("have.length", 1);

goBack();
cy.findByRole("button", { name: "Room information" }).click();
checkRoomSummaryCard(ROOM_NAME);
});
});

describe("in spaces", () => {
it("should handle viewing space member", () => {
cy.viewSpaceHomeByName(SPACE_NAME);
cy.get(".mx_RoomInfoLine_members").click();

cy.get(".mx_RoomInfoLine_private").within(() => {
// \d represents the number of the space members
cy.findByRole("button", { name: /\d member/ }).click();
});
cy.get(".mx_MemberList").should("have.length", 1);
cy.get(".mx_RightPanel_scopeHeader").should("contain", SPACE_NAME);
cy.get(".mx_RightPanel_scopeHeader").within(() => {
cy.findByText(SPACE_NAME);
});

getMemberTileByName(NAME).click();
cy.get(".mx_UserInfo").should("have.length", 1);
cy.get(".mx_UserInfo_profile").should("contain", NAME);
cy.get(".mx_RightPanel_scopeHeader").should("contain", SPACE_NAME);

goBack();
cy.get(".mx_UserInfo_profile").within(() => {
cy.findByText(NAME);
});
cy.get(".mx_RightPanel_scopeHeader").within(() => {
cy.findByText(SPACE_NAME);
});

cy.findByRole("button", { name: "Back" }).click();
cy.get(".mx_MemberList").should("have.length", 1);
});
});
Expand Down
Loading

0 comments on commit 66d666c

Please sign in to comment.