Skip to content

Conversation

@dahomita
Copy link
Collaborator

@dahomita dahomita commented Jan 2, 2026

Description

Screenshots

Test

Checklist

If you're making changes to the extension, please run through the following checklist to make sure that we don't have
any regressions. Note that we plan to add integration tests in the future!

  • Create room and join room on at least 2 browsers
  • Ensure that code and tests are correctly stream
  • Verify that when reloading, user can automatically join the room

Possible Downsides

Additional Documentations

@nickbar01234
Copy link
Owner

microsoft/playwright#38670

Looks like LNA is a feature flag introduced in Chrome 138, requiring the user to grant permission when making a request to a "local network". Not sure via Playwright would look like, but have you considered

  • Moving the request destination to a public domain (not sure how this would look like either), which I'm assuming comes from Firebase
  • Temporarily disabling LNA feature flag Disable LNA #590

- name: Install Playwright browsers
run: pnpm exec playwright install --with-deps

- name: Start Firebase emulator
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool that this just works

throw new Error(`Invalid path ${extension}`);
}

async function createExtensionContext(): Promise<BrowserContext> {
Copy link
Owner

@nickbar01234 nickbar01234 Jan 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extract to tests/utils.ts?

await page.getByRole("button", { name: "Create" }).click();
await page.getByRole("img", { name: "Copy room ID" }).click();

const roomId = await page.evaluate(async () => {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think can be just as simple as const id = await page.evaluate(navigator.clipboard.readText);?

Comment on lines 17 to 19
if (!roomId) {
throw new Error("Failed to extract room ID after creating room. ");
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clipboard returns string so this check is probably redundant (unless typescript def is wrong)

return serviceWorker.url().split("/")[2];
}

export const test = base.extend<{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want this to be a "factory" to create default fixture (unauthenticated) right?

import type { Page } from "@playwright/test";

export async function signIn(page: Page, email: string): Promise<void> {
await page.goto("https://leetcode.com/problems/two-sum", {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be wrong but since twoRoomTest extends from default fixture, this would be redudnant? https://github.com/nickbar01234/codebuddy/pull/588/changes#diff-48e511c5cb8dc56e989baa2ae1c74d1104a3057420c888bac6a22ed4ff106ca4R57

await use(room);
},
user2: async ({ room }, use) => {
const user2Context = await createExtensionContext();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A "factory" would make sense here

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 99 to 102
room: async ({ user1 }, use) => {
const room = await createRoom(user1.page);
await use(room);
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there no way for user1 to both createRoom and expose room information for user2?

@@ -0,0 +1,21 @@
import { expect, twoUserRoomTest } from "../fixture";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably just move this into content.spec.ts. I don't see a compelling reason to have them separate yet

};`;

twoUserRoomTest("User1 can copy code from User2", async ({ user1, user2 }) => {
await user1.page.getByRole("tab", { name: /Code/i }).click();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice and clean test!


await use({ instantiate });

await Promise.all(contexts.map((ctx) => ctx.close()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For my understanding, why is contexts a list?

import { test as base, BrowserContext, chromium, Page } from "@playwright/test";
import { signIn } from "@tests/utils/auth";
import { getExtensionId, getExtensionPath, setupPage } from "../utils/page";
export interface UserPage {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Add space above

@@ -0,0 +1,48 @@
import { test as base, BrowserContext, chromium, Page } from "@playwright/test";
import { signIn } from "@tests/utils/auth";
import { getExtensionId, getExtensionPath, setupPage } from "../utils/page";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Use path alias

},
});

export const expect = test.expect;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can just delete this file right?

Copy link
Owner

@nickbar01234 nickbar01234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With nits

@nickbar01234 nickbar01234 mentioned this pull request Jan 13, 2026
3 tasks
@dahomita dahomita merged commit f25c48e into main Jan 14, 2026
3 checks passed
@dahomita dahomita deleted the tamdang/e2e/multi-users-connection branch January 14, 2026 00:59
dahomita added a commit that referenced this pull request Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants