-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,5 @@ node_modules | |
dist | ||
docs-dist | ||
*.local | ||
coverage/ | ||
coverage/ | ||
screenshot.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { afterAll, beforeAll, describe, test } from 'vitest'; | ||
import { PreviewServer, preview } from 'vite'; | ||
import { Browser, Page, chromium } from 'playwright'; | ||
import { expect } from '@playwright/test'; | ||
|
||
describe('react-select-media-devices-modal', async () => { | ||
let server: PreviewServer; | ||
let browser: Browser; | ||
let page: Page; | ||
|
||
beforeAll(async () => { | ||
server = await preview({ preview: { port: 3000 }, root: 'example' }); | ||
browser = await chromium.launch({ | ||
headless: process.env.CI === 'true', | ||
args: ['--use-fake-ui-for-media-stream'], | ||
}); | ||
page = await browser.newPage(); | ||
}); | ||
|
||
afterAll(async () => { | ||
await browser.close(); | ||
await new Promise<void>((resolve, reject) => { | ||
server.httpServer.close((err) => (err ? reject(err) : resolve())); | ||
}); | ||
}); | ||
|
||
test('should open modal and select devices', async () => { | ||
await page.goto('http://localhost:3000'); | ||
const selectDeviceButton = page.getByText('Select Device'); | ||
await expect(selectDeviceButton).toBeVisible(); | ||
|
||
await selectDeviceButton.click(); | ||
|
||
await expect(page.getByText('Audio input device')).toBeVisible(); | ||
|
||
await new Promise((r) => setTimeout(r, 3000)); | ||
|
||
await page.screenshot({ path: 'screenshot.png', fullPage: true }); | ||
|
||
// const selectMediaDevicesModal = await page.$('[class*=modal'); | ||
}, 60_000); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
import react from '@vitejs/plugin-react'; | ||
|
||
export default defineConfig({ | ||
plugins: [react()], | ||
test: { | ||
include: ['**/e2e/*.test.ts'], | ||
globals: true, | ||
testTimeout: 60_000, | ||
hookTimeout: 60_000, | ||
}, | ||
}); |