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
|
|
|
|
*/
|
2024-05-08 14:22:18 +02:00
|
|
|
static initWebSockets(page) {
|
2024-05-07 13:12:58 +02:00
|
|
|
return MockWebSocketHelper.init(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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() {
|
|
|
|
return this.waitForWebSocket("ws://0.0.0.0:3500/ws/notifications");
|
|
|
|
}
|
|
|
|
}
|