Skip to content

Commit 5b6f9ed

Browse files
committed
test: refactor reveal toolbar fn
1 parent 78c6d3c commit 5b6f9ed

1 file changed

Lines changed: 30 additions & 28 deletions

File tree

e2e/page-objects/ToolbarControls.ts

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -39,56 +39,50 @@ export class ToolbarControls {
3939

4040
async toggleMicrophone() {
4141
await this.dismissBlockingToasts();
42-
await this.waitForToolbarVisible();
43-
await this.micButton.waitFor({ state: "visible", timeout: 5000 });
44-
await this.micButton.click();
42+
await this.revealToolbar();
43+
await this.micButton.click({ force: true });
4544
await this.page.waitForTimeout(250);
4645
}
4746

4847
async toggleCamera() {
4948
await this.dismissBlockingToasts();
50-
await this.waitForToolbarVisible();
51-
await this.cameraButton.waitFor({ state: "visible", timeout: 5000 });
52-
await this.cameraButton.click();
49+
await this.revealToolbar();
50+
await this.cameraButton.click({ force: true });
5351
await this.page.waitForTimeout(300);
5452
}
5553

5654
async toggleScreenShare() {
5755
await this.dismissBlockingToasts();
58-
await this.waitForToolbarVisible();
59-
await this.screenShareButton.waitFor({ state: "visible", timeout: 5000 });
60-
await this.screenShareButton.click();
56+
await this.revealToolbar();
57+
await this.screenShareButton.click({ force: true });
6158
await this.page.waitForTimeout(300);
6259
}
6360

6461
async openChat() {
6562
await this.dismissBlockingToasts();
66-
await this.waitForToolbarVisible();
67-
await this.chatButton.waitFor({ state: "visible", timeout: 5000 });
68-
await this.chatButton.click();
63+
await this.revealToolbar();
64+
await this.chatButton.click({ force: true });
6965
await this.page.waitForTimeout(150);
7066
}
7167

7268
async openPeople() {
7369
await this.dismissBlockingToasts();
74-
await this.waitForToolbarVisible();
75-
await this.peopleButton.waitFor({ state: "visible", timeout: 5000 });
76-
await this.peopleButton.click();
70+
await this.revealToolbar();
71+
await this.peopleButton.click({ force: true });
7772
await this.page.waitForTimeout(150);
7873
}
7974

8075
async raiseHand() {
8176
await this.dismissBlockingToasts();
82-
await this.waitForToolbarVisible();
83-
await this.raiseHandButton.waitFor({ state: "visible", timeout: 5000 });
84-
await this.raiseHandButton.click();
77+
await this.revealToolbar();
78+
await this.raiseHandButton.click({ force: true });
8579
await this.page.waitForTimeout(150);
8680
}
8781

8882
async endCall() {
8983
await this.dismissBlockingToasts();
90-
await this.waitForToolbarVisible();
91-
await this.endCallButton.click();
84+
await this.revealToolbar();
85+
await this.endCallButton.click({ force: true });
9286
await expect(this.page.locator("[data-meeting-component]")).not.toBeVisible(
9387
{ timeout: 10000 },
9488
);
@@ -112,16 +106,24 @@ export class ToolbarControls {
112106
return html.includes("lucide-video-off");
113107
}
114108

115-
async waitForToolbarVisible() {
116-
// Move mouse to keep controls alive (prevent auto-hide)
109+
async revealToolbar() {
117110
const viewport = this.page.viewportSize();
118-
if (viewport) {
119-
await this.page.mouse.move(viewport.width / 2, viewport.height * 0.8);
120-
}
111+
if (!viewport) return;
121112

122-
// Ensure toolbar and primary controls are visible
123-
await this.dismissBlockingToasts();
124-
await expect(this.cameraButton).toBeVisible({ timeout: 5000 });
113+
// Move mouse to bottom center to trigger activity and reveal toolbar
114+
await this.page.mouse.move(viewport.width / 2, viewport.height - 50);
115+
116+
// Wait for toolbar to appear
117+
await this.cameraButton.waitFor({ state: "attached", timeout: 5000 });
118+
119+
// Hover directly over the toolbar to keep it visible (triggers onMouseEnter)
120+
const toolbarBox = await this.toolbar.boundingBox();
121+
if (toolbarBox) {
122+
await this.page.mouse.move(
123+
toolbarBox.x + toolbarBox.width / 2,
124+
toolbarBox.y + toolbarBox.height / 2,
125+
);
126+
}
125127
}
126128

127129
async dismissBlockingToasts() {

0 commit comments

Comments
 (0)