✅(y-webrtc-signaling) test signaling server
Create a e2e testcase to test the signaling server.
This commit is contained in:
@@ -17,4 +17,29 @@ test.describe('Pad Editor', () => {
|
||||
await page.locator('.ProseMirror.bn-editor').fill('Hello World');
|
||||
await expect(page.getByText('Hello World')).toBeVisible();
|
||||
});
|
||||
|
||||
test('checks the Pad is connected to the webrtc server', async ({ page }) => {
|
||||
const webSocketPromise = page.waitForEvent('websocket', (webSocket) => {
|
||||
return webSocket.url().includes('ws://localhost:4444/');
|
||||
});
|
||||
|
||||
await page.getByText('My mocked pad').first().click();
|
||||
await expect(page.locator('h2').getByText('My mocked pad')).toBeVisible();
|
||||
|
||||
const webSocket = await webSocketPromise;
|
||||
expect(webSocket.url()).toBe('ws://localhost:4444/');
|
||||
|
||||
const framesentPromise = webSocket.waitForEvent('framesent');
|
||||
|
||||
await page.locator('.ProseMirror.bn-editor').click();
|
||||
await page.locator('.ProseMirror.bn-editor').fill('Hello World');
|
||||
|
||||
const framesent = await framesentPromise;
|
||||
const payload = JSON.parse(framesent.payload as string) as {
|
||||
type: string;
|
||||
};
|
||||
|
||||
const typeCases = ['publish', 'subscribe', 'unsubscribe', 'ping'];
|
||||
expect(typeCases.includes(payload.type)).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user