Skip to content

Static-analysis cleanup, integration tests, cookbook + WR_sleep + API façade#87

Merged
JE-Chen merged 1 commit intomainfrom
dev
Apr 26, 2026
Merged

Static-analysis cleanup, integration tests, cookbook + WR_sleep + API façade#87
JE-Chen merged 1 commit intomainfrom
dev

Conversation

@JE-Chen
Copy link
Copy Markdown
Member

@JE-Chen JE-Chen commented Apr 26, 2026

Summary

51 commits since PR #86 merged. The PR is dominated by quality work (SonarCloud / Codacy findings, real-browser smoke, integration test suite) plus genuine usability wins (WR_sleep, cookbook, façade).

New executor surface

  • WR_sleep — native time.sleep action so JSON pipelines no longer need WR_execute_async_script + setTimeout to pace themselves. Validates type / non-negative.
  • Bug found by actually running it: webdriver_wrapper.execute_script was discarding return values; WR_execute_script therefore always resolved to None. Fixed.

Cookbook (examples/)

Each recipe was run end-to-end before commit:

  • counting_stars.{py,json} — YouTube + skip-ad polling
  • google_search.py — consent dismissal + result heading scrape
  • form_submit.pyform_autofill + state_diff against httpbin
  • smart_wait_demo.py — fetch idle / SPA route stable / memory probe
  • fanout_demo.py — parallel HTTP preflights
  • pii_redact_demo.py — pure-logic scan / redact
  • quick_smoke.json — minimal executor sanity check

Comprehensive integration test suite

test/integration_test/ — 30 tests across 10 files, each wiring 2+ modules with real I/O:

  • in-memory SQLite for db_fixtures
  • in-process HTTP for har_replay, mock_services, live_dashboard, visual_review
  • real subprocess for the MCP server and Action LSP (caught a Windows-only LSP CRLF framing bug — fixed by sys.stdout.reconfigure(newline="") in __main__.py)
  • end-to-end pipelines: bootstrap → format → lint → schema, coverage_map + impact_analysis + diff_shard, record_run → trend_dashboard

Wired into test_dev.yml and test_stable.yml as a step right after the unit suite.

Real-browser E2E scaffold

test/e2e_test/ + .github/workflows/e2e_browser.yml boots selenium/hub:4.20.0 + selenium/node-chrome and runs smart_wait / state_diff / memory_leak / csp_reporter / shadow_pierce smoke tests daily.

Thematic API façade — je_web_runner.api

11 themed submodules (authoring, debugging, frontend, infra, mobile, networking, observability, quality, reliability, security, test_data) re-exporting the 80+ helpers from je_web_runner.utils.<area> so callers can from je_web_runner.api import quality instead of memorising deep paths. Original top-level Selenium API unchanged.

Sphinx autodoc + autosummary

docs/source/conf.py gains sphinx.ext.autodoc + autosummary + napoleon with mock imports for soft deps (selenium / playwright / appium / Pillow / locust / OTel / testcontainers). New Eng/doc/api_reference/api_reference.rst drives recursive per-module reference page generation.

Static-analysis cleanup (4 rounds against PR #86's review)

  • Codacy ~30 issues cleared: unused imports, B110 / B112 / B202 / B101 nosec annotations on legitimate cleanup paths and pytest assertions, Bandit / Semgrep markers on the validated tarfile / SQL builder paths, F541 / F821 / F841 fixed.
  • SonarCloud down to a clean state: cog-complexity refactors (pipeline.load_pipeline, coverage_map.build_coverage_map, fanout.run_fan_out, browser_pool.checkout, visual_review do_GET, a11y_trend.aggregate_history, storybook.visual_snapshots.capture_story_snapshots, examples/counting_stars.py main); S7632 suppressions reanchored; S5131 hardening with _safe_echo + nosniff; S3358 nested ternaries → _direction_for; S5754, S7500, S7504, S6353, S5852, S5869, S5906, S2068, S125, S1192, S5042, S4828, S1313, S5332 all resolved or properly annotated.
  • Optimisation pass: 7 pytest collection warnings cleared via __test__ = False; workspace_lock distribution walk cached (~1.2s saved); socket_server quit tests went from 2.42s → 0.49s via threading.Event + tighter poll_interval.

Numbers

  • Tests: 1184 → 1230 (1200 unit + 30 integration), 0 collection warnings.
  • Suite: combined unit + integration ~18s.

Test plan

  • Unit + integration green on Python 3.10 / 3.11 / 3.12 / 3.13.
  • Daily E2E workflow runs against Selenium Grid.
  • PyPI publish workflow fires on merge (auto patch bump + tag + release).
  • Sphinx autosummary tree builds without warnings on the new sections.

@sonarqubecloud
Copy link
Copy Markdown

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit 93ebdec into main Apr 26, 2026
18 checks passed
JE-Chen added a commit that referenced this pull request Apr 26, 2026
MCP server refresh + bug fixes since PR #87
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