Skip to content

Commit

Permalink
remove realtime test start button
Browse files Browse the repository at this point in the history
  • Loading branch information
terryzfeng committed Jun 19, 2024
1 parent b87790a commit dc5a278
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 34 deletions.
57 changes: 35 additions & 22 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ export default defineConfig({

/* Configure projects for major browsers */
projects: [
// {
// name: 'chromium',
// use: {
// ...devices['Desktop Chrome'],
// launchOptions: {
// ignoreDefaultArgs: ['--mute-audio'],
// args: ['--autoplay-policy=no-user-gesture-required']
// },
// }
// },

{
name: 'chromium',
use: {
Expand Down Expand Up @@ -68,28 +79,30 @@ export default defineConfig({
// name: 'Microsoft Edge',
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
{
name: 'Google Chrome',
use: {
...devices['Desktop Chrome'],
channel: 'chrome',
launchOptions: {
ignoreDefaultArgs: ['--mute-audio'],
args: ['--autoplay-policy=no-user-gesture-required']
},
},
},
{
name: 'Google Chrome Canary',
use: {
...devices['Desktop Chrome'],
channel: 'chrome-canary',
launchOptions: {
ignoreDefaultArgs: ['--mute-audio'],
args: ['--autoplay-policy=no-user-gesture-required']
},
},
}

// // Chrome
// {
// name: 'Google Chrome',
// use: {
// ...devices['Desktop Chrome'],
// channel: 'chrome',
// launchOptions: {
// ignoreDefaultArgs: ['--mute-audio'],
// args: ['--autoplay-policy=no-user-gesture-required']
// },
// },
// },
// {
// name: 'Google Chrome Canary',
// use: {
// ...devices['Desktop Chrome'],
// channel: 'chrome-canary',
// launchOptions: {
// ignoreDefaultArgs: ['--mute-audio'],
// args: ['--autoplay-policy=no-user-gesture-required']
// },
// },
// }
],

/* Run your local dev server before starting the tests */
Expand Down
19 changes: 8 additions & 11 deletions src/tests/playwright/pages/realtime-sine.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<body>
<h1>Realtime Sine Test</h1>
<p>Play 440Hz sine wave for 1 second, 880Hz for 1 second, then stop</p>
<button id="start">Run</button>

<script>
const audioContext = new AudioContext();
Expand All @@ -18,17 +17,15 @@ <h1>Realtime Sine Test</h1>
osc.connect(audioContext.destination);

let updateFrequencyPromise;
document.getElementById('start').addEventListener('click', () => {
osc.start();
osc.start();

// Update frequency after 1 second
updateFrequencyPromise = new Promise((resolve, reject) => {
setTimeout(() => {
osc.frequency.value = 880;
osc.stop(audioContext.currentTime + 1);
resolve();
}, 1000);
});
// Update frequency after 1 second
updateFrequencyPromise = new Promise((resolve, reject) => {
setTimeout(() => {
osc.frequency.value = 880;
osc.stop(audioContext.currentTime + 1);
resolve();
}, 1000);
});
</script>
</body>
Expand Down
1 change: 0 additions & 1 deletion src/tests/playwright/runner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { test, expect } from '@playwright/test';

test('Hello Sine (realtime)', async ({ page }) => {
await page.goto('pages/realtime-sine.html');
await page.click('#start');

const osc = await page.evaluateHandle(object => osc);

Expand Down

0 comments on commit dc5a278

Please sign in to comment.