-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_script.py
More file actions
36 lines (27 loc) · 1018 Bytes
/
verify_script.py
File metadata and controls
36 lines (27 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from playwright.sync_api import sync_playwright
import sys
import os
def run_verification():
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
cwd = os.getcwd()
page.goto(f"file://{cwd}/verification.html")
# Click the run button
page.click("button[onclick='runAllTests()']")
# Wait for summary to have text
page.wait_for_function("document.getElementById('summary').innerText.includes('Concluído')")
# Get result
summary_text = page.inner_text("#summary")
print(summary_text)
# Check for failures
failures = page.locator(".status.fail").count()
browser.close()
if failures > 0:
print(f"FAILED: {failures} tests failed.")
sys.exit(1)
else:
print("SUCCESS: All tests passed.")
sys.exit(0)
if __name__ == "__main__":
run_verification()