Skip to content

Commit ade5bf2

Browse files
committed
add back webkit to e2e
1 parent 2bf43a2 commit ade5bf2

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

tests/demo-react.spec.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {
22
chromium as bChromium,
33
firefox as bFirefox,
44
Locator,
5-
// webkit as bWebkit,
5+
webkit as bWebkit,
66
} from "playwright";
77
import { Browser, expect, type Page, test } from "@playwright/test";
88

@@ -48,12 +48,16 @@ async function waitForStableVideo(
4848
expect(await video.evaluate((v: HTMLVideoElement) => v.ended)).toBe(
4949
false,
5050
);
51-
expect(await video.evaluate((v: HTMLVideoElement) => v.readyState)).toBe(
52-
4,
53-
);
51+
expect(await video.evaluate((v: HTMLVideoElement) => v.readyState))
52+
.toBeGreaterThanOrEqual(
53+
3,
54+
);
5455
await page.waitForTimeout(delayMs).catch(() => { });
5556
return;
56-
} catch (_e) {
57+
} catch (err) {
58+
console.warn("waitForStableVideo is not stable, will try again in 1s.", {
59+
err,
60+
});
5761
await page.waitForTimeout(1000).catch(() => { });
5862
}
5963
}
@@ -100,22 +104,18 @@ test(`load`, async ({ browser, browserName, baseURL }) => {
100104
});
101105

102106
test.describe("Connect", () => {
103-
const browserNames = ["chromium", "firefox"];
104-
const browsers: Record<string, Browser> = {};
105-
const pairs: [string, string][] = getAllPairs(browserNames);
107+
const browsers: Record<string, Browser | undefined> = {
108+
"chromium": undefined,
109+
"webkit": undefined,
110+
};
111+
const pairs: [string, string][] = getAllPairs(Object.keys(browsers));
106112

107113
test.beforeAll(async () => {
108-
const [chromium, firefox] = await Promise.all([
109-
bChromium.launch({}),
110-
bFirefox.launch(),
111-
// webkit still doesn't allow fake webcam
112-
// https://github.com/microsoft/playwright/issues/2973
113-
// bWebkit.launch(),
114-
]);
115-
116-
browsers["chromium"] = chromium;
117-
browsers["firefox"] = firefox;
118-
// browsers["webkit"] = webkit;
114+
browsers["chromium"] = await bChromium.launch({});
115+
// browsers["firefox"] = await bFirefox.launch();
116+
// webkit still doesn't allow fake webcam
117+
// https://github.com/microsoft/playwright/issues/2973
118+
browsers["webkit"] = await bWebkit.launch();
119119
});
120120

121121
// basic connection test a->b
@@ -127,12 +127,12 @@ test.describe("Connect", () => {
127127
const peerB = `__${bB}_B`;
128128

129129
// Launch browserA for pageA
130-
const contextA = await browsers[bA].newContext();
130+
const contextA = await browsers[bA]!.newContext();
131131
const pageA = await contextA.newPage();
132132
await pageA.goto(url);
133133

134134
// Launch browserB for pageB
135-
const contextB = await browsers[bB].newContext();
135+
const contextB = await browsers[bB]!.newContext();
136136
const pageB = await contextB.newPage();
137137
await pageB.goto(url);
138138

@@ -160,11 +160,11 @@ test.describe("Connect", () => {
160160
const peerA = `__${bA}_A`;
161161
const peerB = `__${bB}_B`;
162162

163-
const contextA = await browsers[bA].newContext();
163+
const contextA = await browsers[bA]!.newContext();
164164
const pageA = await contextA.newPage();
165165
await pageA.goto(url);
166166

167-
const contextB = await browsers[bB].newContext();
167+
const contextB = await browsers[bB]!.newContext();
168168
const pageB = await contextB.newPage();
169169
await pageB.goto(url);
170170

0 commit comments

Comments
 (0)