mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
refactor waitForPlaywrightConsole helper
This commit is contained in:
@@ -490,7 +490,13 @@ export async function runMeteorTests(tempDir, port, options = {}) {
|
||||
return { meteorProcess, outputLines };
|
||||
}
|
||||
|
||||
export async function waitForPlaywrightConsole(page, pattern, options = {}) {
|
||||
/**
|
||||
* Helper function to wait for a console message matching a pattern
|
||||
* @param {string|RegExp} pattern
|
||||
* @param {Object} options - Additional options
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
export async function waitForPlaywrightConsole(pattern, options = {}) {
|
||||
const timeout = options.timeout || 30000; // Default 30 seconds timeout
|
||||
const checkInterval = options.checkInterval || 100; // Check every 100ms by default
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ describe('React App Bundling /', () => {
|
||||
await appendFileContent(tempDir, 'client/main.jsx', {
|
||||
content: 'if (Meteor.isDevelopment) console.log("Hello from dev client");',
|
||||
});
|
||||
await waitForPlaywrightConsole(page, 'Hello from dev client');
|
||||
await waitForPlaywrightConsole('Hello from dev client');
|
||||
|
||||
// Update the server code
|
||||
await appendFileContent(tempDir, 'server/main.js', {
|
||||
@@ -224,7 +224,7 @@ describe('React App Bundling /', () => {
|
||||
await appendFileContent(tempDir, 'client/main.jsx', {
|
||||
content: 'if (Meteor.isProduction) console.log("Hello from prod client");',
|
||||
});
|
||||
await waitForPlaywrightConsole(page, 'Hello from prod client');
|
||||
await waitForPlaywrightConsole('Hello from prod client');
|
||||
|
||||
// Update the server code
|
||||
await appendFileContent(tempDir, 'server/main.js', {
|
||||
|
||||
Reference in New Issue
Block a user