mirror of
https://github.com/penpot/penpot.git
synced 2025-05-10 03:26:38 +02:00
♻️ Refactor tests and pages
This commit is contained in:
parent
572c6f02e2
commit
0091ac0f5f
24 changed files with 201 additions and 254 deletions
32
frontend/playwright/ui/pages/BaseWebSocketPage.js
Normal file
32
frontend/playwright/ui/pages/BaseWebSocketPage.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
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 setupWebSockets(page) {
|
||||
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");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue