fix: lobby detection for 'when the meeting starts' variant

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ValueOn AG 2026-02-16 10:44:40 +01:00
parent 730214d30b
commit 857299dcac

View file

@ -317,33 +317,47 @@ export class JoinProcedure {
/** /**
* Check if the bot is currently in the lobby (waiting to be admitted). * Check if the bot is currently in the lobby (waiting to be admitted).
* Primary check: text "Someone will let you in shortly" (confirmed by Recall.ai). * Teams shows various lobby messages depending on the meeting state:
* - "Someone will let you in shortly" (meeting active, waiting for admit)
* - "Someone will let you in when the meeting starts" (meeting not started yet)
* - "waiting for someone to let you in" (alternative wording)
*/ */
async isInMeetingLobby(options: { waitForSeconds?: number } = {}): Promise<boolean> { async isInMeetingLobby(options: { waitForSeconds?: number } = {}): Promise<boolean> {
const timeout = (options.waitForSeconds || 5) * 1000; const timeout = (options.waitForSeconds || 5) * 1000;
// Check for any lobby text variant using page.evaluate for reliability
try { try {
// Primary: text-based check (Recall.ai approach, most reliable) const inLobby = await this._page.evaluate(() => {
await this._page.getByText('Someone will let you in shortly').waitFor({ const bodyText = document.body?.innerText || '';
const lobbyIndicators = [
'Someone will let you in shortly',
'Someone will let you in when the meeting starts',
'will let you in',
'waiting for someone to let you in',
'Someone in the meeting should let you in',
];
return lobbyIndicators.some(text => bodyText.includes(text));
});
if (inLobby) return true;
} catch {
// Page may not be ready
}
// Primary: text-based check with waitFor (waits up to timeout)
try {
await this._page.getByText('will let you in').waitFor({
timeout, timeout,
state: 'visible', state: 'visible',
}); });
return true; return true;
} catch { } catch {
// Fallback: try other lobby indicators // Not found within timeout
} }
// Fallback selectors // Fallback: data-tid selectors
const fallbackSelectors = [
':has-text("waiting for someone to let you in")',
':has-text("Someone in the meeting should let you in soon")',
'[data-tid="lobby-screen"]',
'[data-tid="waiting-screen"]',
];
try { try {
await this._page.waitForSelector(fallbackSelectors.join(', '), { await this._page.waitForSelector('[data-tid="lobby-screen"], [data-tid="waiting-screen"]', {
timeout: 1000, // Short timeout since primary already waited timeout: 1000,
state: 'visible', state: 'visible',
}); });
return true; return true;