From c7f3251af016a40dcd0776017c9d14252f029511 Mon Sep 17 00:00:00 2001 From: Anton Arnautov Date: Tue, 12 Sep 2023 17:20:28 +0200 Subject: [PATCH] Adjust configuration & tests --- .../egress-composite/playwright.config.ts | 3 + .../layouts.spec.ts/Layouts-grid-1.png | Bin 10711 -> 11016 bytes .../egress-composite/tests/layouts.spec.ts | 56 +++++++++++++++++- 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/sample-apps/react/egress-composite/playwright.config.ts b/sample-apps/react/egress-composite/playwright.config.ts index d6ef59f434..2c3a8dd7d3 100644 --- a/sample-apps/react/egress-composite/playwright.config.ts +++ b/sample-apps/react/egress-composite/playwright.config.ts @@ -9,12 +9,15 @@ export default defineConfig({ retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: 'list', + // custom path to omit architecture/system from file name (darwin-amd64/darwin-arm64/linux-amd64...) snapshotPathTemplate: './tests/__screenshots__/{testFilePath}/{arg}{ext}', use: { headless: !!process.env.CI, trace: 'on-first-retry', viewport: { width: 1920, height: 1080 }, baseURL: 'http://localhost:5173', + // TODO: find out why custom data-test-id does not work + // testIdAttribute: 'data-testid', }, webServer: [ { diff --git a/sample-apps/react/egress-composite/tests/__screenshots__/layouts.spec.ts/Layouts-grid-1.png b/sample-apps/react/egress-composite/tests/__screenshots__/layouts.spec.ts/Layouts-grid-1.png index ae647c2d7966427bb6ab7517ddf5c9a141bdb74f..757166959f9fa2ed2eea0b02bf6e62d9726557cc 100644 GIT binary patch delta 718 zcmcZ}+z~dx((%qkFX==H*NgTGS(;vGZ?AoD=~7bgl3Du>^eC5&urbDk>zt@2~4S{j}~U|Ge9!v-v-)yIIrlH=^`2;|*O#iH6Gg^Xq>ay*r+|=fPnP zhTFe>HGRKP)4(>He}laK%^HTXlh-XK7c#llCtUhjv-vA0!a?Ex+ko$n3;s0~-$p_W+ zH2!2i?<WS0f&~8V@j9I0oSISzk9A%rTUtly{gTe~DWM4f DTx~V# delta 242 zcmeAOyB<8j(&)A!-(dw2R>zK-|Jsw41C9utt6H|S^6B)jGls{c7$D%!-t#XRq3k=( zn*$kTSfn0V*)lY=M=WP&V7QZ$ckiw}gTvW({}>;L{@FZHY$@kv1*R@Gff>m?rBy6Y zo%=sCPgZ1fHePp`nW3Viw2Fb@z}aWd?*3(Fxbo(mJVV?;{)C47-(@+>3_OPobpHN- z@vMW7mE{xD`zFTCiQ-o|fJSmN@h}`{pTxkx+3M-y7_#xA4=ewH cQI$n>Ba1qJ{)?GgcY-85UHx3vIVCg!00hZcYybcN diff --git a/sample-apps/react/egress-composite/tests/layouts.spec.ts b/sample-apps/react/egress-composite/tests/layouts.spec.ts index cf41611eb3..8b0cf0d02f 100644 --- a/sample-apps/react/egress-composite/tests/layouts.spec.ts +++ b/sample-apps/react/egress-composite/tests/layouts.spec.ts @@ -1,11 +1,14 @@ import { test as base, expect } from '@playwright/test'; import { customAlphabet } from 'nanoid'; import axios from 'axios'; +import { StreamVideoParticipant } from '@stream-io/video-react-sdk'; +import { ConfigurationValue } from '../src/ConfigurationContext'; const nanoid = customAlphabet('1234567890abcdefghijklmnop', 10); // TODO: move to some shared folder -const test = base.extend<{ callId: string }>({ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +const buddyTest = base.extend<{ callId: string }>({ callId: async ({ page }, use) => { const callId = nanoid(); @@ -31,11 +34,55 @@ const test = base.extend<{ callId: string }>({ }, }); +const test = base.extend<{ callId: string }>({ + callId: async ({ page }, use) => { + const callId = nanoid(); + + await page.goto('/', { waitUntil: 'domcontentloaded' }); + + // run tests + await use(callId); + }, +}); + +const participants: Partial[] = [ + { + userId: 'john', + sessionId: '1', + publishedTracks: [], + isSpeaking: false, + }, + { + userId: 'jane', + name: 'Jane Strong', + sessionId: '2', + publishedTracks: [], + isSpeaking: false, + }, + { + userId: 'mark', + sessionId: '3', + publishedTracks: [], + isSpeaking: false, + }, + { + userId: 'martin', + sessionId: '4', + publishedTracks: [], + isSpeaking: false, + }, + { + userId: 'anne', + sessionId: '5', + publishedTracks: [], + isSpeaking: false, + }, +]; + test.describe('Layouts', () => { [ - { name: 'grid', participantCountPerWindow: 4 }, + { name: 'grid', participantCountPerWindow: 5 }, { name: 'single_participant', participantCountPerWindow: 1 }, - // egress is not filtered for this one { name: 'spotlight', participantCountPerWindow: 5 }, ].forEach((layout) => { test(`${layout.name}`, async ({ page, callId }) => { @@ -44,6 +91,9 @@ test.describe('Layouts', () => { window.setupLayout({ call_id: "${callId}", layout: "${layout.name}", + test_environment: ${JSON.stringify({ + participants, + } satisfies ConfigurationValue['test_environment'])} }); `, });