Migrate read-receipts.spec.ts from Cypress to Playwright (#11995)

* Migrate read-receipts.spec.ts from Cypress to Playwright

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update client.ts

* Serialise test message sending

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2023-12-05 13:24:10 +00:00 committed by GitHub
parent 447d2ce415
commit 99b580d501
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 359 additions and 374 deletions

View file

@ -17,7 +17,15 @@ limitations under the License.
import { JSHandle, Page } from "@playwright/test";
import { PageFunctionOn } from "playwright-core/types/structs";
import type { IContent, ICreateRoomOpts, ISendEventResponse, MatrixClient, Room } from "matrix-js-sdk/src/matrix";
import type {
IContent,
ICreateRoomOpts,
ISendEventResponse,
MatrixClient,
Room,
MatrixEvent,
ReceiptType,
} from "matrix-js-sdk/src/matrix";
export class Client {
protected client: JSHandle<MatrixClient>;
@ -196,4 +204,23 @@ export class Client {
userId,
});
}
/**
* @param {MatrixEvent} event
* @param {ReceiptType} receiptType
* @param {boolean} unthreaded
*/
public async sendReadReceipt(
event: JSHandle<MatrixEvent>,
receiptType?: ReceiptType,
unthreaded?: boolean,
): Promise<{}> {
const client = await this.prepareClient();
return client.evaluate(
(client, { event, receiptType, unthreaded }) => {
return client.sendReadReceipt(event, receiptType, unthreaded);
},
{ event, receiptType, unthreaded },
);
}
}