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

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy committed Jul 18, 2024
1 parent 00e2a69 commit 2e30258
Show file tree
Hide file tree
Showing 16 changed files with 96 additions and 93 deletions.
6 changes: 2 additions & 4 deletions playwright/e2e/integration-manager/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import type { Page } from "@playwright/test";

export async function openIntegrationManager(page: Page) {
await page.getByRole("button", { name: "Room info" }).click();
await page
.locator(".mx_RoomSummaryCard_appsGroup")
.getByRole("button", { name: "Add widgets, bridges & bots" })
.click();
await page.getByRole("tab", { name: "Extensions" }).click();
await page.getByRole("button", { name: "Add extensions" }).click();
}
2 changes: 1 addition & 1 deletion playwright/e2e/polls/pollHistory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ test.describe("Poll history", () => {

async function openPollHistory(page: Page): Promise<void> {
await page.getByRole("button", { name: "Room info" }).click();
await page.locator(".mx_RoomSummaryCard").getByRole("menuitem", { name: "Poll history" }).click();
await page.locator(".mx_RoomSummaryCard").getByRole("menuitem", { name: "Polls" }).click();
}

test.use({
Expand Down
3 changes: 2 additions & 1 deletion playwright/e2e/right-panel/right-panel.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ test.describe("RightPanel", () => {
test("should handle clicking add widgets", async ({ page, app }) => {
await viewRoomSummaryByName(page, app, ROOM_NAME);

await page.getByRole("button", { name: "Add widgets, bridges & bots" }).click();
await page.getByRole("tab", { name: "Extensions" }).click();
await page.getByRole("button", { name: "Add extensions" }).click();
await expect(page.locator(".mx_IntegrationManager")).toBeVisible();
});

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion test/components/views/dialogs/RoomSettingsDialog-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe("<RoomSettingsDialog />", () => {
it("displays poll history when tab clicked", () => {
const { container } = getComponent();

fireEvent.click(screen.getByText("Poll history"));
fireEvent.click(screen.getByText("Polls"));

expect(container.querySelector(".mx_SettingsTab")).toMatchSnapshot();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ NodeList [
class="mx_TabbedView_tabLabel_text"
id="mx_tabpanel_ROOM_POLL_HISTORY_TAB_label"
>
Poll history
Polls
</span>
</li>,
]
Expand All @@ -105,7 +105,7 @@ exports[`<RoomSettingsDialog /> poll history displays poll history when tab clic
<h2
class="mx_Heading_h2 mx_PollHistory_header"
>
Poll history
Polls
</h2>
<div
class="mx_PollHistoryList"
Expand Down
6 changes: 3 additions & 3 deletions test/components/views/polls/pollHistory/PollHistory-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ describe("<PollHistory />", () => {

fireEvent.click(getByText("Question?"));

expect(queryByText("Poll history")).not.toBeInTheDocument();
expect(queryByText("Polls")).not.toBeInTheDocument();
// elements from MPollBody
expect(getByText("Question?")).toMatchSnapshot();
expect(getByText("Socks")).toBeInTheDocument();
Expand Down Expand Up @@ -396,13 +396,13 @@ describe("<PollHistory />", () => {
expect(getByText("Question?")).toBeInTheDocument();

// header not shown
expect(queryByText("Poll history")).not.toBeInTheDocument();
expect(queryByText("Polls")).not.toBeInTheDocument();

expect(getByText("Active polls")).toMatchSnapshot();
fireEvent.click(getByText("Active polls"));

// main list header displayed again
expect(getByText("Poll history")).toBeInTheDocument();
expect(getByText("Polls")).toBeInTheDocument();
// active filter still active
expect(getByTestId("filter-tab-PollHistory_filter-ACTIVE").firstElementChild).toBeChecked();
// list displayed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports[`<PollHistory /> renders a list of active polls when there are polls in
<h2
class="mx_Heading_h2 mx_PollHistory_header"
>
Poll history
Polls
</h2>
<div
class="mx_PollHistoryList"
Expand Down
4 changes: 2 additions & 2 deletions test/components/views/right_panel/RightPanelTabs-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ describe("<RightPanelTabs />", () => {
const { container } = render(<RightPanelTabs phase={RightPanelPhases.RoomMemberList} />);
expect(container).toMatchSnapshot();
// Assert that the active tab is Info
expect(container.querySelectorAll("[aria-selected='true'").length).toEqual(1);
expect(container.querySelector("[aria-selected='true'")).toHaveAccessibleName("People");
expect(container.querySelectorAll("[aria-selected='true']").length).toEqual(1);
expect(container.querySelector("[aria-selected='true']")).toHaveAccessibleName("People");
});

it("Renders nothing for some phases, eg: FilePanel", () => {
Expand Down
6 changes: 3 additions & 3 deletions test/components/views/right_panel/RoomSummaryCard-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,22 +272,22 @@ describe("<RoomSummaryCard />", () => {
mocked(settingsHooks.useFeatureEnabled).mockImplementation((feature) => feature === "feature_pinning");
const { getByText } = getComponent();

expect(getByText("Pinned")).toBeInTheDocument();
expect(getByText("Pinned messages")).toBeInTheDocument();
});
});

describe("poll history", () => {
it("renders poll history option", () => {
const { getByText } = getComponent();

expect(getByText("Poll history")).toBeInTheDocument();
expect(getByText("Polls")).toBeInTheDocument();
});

it("opens poll history dialog on button click", () => {
const permalinkCreator = new RoomPermalinkCreator(room);
const { getByText } = getComponent({ permalinkCreator });

fireEvent.click(getByText("Poll history"));
fireEvent.click(getByText("Polls"));

expect(Modal.createDialog).toHaveBeenCalledWith(PollHistoryDialog, {
room,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ exports[`<RightPanelTabs /> Component renders the correct tabs 1`] = `
Threads
</button>
</li>
<li
class="_nav-tab_135dy_33"
role="presentation"
>
<button
aria-controls="thread-panel"
aria-selected="false"
class="_nav-item_135dy_55"
id="extensions-panel-tab"
role="tab"
>
Extensions
</button>
</li>
</ul>
</nav>
</div>
Expand Down Expand Up @@ -113,6 +127,20 @@ exports[`<RightPanelTabs /> Correct tab is active 1`] = `
Threads
</button>
</li>
<li
class="_nav-tab_135dy_33"
role="presentation"
>
<button
aria-controls="thread-panel"
aria-selected="false"
class="_nav-item_135dy_55"
id="extensions-panel-tab"
role="tab"
>
Extensions
</button>
</li>
</ul>
</nav>
</div>
Expand Down
Loading

0 comments on commit 2e30258

Please sign in to comment.