Conversation
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds file-protocol Playwright projects and a file-URL-aware page fixture that resolves relative paths to file: URLs while preserving dead-link detection; renames the exported fixture type and fixture identifier across tests for consistency. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–30 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (2)packages/**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
packages/browser/e2e-tests/**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-11-25T04:48:17.214ZApplied to files:
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Package Stats on
|
There was a problem hiding this comment.
Pull request overview
This PR adds support for testing the browser package using the file protocol in addition to the existing HTTP-based tests. This allows testing scenarios where the application is loaded directly from the filesystem rather than through a web server.
Key Changes
- Added three new Playwright test projects (chromium-file-protocol, firefox-file-protocol, webkit-file-protocol) that use file:// URLs
- Modified the test fixture to intercept
page.goto()calls and properly resolve relative URLs when using the file protocol - Renamed the fixture from
pageWithDeadLinkDetectiontocustomizedPageWithDeadLinkDetectionto reflect its expanded functionality
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/browser/e2e-tests/playwright.config.ts | Added file protocol base URL configuration and three new test projects for each browser using file:// protocol |
| packages/browser/e2e-tests/test-utils.ts | Enhanced test fixture to handle file protocol by overriding page.goto() to resolve relative URLs correctly; renamed fixture to better reflect customization |
| packages/browser/e2e-tests/tests/basic.test.ts | Updated to use renamed fixture customizedPageWithDeadLinkDetection |
| packages/browser/e2e-tests/tests/custom-element.test.ts | Updated to use renamed fixture customizedPageWithDeadLinkDetection |
| packages/browser/e2e-tests/tests/env.test.ts | Updated to use renamed fixture customizedPageWithDeadLinkDetection |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Bundle visualizer reports for
|
|
Deployment completed successfully (log).
|
|
Deployment completed successfully (log).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stlite Browser preview</title>
<link rel="stylesheet" href="https://e834b40e.stlite-browser-preview.pages.dev/stlite.css" />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module">
import { mount } from "https://e834b40e.stlite-browser-preview.pages.dev/stlite.js"
mount(
{
entrypoint: "streamlit_app.py",
files: {
"streamlit_app.py": `
import streamlit as st
st.write("Hello world")
`,
},
requirements: [],
},
document.getElementById("root"),
);
</script>
</body>
</html> |
Package Stats on
|
There was a problem hiding this comment.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/browser/e2e-tests/test-utils.ts (1)
29-33: Fix the URL resolution logic.The current implementation using
path.join()is incorrect for paths starting with/. On POSIX systems,path.join("/path/to/pages/", "/foo.html")returns/foo.html(the absolute path replaces the base), not/path/to/pages/foo.html.As noted in previous reviews, the standard
URLconstructor properly handles relative URL resolution for all protocols, including file:.Apply this diff to fix the URL resolution:
page.goto = async (url, options) => { if (baseURL && new URL(baseURL).protocol === "file:" && urlOnlyHasPathAndQuery(url)) { // When using the file: protocol, "/foo.html" should be resolved to "file:///path/to/pages/foo.html" - const basePath = new URL(baseURL).pathname; - const resolvedPath = path.join(basePath, url); - url = pathToFileURL(resolvedPath).href; + url = new URL(url, baseURL).href; } return originalGoto(url, options); };
🧹 Nitpick comments (1)
packages/browser/e2e-tests/test-utils.ts (1)
5-15: Consider renaming for clarity.The function name
urlOnlyHasPathAndQuerysuggests it validates URL structure, but it actually checks whether a string is a relative path versus a complete URL. A more precise name might beisRelativeUrlorisPathOnly.Additionally, protocol-relative URLs (e.g.,
//example.com/path) will throw and be incorrectly classified as path-only, though this is unlikely to occur in typical E2E test scenarios.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/browser/e2e-tests/test-utils.ts(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
packages/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Follow Prettier formatting (2 spaces, trailing commas, semicolons by default) as enforced by the project's configuration and workspace ESLint configs
Files:
packages/browser/e2e-tests/test-utils.ts
packages/browser/e2e-tests/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Browser E2E scenarios live in
packages/browser/e2e-tests; extend them when touching mounting, requirements parsing, or iframe messaging
Files:
packages/browser/e2e-tests/test-utils.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: CR
Repo: whitphx/stlite PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T04:48:17.214Z
Learning: Applies to packages/browser/e2e-tests/**/*.{ts,tsx,js,jsx} : Browser E2E scenarios live in `packages/browser/e2e-tests`; extend them when touching mounting, requirements parsing, or iframe messaging
📚 Learning: 2025-11-25T04:48:17.214Z
Learnt from: CR
Repo: whitphx/stlite PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T04:48:17.214Z
Learning: Applies to packages/browser/e2e-tests/**/*.{ts,tsx,js,jsx} : Browser E2E scenarios live in `packages/browser/e2e-tests`; extend them when touching mounting, requirements parsing, or iframe messaging
Applied to files:
packages/browser/e2e-tests/test-utils.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Agent
🔇 Additional comments (3)
packages/browser/e2e-tests/test-utils.ts (3)
1-2: LGTM!The imports are appropriate for handling file protocol URL resolution.
17-17: LGTM!The rename to
CustomizedPageWithDeadLinkDetectionandcustomizedPageWithDeadLinkDetectionimproves clarity about the fixture's enhanced behavior.Also applies to: 23-23
38-50: LGTM!The dead link detection implementation correctly captures failed requests (4xx+) and provides a clean assertion mechanism.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Package Stats on
|
Package Stats on
|
Bundle visualizer reports for
|
|
Deployment completed successfully (log).
|
|
Deployment completed successfully (log).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Stlite Browser preview</title>
<link rel="stylesheet" href="https://fa0cf8f8.stlite-browser-preview.pages.dev/stlite.css" />
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module">
import { mount } from "https://fa0cf8f8.stlite-browser-preview.pages.dev/stlite.js"
mount(
{
entrypoint: "streamlit_app.py",
files: {
"streamlit_app.py": `
import streamlit as st
st.write("Hello world")
`,
},
requirements: [],
},
document.getElementById("root"),
);
</script>
</body>
</html> |
Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.