test(form): guarantee Playwright browser cleanup

This commit is contained in:
Adam Moussa 2026-07-30 19:35:30 -04:00
parent 84cb6251fe
commit fca2ec6044
No known key found for this signature in database

View file

@ -343,6 +343,7 @@ class TestGenerateFormGooglePlaywright:
"Chromium is required for form Playwright tests. " "Chromium is required for form Playwright tests. "
"Run: playwright install --with-deps chromium" "Run: playwright install --with-deps chromium"
) from exc ) from exc
try:
page = browser.new_page() page = browser.new_page()
page.add_init_script( page.add_init_script(
"""window.google = { """window.google = {
@ -388,6 +389,7 @@ class TestGenerateFormGooglePlaywright:
) )
page.locator("#admin-btn").wait_for(state="visible") page.locator("#admin-btn").wait_for(state="visible")
yield page yield page
finally:
browser.close() browser.close()
@pytest.mark.parametrize("width", [320, 375]) @pytest.mark.parametrize("width", [320, 375])