Skip to content

Commit 1788b18

Browse files
committed
tests/test_playwrightprovider: assert browsers live under install_root/cache
Devin caught the test drift from the PLAYWRIGHT_BROWSERS_PATH rework: browsers now land in ``<install_root>/cache/chromium-<buildId>/`` (matching the ``install_root/cache`` default abxpkg pins), not directly under ``install_root``. Update every place that iterates ``playwright_root`` or ``install_root`` looking for ``chromium-*/`` dirs to walk ``<root>/cache`` instead — covering the chromium install lifecycle assertions, the ``--no-shell`` carveout check, the update test's resolved-target ancestry check, and the dry-run "no browsers got downloaded" check. Also points the symlink ancestry assertion in ``test_chromium_install_puts_real_browser_into_managed_bin_dir`` at ``playwright_root/cache`` since that's the actual ``PLAYWRIGHT_BROWSERS_PATH`` root the symlinks resolve into.
1 parent c19901c commit 1788b18

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

tests/test_playwrightprovider.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ def test_chromium_install_puts_real_browser_into_managed_bin_dir(
7070
assert provider.bin_dir is not None
7171
assert installed.loaded_abspath.parent == provider.bin_dir
7272
assert installed.loaded_abspath == provider.bin_dir / "chromium"
73-
# The symlink resolves into playwright_root (which is also
74-
# PLAYWRIGHT_BROWSERS_PATH for this provider).
73+
# The symlink resolves into ``playwright_root/cache`` (the
74+
# managed ``PLAYWRIGHT_BROWSERS_PATH`` for this provider).
7575
real_target = installed.loaded_abspath.resolve()
76-
assert playwright_root.resolve() in real_target.parents
76+
assert (playwright_root / "cache").resolve() in real_target.parents
7777
# Playwright lays out chromium builds as chromium-<build>/.
7878
assert any(
7979
child.name.startswith("chromium-")
80-
for child in playwright_root.iterdir()
80+
for child in (playwright_root / "cache").iterdir()
8181
if child.is_dir()
8282
)
8383

@@ -134,7 +134,7 @@ def test_install_root_alias_without_explicit_bin_dir_uses_root_bin(
134134
# the effective PLAYWRIGHT_BROWSERS_PATH for this provider).
135135
assert any(
136136
child.name.startswith("chromium-")
137-
for child in install_root.iterdir()
137+
for child in (install_root / "cache").iterdir()
138138
if child.is_dir()
139139
)
140140

@@ -171,7 +171,7 @@ def test_install_root_and_bin_dir_aliases_install_into_the_requested_paths(
171171
# Browser tree still landed in install_root, not bin_dir.
172172
assert any(
173173
child.name.startswith("chromium-")
174-
for child in install_root.iterdir()
174+
for child in (install_root / "cache").iterdir()
175175
if child.is_dir()
176176
)
177177

@@ -244,9 +244,10 @@ def test_provider_install_args_are_passed_through_to_playwright_install(
244244
assert installed is not None
245245
assert installed.loaded_abspath is not None
246246
assert installed.loaded_abspath.exists()
247+
cache_dir = playwright_root / "cache"
247248
chromium_dirs = [
248249
child
249-
for child in playwright_root.iterdir()
250+
for child in cache_dir.iterdir()
250251
if child.is_dir()
251252
and child.name.startswith("chromium-")
252253
and not child.name.startswith("chromium_headless_shell")
@@ -255,7 +256,7 @@ def test_provider_install_args_are_passed_through_to_playwright_install(
255256
# ``--no-shell`` should have skipped the headless shell download.
256257
headless_shell_dirs = [
257258
child
258-
for child in playwright_root.iterdir()
259+
for child in cache_dir.iterdir()
259260
if child.is_dir() and child.name.startswith("chromium_headless_shell")
260261
]
261262
assert not headless_shell_dirs, (
@@ -380,10 +381,10 @@ def test_update_refreshes_chromium_in_place(
380381
# ``playwright_root``).
381382
updated_target = updated.loaded_abspath.resolve()
382383
assert updated_target.exists()
383-
assert playwright_root.resolve() in updated_target.parents
384+
assert (playwright_root / "cache").resolve() in updated_target.parents
384385
assert any(
385386
child.name.startswith("chromium-")
386-
for child in playwright_root.iterdir()
387+
for child in (playwright_root / "cache").iterdir()
387388
if child.is_dir()
388389
)
389390

@@ -397,14 +398,15 @@ def test_provider_dry_run_does_not_install_chromium(self, test_machine):
397398

398399
test_machine.exercise_provider_dry_run(provider, bin_name="chromium")
399400
# dry_run must not have actually downloaded any browsers.
401+
cache_dir = playwright_root / "cache"
400402
browser_dirs = (
401403
[
402404
p
403-
for p in playwright_root.iterdir()
405+
for p in cache_dir.iterdir()
404406
if p.is_dir()
405407
and p.name.startswith(("chromium-", "firefox-", "webkit-"))
406408
]
407-
if playwright_root.is_dir()
409+
if cache_dir.is_dir()
408410
else []
409411
)
410412
assert not browser_dirs, (

0 commit comments

Comments
 (0)