Skip to content

MOB-49400: Fix Playwright frozen-version check - #1985

Merged
henrychv merged 1 commit into
masterfrom
mob-49400-playwright-fix-check
May 13, 2026
Merged

MOB-49400: Fix Playwright frozen-version check#1985
henrychv merged 1 commit into
masterfrom
mob-49400-playwright-fix-check

Conversation

@henrychv

Copy link
Copy Markdown
Collaborator

Fixed check of installed version - no unecessary re-install triggered.

`npm list` defaults to --depth=0 on npm>=7 and `playwright` is a
transitive dep of `@playwright/test`, so the substring check never
matched even when the installed version was correct — triggering an
unnecessary re-install that fails for rootless runs. Probe the version
via `npx --no -- <pkg> --version` from `self.tools_dir`, matching the
freeze step in taurus-cloud Dockerfile-reduced. The drift-recovery
re-install path is unchanged.
@henrychv
henrychv requested review from Copilot and pavelmarik May 13, 2026 09:03
@henrychv henrychv changed the title MOB-49400: Fix Playwright frozen-version check false positive MOB-49400: Fix Playwright frozen-version check May 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Playwright “frozen version” detection to avoid false positives that were causing unnecessary reinstalls, by switching the installed-version check from npm list output parsing to a direct version probe.

Changes:

  • Replace npm list-based frozen-version detection with npx --no -- … --version probes for both Playwright and @playwright/test.
  • Update/extend unit tests to assert the new probe command and cwd usage.
  • Adjust test naming/docstrings to reflect the new “version probe” behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
bzt/modules/javascript.py Switches frozen-version checks to npx --no … --version and parses the probed version.
tests/unit/modules/_selenium/test_javascript.py Updates unit tests to expect the new probe commands and cwd behavior.
Comments suppressed due to low confidence (4)

bzt/modules/javascript.py:555

  • The warning message still says "Frozen version not found in installed packages" even though the logic no longer scans a package list; it compares a probed version string. Updating the message to reflect a version mismatch (and ideally include expected vs installed) would make troubleshooting clearer.
            if version_changed:
                self.log.warning("Frozen version not found in installed packages, will re-install %s", self.PACKAGE_NAME)
            return not version_changed

bzt/modules/javascript.py:550

  • This introduces another hard-coded "npx" invocation. On Windows the executable is typically npx.cmd (similar to how NPM.check_if_installed() searches for npm.cmd). To avoid platform-specific failures (and false "version_changed"), consider resolving the npx executable path in the same way as npm (e.g., via a small NPX tool helper that tries npx/npx.cmd) and use that resolved path here.
        # `npx --no` reads the locally-installed version without fetching from the
        # registry. Mirrors the freeze step in taurus-cloud Dockerfile-reduced.
        cmdline = ["npx", "--no", "--", "@playwright/test", "--version"]
        try:
            out, _ = self.call(cmdline, cwd=self.tools_dir)

bzt/modules/javascript.py:592

  • The warning message mentions "not found in installed packages" but the new check is a direct version probe (playwright --version). Consider adjusting the wording to reflect a version mismatch/probe failure so operators understand what was checked and why a reinstall is happening.
                installed = (out or "").strip().split()[-1] if (out or "").strip() else ""
                version_changed = installed != frozen_version
                if version_changed:
                    self.log.warning("Frozen version not found in installed packages, will re-install %s", package_name)
            except CALL_PROBLEMS as exc:

bzt/modules/javascript.py:588

  • Like the PlaywrightTestPackage probe above, this new version check hard-codes "npx". If npm.cmd is selected on Windows, npx may still need to be npx.cmd; resolving npx via a helper (similar to NPM.check_if_installed()) would make the version-check path more reliable cross-platform.
            # `npx --no` reads the locally-installed version without fetching from the
            # registry. Mirrors the freeze step in taurus-cloud Dockerfile-reduced.
            cmdline = ["npx", "--no", "--", "playwright", "--version"]
            try:
                out, _ = self.call(cmdline, cwd=self.tools_dir)
                installed = (out or "").strip().split()[-1] if (out or "").strip() else ""

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread bzt/modules/javascript.py
Comment thread tests/unit/modules/_selenium/test_javascript.py
@henrychv
henrychv merged commit 238ff21 into master May 13, 2026
7 checks passed
@henrychv
henrychv deleted the mob-49400-playwright-fix-check branch May 13, 2026 09:17
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.

3 participants