0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 22:22:43 -05:00
penpot/frontend/playwright/ui/pages/BaseWebSocketPage.js

33 lines
789 B
JavaScript
Raw Normal View History

2024-05-07 13:12:58 +02:00
import { MockWebSocketHelper } from "../../helpers/MockWebSocketHelper";
import BasePage from "./BasePage";
export class BaseWebSocketPage extends BasePage {
/**
* This should be called on `test.beforeEach`.
*
* @param {Page} page
* @returns
*/
static async initWebSockets(page) {
await MockWebSocketHelper.init(page);
2024-05-07 13:12:58 +02:00
}
/**
* Returns a promise that resolves when a WebSocket with the given URL is created.
*
* @param {string} url
* @returns {Promise<MockWebSocketHelper>}
*/
async waitForWebSocket(url) {
return MockWebSocketHelper.waitForURL(url);
}
/**
*
* @returns {Promise<MockWebSocketHelper>}
*/
async waitForNotificationsWebSocket() {
2024-05-09 13:17:12 +02:00
return this.waitForWebSocket("ws://localhost:3000/ws/notifications");
2024-05-07 13:12:58 +02:00
}
}