Skip to content

Commit

Permalink
Adjust configuration & tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arnautov-anton committed Sep 12, 2023
1 parent 2bab26e commit c7f3251
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 3 deletions.
3 changes: 3 additions & 0 deletions sample-apps/react/egress-composite/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 53 additions & 3 deletions sample-apps/react/egress-composite/tests/layouts.spec.ts
Original file line number Diff line number Diff line change
@@ -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();

Expand All @@ -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<StreamVideoParticipant>[] = [
{
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 }) => {
Expand All @@ -44,6 +91,9 @@ test.describe('Layouts', () => {
window.setupLayout({
call_id: "${callId}",
layout: "${layout.name}",
test_environment: ${JSON.stringify({
participants,
} satisfies ConfigurationValue['test_environment'])}
});
`,
});
Expand Down

0 comments on commit c7f3251

Please sign in to comment.