JS Streamer and Frontend Tests#266
Conversation
… some callbacks etc.
Extras/FrontendTests/tests/extras.ts
Outdated
| // sets up the streamer page to capture data channel messages | ||
| export function setupEventCapture(streamerPage: Page) { | ||
| return streamerPage.evaluate(() => { | ||
| window.data_messages = {}; |
There was a problem hiding this comment.
Maybe small comment here about attaching this js object and the listener to populate it to the window as (I imagine) this is the most convenient place that is visible to both caller and callee.
| } | ||
| } | ||
|
|
||
| public normalizeQuantizeSigned(x: number, y: number): Coord { |
There was a problem hiding this comment.
Could be potential to move somethings into common here and have both frontend and extra use it?
There was a problem hiding this comment.
Yeah I was thinking the same thing as I was doing this. I feel like the input stuff on frontend could be cleaned up a lot.
| await page.getByText('Click to start').click(); | ||
| await helpers.waitForVideo(page); | ||
|
|
||
| const player_box = await page.locator('#videoElementParent').boundingBox(); |
There was a problem hiding this comment.
Any particular reason for underscored_variables - seems a departure from the rest of the codebase?
There was a problem hiding this comment.
It was picked up from somewhere. Maybe when I started doing playwright tests, and was trying to be consistent and it became a habit when moving into this code base.
The joys of trying to be consistent with everyone.
| // check we got the expected events | ||
| const first_player_id = Object.keys(events)[0]; | ||
| const single_player_events = events[first_player_id]; | ||
| expect(single_player_events).toContainActions(expected_actions); |
JS Streamer in Extras/JSStreamer
Frontend tests in Extras/FrontendTests