Files
TORCH/verification/verify_ack.py
T
google-labs-jules[bot]andPR0M3TH3AN ac7ba2a895 feat: add required acknowledgement warning to install copy button
- Adds a modal to `landing/index.html` warning users about the "freshly vibecoded" nature of the project.
- Intercepts the "Install via NPM" copy button to require acknowledgement before copying.
- Styles the modal with a danger theme consistent with the warning.
- Verified with Playwright.

Co-authored-by: PR0M3TH3AN <[email protected]>
2026-02-14 07:39:31 +00:00

64 lines
2.0 KiB
Python

from playwright.sync_api import sync_playwright, expect
def test_ack_modal():
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
# Grant clipboard permissions
context = browser.new_context(permissions=["clipboard-read", "clipboard-write"])
page = context.new_page()
page.on("console", lambda msg: print(f"Console: {msg.text}"))
try:
page.goto("http://localhost:8000/landing/index.html")
copy_btn = page.locator(".copy-install-btn")
ack_modal = page.locator("#ackModal")
# 1. Click Copy
print("Clicking Copy...")
copy_btn.click()
# 2. Verify Modal Appears
expect(ack_modal).to_be_visible()
print("Modal appeared.")
# Verify text is NOT copied yet (button text hasn't changed)
expect(copy_btn).not_to_have_text("Copied!", timeout=500)
print("Copy deferred.")
page.screenshot(path="verification/modal_visible.png")
# 3. Click Cancel
cancel_btn = page.locator("#ackModal .btn-cancel")
cancel_btn.click()
expect(ack_modal).not_to_be_visible()
expect(copy_btn).not_to_have_text("Copied!")
print("Cancelled correctly.")
# 4. Click Copy Again
copy_btn.click()
expect(ack_modal).to_be_visible()
# 5. Click Confirm
confirm_btn = page.locator("#ackModal .btn-confirm")
confirm_btn.click()
expect(ack_modal).not_to_be_visible()
expect(copy_btn).to_have_text("Copied!", timeout=2000)
print("Confirmed and copied.")
page.screenshot(path="verification/after_ack.png")
print("Verification successful.")
except Exception as e:
print(f"Verification failed: {e}")
page.screenshot(path="verification/failure.png")
raise e
finally:
browser.close()
if __name__ == "__main__":
test_ack_modal()