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:
parent
447d2ce415
commit
99b580d501
4 changed files with 359 additions and 374 deletions
|
@ -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 },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue