Skip to content

chore: remove web-core json tests#2362

Merged
PupilTong merged 3 commits intolynx-family:mainfrom
PupilTong:p/hw/remove-old-test
Mar 25, 2026
Merged

chore: remove web-core json tests#2362
PupilTong merged 3 commits intolynx-family:mainfrom
PupilTong:p/hw/remove-old-test

Conversation

@PupilTong
Copy link
Copy Markdown
Collaborator

@PupilTong PupilTong commented Mar 20, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added Lighthouse CI performance monitoring with configurable thresholds for critical web metrics.
    • Introduced comprehensive end-to-end tests for API functionality, event handling, and interactive UI components.
  • Tests

    • Implemented performance baseline validation and browser configuration verification tests.
    • Added tests for simultaneous event handlers and DOM element selection functionality.
  • Chores

    • Updated CI workflow to enable automated performance testing integration.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 20, 2026

⚠️ No Changeset found

Latest commit: 7088ed1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 20, 2026

📝 Walkthrough

Walkthrough

This pull request establishes Lighthouse CI testing infrastructure and expands E2E test coverage for the web-core-e2e package. Changes include a new Lighthouse configuration file, test case definitions, GitHub Actions workflow updates, build configuration enhancements with virtual files middleware, and multiple new E2E test entry points covering browser configuration, simultaneous event handlers, and query selector functionality.

Changes

Cohort / File(s) Summary
CI Workflow Updates
.github/workflows/test.yml
Modified Lighthouse job to target @lynx-js/web-core-e2e package; commented out entire playwright-linux job and its dependency in the done job.
Lighthouse Configuration
packages/web-platform/web-core-e2e/lighthouserc.js, packages/web-platform/web-core-e2e/tests/lighthouse.cases.js
Added new Lighthouse CI configuration with preset, collection settings, audit skips, mobile emulation, and dynamic CPU throttling; defined three test case configurations with performance metric assertions.
Package Configuration
packages/web-platform/web-core-e2e/package.json
Added lh npm script for LHCi autorun and added @lynx-js/web-rsbuild-server-middleware as devDependency.
Build Configuration
packages/web-platform/web-core-e2e/rsbuild.config.ts
Imported and instantiated createWebVirtualFilesMiddleware; appended it to dev server middleware chain; extended publicDir with web-elements test fixtures directory.
E2E Test Specs
packages/web-platform/web-core-e2e/tests/middleware.spec.ts, packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts
Added middleware test suite for basic bindtap interaction; added three new reactlynx tests for browserConfig API, simultaneous event handlers, and main-thread query selector functionality.
Test Entry Points & Shell
packages/web-platform/web-core-e2e/shell-project/index.ts, packages/web-platform/web-core-e2e/tests/reactlynx/api-createLynxView-browserConfig/index.jsx, packages/web-platform/web-core-e2e/tests/reactlynx/basic-bindtap-simultaneous/index.jsx, packages/web-platform/web-core-e2e/tests/reactlynx/basic-main-query-selector/index.jsx
Added new test case branch for browserConfig API and three new React Lynx test entry points implementing pixel ratio display, simultaneous tap handlers, and scroll-view autoScroll via querySelector.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • Sherry-hue
  • colinaaa

Poem

🐰 Lighthouse beams shine on e2e,
Test cases grow like clover seeds with glee,
From browserConfig to handlers that stay,
Query selectors hop and scroll the day! 🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title 'chore: remove web-core json tests' describes removing tests, but the changeset adds numerous new E2E tests, Lighthouse configurations, and middleware tests with minimal removals. Update the title to accurately reflect the main changes: adding new E2E tests, Lighthouse performance tests, and middleware configurations. Consider: 'feat: add Lighthouse and middleware E2E tests for React Lynx' or 'test: add comprehensive E2E and performance testing suite'.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 20, 2026

Merging this PR will degrade performance by 14.56%

❌ 1 regressed benchmark
✅ 62 untouched benchmarks
⏩ 21 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
transform 1000 view elements 40.4 ms 47.2 ms -14.56%

Comparing PupilTong:p/hw/remove-old-test (7088ed1) with main (518c310)

Open in CodSpeed

Footnotes

  1. 21 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link
Copy Markdown

relativeci bot commented Mar 20, 2026

Web Explorer

#8348 Bundle Size — 521.22KiB (0%).

7088ed1(current) vs 518c310 main#8343(baseline)

Bundle metrics  Change 2 changes
                 Current
#8348
     Baseline
#8343
No change  Initial JS 41.85KiB 41.85KiB
No change  Initial CSS 1.99KiB 1.99KiB
Change  Cache Invalidation 0% 100%
No change  Chunks 7 7
No change  Assets 8 8
Change  Modules 144(-2.04%) 147
No change  Duplicate Modules 10 10
Change  Duplicate Code 30.8%(+0.1%) 30.77%
No change  Packages 3 3
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#8348
     Baseline
#8343
No change  JS 317.23KiB 317.23KiB
No change  Other 202KiB 202KiB
No change  CSS 1.99KiB 1.99KiB

Bundle analysis reportBranch PupilTong:p/hw/remove-old-testProject dashboard


Generated by RelativeCIDocumentationReport issue

PupilTong added a commit that referenced this pull request Mar 24, 2026
…ntation (#2322)

Plan:

- [x] pass all old web tests
- [x] fix REPL tests
- [ ] introduce a benchmark result #2362 
- [x] document breaking change and migration methods
- [ ] remove all old tests #2362 

<!--
  Thank you for submitting a pull request!

We appreciate the time and effort you have invested in making these
changes. Please ensure that you provide enough information to allow
others to review your pull request.

Upon submission, your pull request will be automatically assigned with
reviewers.

If you want to learn more about contributing to this project, please
visit:
https://github.com/lynx-family/lynx-stack/blob/main/CONTRIBUTING.md.
-->

<!-- The AI summary below will be auto-generated - feel free to replace
it with your own. -->

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
  * Unified WASM-based core engine as primary implementation
  * New `__QuerySelector` and `__InvokeUIMethod` APIs
* `<lynx-view>` gains `browser-config` attribute for pixelRatio/viewport
control
  * Better CSS handling: keyframes, scoped/root/type selector alignment

* **Bug Fixes**
* Backward-compatibility fixes for legacy JSON templates and
lazy-loading execution mode

* **Breaking Changes**
* Removed `thread-strategy`, `overrideLynxTagToHTMLTagMap`,
`customTemplateLoader`, `inject-head-links`

* **Security**
  * CSP hardening: `nonce` support for iframe/srcdoc-executed scripts
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

## Checklist

<!--- Check and mark with an "x" -->

- [x] Tests updated (or not required).
- [x] Documentation updated (or not required).
- [x] Changeset added, and when a BREAKING CHANGE occurs, it needs to be
clearly marked (or not required).

---------

Co-authored-by: Xuan Huang (黄玄) <5563315+Huxpro@users.noreply.github.com>
@PupilTong PupilTong force-pushed the p/hw/remove-old-test branch from 734f4bc to a310ad3 Compare March 24, 2026 08:47
@PupilTong PupilTong self-assigned this Mar 24, 2026
@PupilTong PupilTong changed the title WIP: remove web-core json tests chore: remove web-core json tests Mar 24, 2026
@PupilTong PupilTong marked this pull request as ready for review March 24, 2026 09:25
@PupilTong PupilTong requested a review from Sherry-hue as a code owner March 24, 2026 09:25
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (2)
packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts (1)

242-249: Add a partial-override browserConfig case too.

This only validates the fully overridden object. A regression in the fallback path where pixelWidth/pixelHeight get recomputed from an overridden pixelRatio would still pass here. Please add a case that overrides only pixelRatio and asserts the original width/height fallback.

Based on learnings: browserConfig parameters (pixelRatio, pixelWidth, pixelHeight) are intentionally independently controllable, and when only pixelRatio is overridden the fallback width/height should still use the original screen dimensions.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts` around lines 242
- 249, Add a new test case alongside api-createLynxView-browserConfig that
exercises a partial browserConfig override: call the same helper (goto) with a
browserConfig object that overrides only pixelRatio (e.g., 2) but does not
supply pixelWidth/pixelHeight, then assert that the width/height locators
(`#width` and `#height`) still show the original values (1234 and 5678). Use the
same test scaffolding (test(..., async ({ page }, { title }) => { ... })) and
same wait/expect sequence as api-createLynxView-browserConfig so the fallback
path (recomputing width/height) is explicitly verified.
packages/web-platform/web-core-e2e/tests/middleware.spec.ts (1)

38-41: Prefer Playwright's built-in locator assertions for auto-retrying.

Using await expect(await target.getAttribute('style')) bypasses Playwright's auto-waiting behavior, making the test reliant on explicit wait() calls that can be flaky. Use toHaveAttribute with a regex or toHaveCSS for style assertions.

♻️ Suggested refactor using Playwright assertions
-    await wait(100);
-    await expect(await target.getAttribute('style')).toContain('green');
+    await expect(target).toHaveAttribute('style', /green/);
     await target.click();
-    await wait(100);
-    await expect(await target.getAttribute('style')).toContain('pink');
+    await expect(target).toHaveAttribute('style', /pink/);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/web-platform/web-core-e2e/tests/middleware.spec.ts` around lines 38
- 41, The test is bypassing Playwright's auto-retry by awaiting getAttribute and
then asserting on the string; update the assertions to use Playwright locator
matchers (e.g., replace the current checks on target.getAttribute('style') with
expect(target).toHaveAttribute('style', /green/) and later
expect(target).toHaveAttribute('style', /pink/) or use
expect(target).toHaveCSS(...) for specific CSS properties), remove the explicit
wait(100) and rely on Playwright to auto-wait; locate the assertions around the
locator named target in middleware.spec.ts and change them to use
toHaveAttribute/toHaveCSS so they auto-retry.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/test.yml:
- Line 80: The workflow step uses "pnpm --filter `@lynx-js/web-core-e2e` run lh ||
echo 'Lighthouse failed'" which masks non-zero exits from lhci autorun; remove
the "|| echo 'Lighthouse failed'" (or replace it with "|| exit 1") so the pnpm
command's non-zero exit propagates and Lighthouse assertion failures fail the CI
job; update the step that runs pnpm --filter `@lynx-js/web-core-e2e` run lh
accordingly.
- Around line 101-131: The Playwright job for `@lynx-js/web-tests`
("playwright-linux" job that uses ./.github/workflows/workflow-test.yml and runs
pnpm --filter `@lynx-js/web-tests` run test and coverage:ci) was commented out;
restore or replace it so Playwright specs continue gating merges — either
uncomment the existing job (including the matrix/thread/render/shard matrix,
runs-on/is-web/web-report-name/codecov-flags settings and the run script that
sets ENABLE_MULTI_THREAD/ENABLE_SSR, NODE_OPTIONS and
PLAYWRIGHT_JUNIT_OUTPUT_NAME) or add an equivalent job that executes pnpm
--filter `@lynx-js/web-tests` run test and pnpm --filter `@lynx-js/web-tests` run
coverage:ci to ensure the `@lynx-js/web-tests` suites remain executed in CI.

In `@packages/web-platform/web-core-e2e/lighthouserc.js`:
- Around line 53-59: The screenEmulation block currently sets mobile-specific
properties (mobile, width, height, deviceScaleFactor) while also setting
'disabled': true which causes Lighthouse to ignore those settings; update the
'screenEmulation' configuration in lighthouserc.js by either removing the
'disabled': true flag so the specified mobile dimensions and deviceScaleFactor
are applied, or keep 'disabled': true but add a concise comment in the
'screenEmulation' block explaining why emulation is intentionally disabled
(e.g., handled externally or testing host viewport) so the intent is clear.

In
`@packages/web-platform/web-core-e2e/tests/reactlynx/api-createLynxView-browserConfig/index.jsx`:
- Around line 1-10: The component App creates an unnecessary initial render by
initializing info with {} and then populating it in useEffect; instead
initialize state directly from SystemInfo so the first paint has the correct
values and you can remove the effect. Replace the useState call in App to seed
info with { pixelWidth: SystemInfo.pixelWidth, pixelHeight:
SystemInfo.pixelHeight } (and remove the setInfo/useEffect block), referencing
the symbols App, useState, SystemInfo, info, and setInfo to locate the code to
change.

---

Nitpick comments:
In `@packages/web-platform/web-core-e2e/tests/middleware.spec.ts`:
- Around line 38-41: The test is bypassing Playwright's auto-retry by awaiting
getAttribute and then asserting on the string; update the assertions to use
Playwright locator matchers (e.g., replace the current checks on
target.getAttribute('style') with expect(target).toHaveAttribute('style',
/green/) and later expect(target).toHaveAttribute('style', /pink/) or use
expect(target).toHaveCSS(...) for specific CSS properties), remove the explicit
wait(100) and rely on Playwright to auto-wait; locate the assertions around the
locator named target in middleware.spec.ts and change them to use
toHaveAttribute/toHaveCSS so they auto-retry.

In `@packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts`:
- Around line 242-249: Add a new test case alongside
api-createLynxView-browserConfig that exercises a partial browserConfig
override: call the same helper (goto) with a browserConfig object that overrides
only pixelRatio (e.g., 2) but does not supply pixelWidth/pixelHeight, then
assert that the width/height locators (`#width` and `#height`) still show the
original values (1234 and 5678). Use the same test scaffolding (test(..., async
({ page }, { title }) => { ... })) and same wait/expect sequence as
api-createLynxView-browserConfig so the fallback path (recomputing width/height)
is explicitly verified.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 15ea07e8-8373-4b1f-9583-717732b11ef6

📥 Commits

Reviewing files that changed from the base of the PR and between 518c310 and 7088ed1.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • .github/workflows/test.yml
  • packages/web-platform/web-core-e2e/lighthouserc.js
  • packages/web-platform/web-core-e2e/package.json
  • packages/web-platform/web-core-e2e/rsbuild.config.ts
  • packages/web-platform/web-core-e2e/shell-project/index.ts
  • packages/web-platform/web-core-e2e/tests/lighthouse.cases.js
  • packages/web-platform/web-core-e2e/tests/middleware.spec.ts
  • packages/web-platform/web-core-e2e/tests/reactlynx.spec.ts
  • packages/web-platform/web-core-e2e/tests/reactlynx/api-createLynxView-browserConfig/index.jsx
  • packages/web-platform/web-core-e2e/tests/reactlynx/basic-bindtap-simultaneous/index.jsx
  • packages/web-platform/web-core-e2e/tests/reactlynx/basic-main-query-selector/index.jsx

@PupilTong PupilTong merged commit 594b897 into lynx-family:main Mar 25, 2026
69 of 72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants