1
0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-05-30 17:26:46 +02:00

♻️ Refactor tests and pages

This commit is contained in:
AzazelN28 2024-05-07 13:12:58 +02:00
parent 572c6f02e2
commit 0091ac0f5f
24 changed files with 201 additions and 254 deletions
frontend/playwright/scripts

View file

@ -39,7 +39,6 @@ window.WebSocket = class MockWebSocket extends EventTarget {
#spyClose = null;
constructor(url, protocols) {
console.log("🤖 New websocket at", url);
super();
this.#url = url;
@ -166,7 +165,6 @@ window.WebSocket = class MockWebSocket extends EventTarget {
}
mockOpen(options) {
console.log("🤖 open mock");
this.#protocol = options?.protocol || "";
this.#extensions = options?.extensions || "";
this.#readyState = MockWebSocket.OPEN;
@ -181,12 +179,9 @@ window.WebSocket = class MockWebSocket extends EventTarget {
}
mockMessage(data) {
console.log("🤯 mock message");
if (this.#readyState !== MockWebSocket.OPEN) {
console.log("socket is not connected");
throw new Error("MockWebSocket is not connected");
}
console.log("😰 dispatching `message`", { data });
this.dispatchEvent(new MessageEvent("message", { data }));
return this;
}