From 857299dcac3196008876530466eb00e9bcdc9594 Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Mon, 16 Feb 2026 10:44:40 +0100
Subject: [PATCH] fix: lobby detection for 'when the meeting starts' variant
Co-authored-by: Cursor
---
src/bot/joinProcedure.ts | 42 ++++++++++++++++++++++++++--------------
1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/src/bot/joinProcedure.ts b/src/bot/joinProcedure.ts
index 5d59a7d..062ea38 100644
--- a/src/bot/joinProcedure.ts
+++ b/src/bot/joinProcedure.ts
@@ -317,33 +317,47 @@ export class JoinProcedure {
/**
* 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 {
const timeout = (options.waitForSeconds || 5) * 1000;
+ // Check for any lobby text variant using page.evaluate for reliability
try {
- // Primary: text-based check (Recall.ai approach, most reliable)
- await this._page.getByText('Someone will let you in shortly').waitFor({
+ const inLobby = await this._page.evaluate(() => {
+ 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,
state: 'visible',
});
return true;
} catch {
- // Fallback: try other lobby indicators
+ // Not found within timeout
}
- // Fallback 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"]',
- ];
-
+ // Fallback: data-tid selectors
try {
- await this._page.waitForSelector(fallbackSelectors.join(', '), {
- timeout: 1000, // Short timeout since primary already waited
+ await this._page.waitForSelector('[data-tid="lobby-screen"], [data-tid="waiting-screen"]', {
+ timeout: 1000,
state: 'visible',
});
return true;