Skip to content

test: run the cloak-profile integration test in CI - #31

Merged
code-yeongyu merged 1 commit into
mainfrom
test-audit/r4-ci-routing
Sep 30, 2026
Merged

code-yeongyu merged 1 commit into
mainfrom
test-audit/r4-ci-routing

Conversation

@code-yeongyu

@code-yeongyu code-yeongyu commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Summary

Routing node R4: run test/cloak-profile.integration.test.mjs in CI. It was in neither test script, and two things stopped it running as written:

  • It called findCloakBrowserPath() directly. That function only globs a macOS CloakBrowser install, so the CLOAKBROWSER_BIN that CI sets was ignored and the test would throw on Linux.
  • It asserted navigator.webdriver === false. Only CloakBrowser's patched binary reports that. The stock chrome-headless-shell that CI installs reports true; locally that assertion fails with actual: { webdriver: true, value: 'persisted' }.

The test is now split in two:

  • Profile persistence. Site state (localStorage) and the fingerprint seed are reused across relaunches. It goes through connectCloakProfile's default, which resolves CLOAKBROWSER_BIN first, so it runs on any Chromium, CI included. It skips only when no browser exists at all.
  • CloakBrowser hides navigator.webdriver on a reused profile. It needs a real CloakBrowser and skips with a reason when none is installed. CI does not have one; adding a third-party CloakBrowser download to CI is a separate decision.

Both use the repo's existing { skip, timeout: 60000 } pattern for live tests. The file is added to test and test:node.

Baseline gate (unedited base de08f48b)

The original file under node --test with a real local CloakBrowser: 1 pass. Under bun test: 1 fail, from the default 5 s timeout on a two-launch test.

After this change:

Browser available node --test bun test
chrome-headless-shell via CLOAKBROWSER_BIN (what CI has) ℹ tests 2 ℹ pass 1 ℹ fail 0 ℹ skipped 1 1 pass 1 skip 0 fail
real CloakBrowser ℹ tests 2 ℹ pass 2 ℹ fail 0 ℹ skipped 0 2 pass 0 fail
none ℹ tests 2 ℹ pass 0 ℹ fail 0 ℹ skipped 2 (same skips)

Mutation proof

  • src/cloak-profile.js launches with a fresh --user-data-dir each time instead of the profile directory. The routed persistence test fails: ℹ pass 0 ℹ fail 1. Restored; git diff --quiet -- src exits 0.

Audit numstat (frozen measurement tool, merge-base..head)

Removed: test 31, support 0, prod 0. Added: test 39, support 0, prod 0. Test files delta: 0.

Verify

The CI log on this PR should list cloak-profile.integration.test.mjs in both the bun test and node --test steps, with 1 pass and 1 skip.

Refs #28


Summary by cubic

Runs the cloak-profile integration test in CI. Previously it wasn't in any test script, only found a macOS CloakBrowser install via findCloakBrowserPath(), and asserted navigator.webdriver === false which fails on the stock Chromium that CI installs.

  • Splits it into two tests: profile persistence runs on any Chromium (via connectCloakProfile's CLOAKBROWSER_BIN default), and the navigator.webdriver check requires a real CloakBrowser and skips with a reason if none is installed.
  • Adds the file to both the test and test:node scripts.

Written for commit 2bd7df2. Summary will update on new commits.

Review in cubic

The file was in no test script. It also passed browserPath: findCloakBrowserPath(), which only globs a macOS CloakBrowser install, so CLOAKBROWSER_BIN was ignored. And it asserted navigator.webdriver === false, which only CloakBrowser's patched binary reports; the stock chrome-headless-shell in CI reports true.

Split it into two tests:
- Profile persistence (site state and fingerprint seed reused across relaunches) goes through connectCloakProfile's CLOAKBROWSER_BIN default, so it runs on any Chromium, including CI.
- The navigator.webdriver check needs a real CloakBrowser and skips with a reason when none is installed.

Add the file to both test scripts.
@code-yeongyu

Copy link
Copy Markdown
Owner Author

CI evidence (https://github.com/code-yeongyu/omowright/actions/runs/36784678420):

  • bun test: test/cloak-profile.integration.test.mjs ran. The persistence test passed in 187 ms; the CloakBrowser test was skipped. Total 218 pass.
  • node --test: the persistence test passed in 204 ms; the CloakBrowser test was skipped with # no CloakBrowser binary installed. Total: 219 tests, 218 pass, 0 fail, 1 skipped.

@code-yeongyu
code-yeongyu merged commit b00bc81 into main Sep 30, 2026
3 checks passed
@code-yeongyu
code-yeongyu deleted the test-audit/r4-ci-routing branch September 30, 2026 22:23
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.

1 participant