Skip to content

Commit bc14491

Browse files
committed
fix: get all popover tests running with polyfill
1 parent 1101233 commit bc14491

18 files changed

+101
-108
lines changed

.changeset/twenty-spoons-fail.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@qwik-ui/headless': patch
3+
---
4+
5+
Chromium 109-113 did not properly support the popover but reported that they did. This led to the polyfill not activating which caused our E2E tests to break. We are dropping down to Chromium 108 to validate the polyfill as users of Chrome would see it before the popover API was supported.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"test.headless": "nx component-test headless --skip-nx-cache",
3434
"test.visual.headless": "nx visual-test headless",
3535
"test.pw.headless": "nx e2e headless",
36-
"test.pw.headless-chrome-113": "nx e2e-chrome-113 headless",
36+
"test.pw.headless-chrome-108": "nx e2e-chrome-108 headless",
3737
"test.pw.headless.ci": "nx e2e headless",
3838
"test.headless.ci": "nx component-test-ci headless",
3939
"test.utils": "nx test utils"

packages/kit-headless/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"types": "./index.d.ts",
1717
"type": "module",
1818
"scripts": {
19-
"setup.chrome.113": "npx tsx ./scripts/prepare-chrome-113.ts"
19+
"setup.chrome.108": "npx tsx ./scripts/prepare-chrome-browser.ts"
2020
},
2121
"exports": {
2222
".": {

packages/kit-headless/playwright.config.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ let binaryPath;
1818
switch (currentPlatform) {
1919
case 'darwin':
2020
binaryPath =
21-
'./browsers/chrome/113/chrome-darwin/Chromium.app/Contents/MacOS/Chromium';
21+
'./browsers/chrome/108/chrome-darwin/Chromium.app/Contents/MacOS/Chromium';
2222
break;
2323
case 'win32':
24-
binaryPath = './browsers/chrome/113/chrome-win32/chrome.exe';
24+
binaryPath = './browsers/chrome/108/chrome-win32/chrome.exe';
2525
break;
2626
case 'linux':
27-
binaryPath = './browsers/chrome/113/chrome-linux/chrome';
27+
binaryPath = './browsers/chrome/108/chrome-linux/chrome';
2828
break;
2929
default:
30-
throw new Error('Cannot install Chrome 13 on unknown platform');
30+
throw new Error('Cannot install Chrome 108 on unknown platform');
3131
}
3232

3333
/**
@@ -65,7 +65,7 @@ export default defineConfig({
6565
},
6666

6767
{
68-
name: 'popover-chrome-113',
68+
name: 'popover-chrome-108',
6969
use: {
7070
launchOptions: {
7171
executablePath: path.resolve(dirName, binaryPath),

packages/kit-headless/project.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,19 +55,19 @@
5555
"project": ["logic"]
5656
}
5757
},
58-
"setup-chrome-113": {
58+
"setup-chrome-108": {
5959
"executor": "nx:run-script",
6060
"options": {
61-
"script": "setup.chrome.113"
61+
"script": "setup.chrome.108"
6262
}
6363
},
64-
"e2e-chrome-113": {
64+
"e2e-chrome-108": {
6565
"executor": "@nx/playwright:playwright",
6666
"outputs": ["{workspaceRoot}/dist/.playwright/packages/kit-headless"],
67-
"dependsOn": ["setup-chrome-113"],
67+
"dependsOn": ["setup-chrome-108"],
6868
"options": {
6969
"config": "packages/kit-headless/playwright.config.ts",
70-
"project": ["popover-chrome-113"]
70+
"project": ["popover-chrome-108"]
7171
}
7272
},
7373
"visual-test": {

packages/kit-headless/scripts/prepare-chrome-113.ts renamed to packages/kit-headless/scripts/prepare-chrome-browser.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ function printProgress(progress: number) {
1212
}
1313

1414
async function prepareChrome113() {
15-
const path = `browsers/chrome/113/chrome-${os.platform()}`;
15+
const path = `browsers/chrome/108/chrome-${os.platform()}`;
1616

1717
if (fs.existsSync(path)) {
18-
console.log('Chrome 113 already exists. Skipping unzip ⏩');
18+
console.log('Chrome 108 already exists. Skipping unzip ⏩');
1919
} else {
2020
console.log('Creating directory to save the browser 🌐');
2121
fs.mkdirSync(path, { recursive: true });
2222

2323
const downloadResponse = await fetch(
24-
`https://github.com/qwikifiers/qwik-ui-polyfill-browsers/raw/main/chrome/113/chrome-${os.platform()}.zip`,
24+
`https://github.com/qwikifiers/qwik-ui-polyfill-browsers/raw/main/chrome/108/chrome-${os.platform()}.zip`,
2525
);
2626

2727
const contentLength = downloadResponse.headers.get('content-length');
@@ -33,7 +33,7 @@ async function prepareChrome113() {
3333
async start(controller) {
3434
if (!downloadResponse.body) {
3535
throw new Error(
36-
'Invalid response received when trying to download Chrome 113',
36+
'Invalid response received when trying to download Chrome 108',
3737
);
3838
}
3939

@@ -53,7 +53,7 @@ async function prepareChrome113() {
5353

5454
await decompress(
5555
Buffer.from(await res.arrayBuffer()),
56-
`browsers/chrome/113/chrome-${os.platform()}`,
56+
`browsers/chrome/108/chrome-${os.platform()}`,
5757
{ strip: 1 },
5858
);
5959
}
5.33 KB
Loading
5 KB
Loading
5 KB
Loading

packages/kit-headless/src/components/popover/popover-trigger.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export const HPopoverTrigger = component$<PopoverTriggerProps>(
2323
} = usePopover(context.compId);
2424

2525
const handleClick$ = $(async () => {
26-
if (context.hover) return;
26+
if (context.hover && !isSupportedSig.value) {
27+
await showPopover();
28+
return;
29+
}
2730

2831
if (isSupportedSig.value) return;
2932

0 commit comments

Comments
 (0)