Skip to content

The agent that grows with you

test(e2e): let PM installers exercise the default browser install

ethernet241bc72c1d16
diff --git a/tests/install/e2e-assets/installer-common.sh b/tests/install/e2e-assets/installer-common.sh
index d7c078f32ca..a94a1085fe6 100644
--- a/tests/install/e2e-assets/installer-common.sh
+++ b/tests/install/e2e-assets/installer-common.sh
@@ -74,10 +74,15 @@ run_source_installer() {
text="$(git -C "$repo" show "$ref:scripts/install.sh")" || return
git -C "$repo" show "$ref:scripts/install.sh" > "$script" || return
local flags=(--skip-setup)
- # Rejection messages also mention --skip-browser. Only pass it when this
- # version's public help advertises the flag as supported.
+ # Historical (pre-PM) installers ran their own Playwright/npm browser
+ # install, which is slow and can prompt for sudo; skip it there. A PM
+ # installer (it enters `pm.cli`) gets no flag: its default install carries
+ # agent-browser + Chromium, which is what users get, so the leg exercises it.
+ # Rejection messages also mention --skip-browser, so trust only the help.
help_text="$(bash "$script" --help < /dev/null 2>/dev/null)" || help_text=""
- if grep -qF -- --skip-browser <<< "$help_text"; then flags+=(--skip-browser); fi
+ if grep -qF -- --skip-browser <<< "$help_text" && ! grep -qF 'pm.cli' <<< "$text"; then
+ flags+=(--skip-browser)
+ fi
if [ "$desktop" = desktop ]; then
grep -qF -- --include-desktop <<< "$text" \
|| { fail "ref $ref does not support --include-desktop; this leg cannot mean what it claims"; return 1; }
diff --git a/tests/installation/test_installer_common.py b/tests/installation/test_installer_common.py
index 9b395669399..ffc2e4ca1f8 100644
--- a/tests/installation/test_installer_common.py
+++ b/tests/installation/test_installer_common.py
@@ -71,6 +71,14 @@ run_source_installer "$2" "$3" "$3" "$6" new desktop
assert (work / "install-current.log").read_text(encoding="utf-8").splitlines() == [
"--skip-setup", "--include-desktop",
]
+ # A PM installer supports --skip-browser as a real opt-out; the leg must
+ # still install what users get by default, so the driver withholds it.
+ script.write_text('case "$1" in --help) printf "%s\\n" "--skip-browser --include-desktop"; exit 0;; esac\n'
+ '# "$boot_py" -m pm.cli install\n' + source_body, encoding="utf-8")
+ git("commit", "-qam", "pm installer")
+ pm_installer = run('run_source_installer "$2" "$3" "$3" HEAD pm')
+ assert pm_installer.returncode == 0, pm_installer.stderr
+ assert (work / "install-pm.log").read_text(encoding="utf-8").splitlines() == ["--skip-setup"]
script.write_text("exit 23\n", encoding="utf-8")
git("commit", "-qam", "failed installer")
failed = run('run_source_installer "$2" "$3" "$3" HEAD broken')