Playwright tests for RoomStatusBar (#31579)
* Add a timeout for toast checks * Add tests for room status bar * Fix MAU toast never appearing. * Also cover local room create fails. * fix await * docstring * Enwiden * Add a test for the changes
This commit is contained in:
@@ -17,6 +17,8 @@ import {
|
||||
PushRuleKind,
|
||||
ProfileKeyTimezone,
|
||||
ProfileKeyMSC4175Timezone,
|
||||
SyncState,
|
||||
MatrixError,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
import { MediaHandler } from "matrix-js-sdk/src/webrtc/mediaHandler";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
@@ -35,6 +37,7 @@ import { SettingLevel } from "../../../../src/settings/SettingLevel";
|
||||
import { Action } from "../../../../src/dispatcher/actions";
|
||||
import Modal from "../../../../src/Modal";
|
||||
import { SETTINGS } from "../../../../src/settings/Settings";
|
||||
import ToastStore from "../../../../src/stores/ToastStore";
|
||||
|
||||
// Create a mock resizer instance that can be shared across tests
|
||||
const mockResizerInstance = {
|
||||
@@ -505,6 +508,29 @@ describe("<LoggedInView />", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("resource limit exceeded errors", () => {
|
||||
it("pops a toast when M_RESOURCE_LIMIT_EXCEEDED is seen down sync", async () => {
|
||||
const addOrReplaceToast = jest.spyOn(ToastStore.sharedInstance(), "addOrReplaceToast");
|
||||
const dismissToast = jest.spyOn(ToastStore.sharedInstance(), "dismissToast");
|
||||
getComponent();
|
||||
mockClient.emit(ClientEvent.Sync, SyncState.Error, null, {
|
||||
error: new MatrixError({
|
||||
errcode: "M_RESOURCE_LIMIT_EXCEEDED",
|
||||
limit_type: "hs_disabled",
|
||||
admin_contact: "admin@example.org",
|
||||
}),
|
||||
});
|
||||
expect(addOrReplaceToast).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
key: "serverlimit",
|
||||
title: "Warning",
|
||||
}),
|
||||
);
|
||||
mockClient.emit(ClientEvent.Sync, SyncState.Prepared, null, undefined);
|
||||
expect(dismissToast).toHaveBeenCalledWith("serverlimit");
|
||||
});
|
||||
});
|
||||
|
||||
describe("resizer preferences", () => {
|
||||
let mockResize: jest.Mock;
|
||||
let mockForHandleWithId: jest.Mock;
|
||||
|
||||
Reference in New Issue
Block a user