Skip to content

Release dev to main#100

Merged
JE-Chen merged 55 commits into
mainfrom
dev
Jul 9, 2026
Merged

Release dev to main#100
JE-Chen merged 55 commits into
mainfrom
dev

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Merges the accumulated dev work into main (52 commits), including:

  • Include underlying error in re-raised driver lifecycle exceptions (set_driver / set_webdriver_options_capability / quit) so callers no longer see a bare WebRunnerException()
  • Use lock context manager in JUnit XML report writer
  • Fix appium gesture W3C fallback to use execute(actions)
  • Fix BiDi network handlers to use Selenium 4 add_request_handler API
  • Wrap action-JSON write failures in WebRunnerJsonException
  • Reject non-list action_list instead of swallowing the validation error
  • Register appium and cloud drivers via set_active_driver for ActionChains
  • Pass chromedriver log via log_output so it is honored on Selenium 4
  • Rebind ActionChains when switching active webdriver
  • and other fixes

Testing

  • pytest test/unit_test: 4300 passed, 3 skipped

JE-Chen added 30 commits June 26, 2026 14:21
- Modernize f-string conversions (repr()/str() -> !r/!s) and drop stale
  or invalid noqa directives; simplify redundant returns/branches
- Add explicit zip(strict=False) and chain re-raised exceptions with
  `from` to preserve diagnostics
- Replace implicit Optional defaults (x: T = None) with `T | None`
- Rename ambiguous single-letter `l` locals in sbom_diff/webserial_mock
- Make visual_ai perceptual hashing forward-compatible with Pillow 14 by
  preferring get_flattened_data() over the deprecated Image.getdata()
- Mark Test*-named domain classes with __test__ = False so pytest no
  longer mis-collects them
- Ignore local static-analysis and report scratch artifacts in .gitignore
- Default Weights args to None and build inside score_one/score_many so
  callers never share one mutable instance
- Collapse chained str.startswith() calls into a single tuple membership
  test and drop a redundant dict.keys() lookup
Add pytest, pylint, flake8, bandit and mypy so the documented
pre-commit checks (and `python -m pytest test/`) run in a fresh
dev environment.
- Replace typing.List/Dict/Tuple/Set/etc. with builtin generics
  (list[...], dict[...]) now that the floor is Python 3.10
- Replace Optional[X]/Union[X, Y] with X | None / X | Y
- Drop the now-unused typing imports and other small pyupgrade cleanups
  (useless object base, redundant open modes, encode utf-8)

All 4174 unit tests pass; no runtime annotation introspection
(pydantic/get_type_hints) is in use, so the rewrites are behaviour-neutral.
- Enable actions/setup-python pip caching (keyed on the requirements
  file) in the dev, stable and e2e workflows to cut install time
- Remove the now-redundant `pip install pytest` from the dev workflow
  since pytest is declared in dev_requirements
The v3 client removed the desired_capabilities kwarg, so passing it (plus
options=None) raised TypeError. Build an AppiumOptions from the capability
dict via load_capabilities() and pass it as options=. Strengthen the unit
test to assert the modern options path and the absence of the removed
kwarg.
Restrict collection to test_*.py via [tool.pytest.ini_options]. The legacy
*_test.py scripts under test/unit_test/*/ are standalone browser programs
that call sys.exit() at import time, which previously crashed
`python -m pytest test/unit_test` with an INTERNALERROR. Real tests across
unit/integration/e2e are all named test_*.py, so the documented
`python -m pytest test/` now works.
- Add je_web_runner/py.typed and declare it as package data so downstream
  type checkers consume the inline type hints (verified present in the
  built wheel)
- Add a github-actions Dependabot updater so workflow action versions stay
  current alongside pip dependencies
Provide a private reporting channel (GitHub Security Advisories + a
maintainer email), supported-version guidance and a 90-day coordinated
disclosure timeline for this security-focused automation framework.
testcontainers' PostgresContainer takes username=, not user=, so
start_postgres raised TypeError against the real library. Rename the
wrapper parameter to username and pass it through correctly; update the
unit test to assert the corrected call.
Cover three modules that had 0% coverage:
- json_format.json_process.reformat_json (valid/object/invalid/non-serializable)
- xml.xml_file XMLParser + reformat_xml_file (string/file/error paths)
- cli.watch_mode watch_directory (snapshot/idle/change/interrupt/debounce)

json_process and xml_file reach 100%, watch_mode 95%.
Launch `python -m je_web_runner` as a subprocess and assert --help exits 0
with usage and no-args exits 1 with the expected error, guarding the
__main__ wiring of the published CLI against import/dispatch regressions.
The MCP subprocess test read the server's UTF-8 JSON with the OS locale
encoding, so on a non-UTF-8 Windows console (cp950/cp1252) the reader
thread hit UnicodeDecodeError and the test failed (it passed only on
UTF-8 CI runners). Pin encoding="utf-8" on the subprocess pipes here and
in the CLI entry-point smoke test so they are locale-independent.
open(..., "w+") used the process locale encoding, so HTML/XML/JSON reports
and generated project templates containing non-ASCII (the framework's
Chinese content / test data) were corrupted or raised UnicodeEncodeError
on non-UTF-8 Windows consoles (cp950/cp1252). Pin encoding="utf-8" on all
eight report/template writers.
Three inline literals were immediately followed by an opening parenthesis
(ASCII or fullwidth) with no separator, so docutils reported "inline
literal start-string without end-string" and dropped the markup. Insert
an escaped space so the literal closes cleanly. Sphinx now builds with no
warnings.
The package advertised only Python 3.10 while it supports and CI-tests
3.10–3.14. Declare the SPDX license (MIT), the full supported Python
range, Intended Audience / Testing / QA topic classifiers and search
keywords. Wheel and sdist still pass twine check.
Document the dev setup, how to run the unit/integration/e2e tests, the
pre-PR lint checks, and the dev->main branch/commit conventions so human
contributors have a starting point alongside SECURITY.md.
Add tests exercising the previously-untested logic via the modules' own
injection points (no network, no optional libs):

- otp_interceptor: _http_get_json (success/empty/non-JSON/OSError), the
  IMAP provider + raw-email parsing, _parse_time edge cases, provider
  error branches and wait-arg validation (62% -> 91%).
- download_verify: wait_for_download skips, JSON/Excel/PDF error paths,
  nested schema-validator branches and assert_download sub-checks
  (72% -> 82%; the rest is pypdf/openpyxl-only extraction code).
Exercise the Loki and Elasticsearch payload parsers directly, drive both
HTTP fetchers through a monkeypatched requests (success + RequestException)
and cover the file-fetcher empty-line / invalid-JSON skips plus the
attach-to-non-directory guard. Coverage 62% -> 99%.
Add tests for YAML spec loading (happy/parse-error/non-mapping), the
examples-plural synthesis forms (dict-with-value/dict/list), $ref
resolution edge cases and the non-dict / empty-array synthesis paths.
Coverage 80% -> 89%.
JE-Chen added 22 commits June 27, 2026 06:45
set_driver / set_webdriver_options_capability / quit re-raised bare WebRunnerException (and the manager quit a bare WebDriverException), losing the original selenium / webdriver_manager error message. Callers printing repr(error) saw an empty WebRunnerException() with no clue about the root cause. Embed the wrapped error's repr in the raised message; the cause chain is unchanged.
@codacy-production

codacy-production Bot commented Jul 9, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 158 complexity · -9 duplication

Metric Results
Complexity 158
Duplication -9

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 added 3 commits July 10, 2026 00:19
…pper

Selenium 4.45 removed the response_started legacy phase from add_request_handler (only before_request and auth_required remain) and replaced Network.EVENTS/PHASES with EVENT_CONFIGS, so add_response_handler broke and the event-name guard test failed on CI. Prefer the native network.add_response_handler when present and fall back to the legacy phase on older Selenium. clear_network_handlers now also calls clear_response_handlers when available, since 4.45 keeps native response handlers in a separate registry. The guard test asserts EVENTS/PHASES on <= 4.44 and LEGACY_REQUEST_HANDLER_EVENTS plus the native API on 4.45+; unit suite passes against both 4.41 and 4.45.
SonarCloud's PR quality gate surfaced the whole dev-vs-main diff as new code, flagging 38 findings that are false positives for this library: file I/O on developer-supplied report/config/action-JSON paths (S8707/S2083), intentional plain HTTP on localhost/dev-configured or test-fixture endpoints (S5332), non-cryptographic randomness in chaos injection and matrix sampling (S2245), test-fixture credentials (S2068), exact numeric passthrough assertions (S1244), and the valid Py3.12+ tarfile extractall(filter=data) kwarg already guarded for older interpreters (S930). Each line gets a NOSONAR comment with a justification, matching the existing convention. No logic changed; unit suite passes (4302) under Selenium 4.41 and 4.45.
Codacy's PR gate (0-new-issues) flagged 65 findings that are all test-code false positives: pytest B101 assert usage, B106/B105 test-fixture credentials, and one controlled subprocess.run in a CLI entrypoint test (Semgrep dangerous-subprocess-use). Each gets a trailing # nosec <ID> / # nosemgrep comment, matching the 65 suppressions already present in the test tree. A few sibling asserts in the same files were suppressed too so the tree is bandit-clean. No test logic changed; unit suite still 4302 passed.
@sonarqubecloud

sonarqubecloud Bot commented Jul 9, 2026

Copy link
Copy Markdown

@JE-Chen
JE-Chen merged commit 14e7b82 into main Jul 9, 2026
22 checks passed
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