MCPcopy Create free account
hub / github.com/TheCSir/TerminalStart / run

Function run

tests/e2e/verify_widgets.py:5–111  ·  view source on GitHub ↗
(playwright)

Source from the content-addressed store, hash-verified

3import time
4
5def run(playwright):
6 browser = playwright.chromium.launch(headless=True)
7 context = browser.new_context()
8 page = context.new_page()
9
10 # 1. Open the app
11 print("Navigating to app...")
12 page.goto("http://localhost:5173/")
13 time.sleep(2) # Wait for load animation
14
15 # 2. Open Settings
16 print("Opening settings...")
17 settings_trigger = page.locator("text=( settings )")
18 settings_trigger.hover()
19 settings_trigger.click()
20 time.sleep(1)
21
22 # 3. Go to Widgets tab
23 print("Switching to Widgets tab...")
24 page.get_by_role("button", name="widgets").click()
25 time.sleep(1)
26
27 # 4. Find Snake widget toggle and double click
28 print("Double clicking Snake widget...")
29 snake_toggle = page.get_by_text("snake", exact=True).first
30 snake_toggle.dblclick()
31 time.sleep(1)
32
33 # 5. Verify Modal and Click YES
34 print("Verifying modal...")
35 modal = page.locator("text=Add another 'snake'?")
36 expect(modal).to_be_visible()
37
38 print("Clicking YES...")
39 page.get_by_role("button", name="[ YES ]").click()
40 time.sleep(1)
41
42 # 6. Verify duplicate toggle in settings
43 print("Verifying duplicate toggle in settings...")
44 extra_snake_toggle = page.get_by_text("snake (extra)")
45 expect(extra_snake_toggle).to_be_visible()
46
47 # 7. Close settings
48 print("Closing settings...")
49 page.get_by_role("button", name="[x]").click()
50 time.sleep(1)
51
52 # 8. Verify two snake widgets on grid with Correct Titles
53 print("Verifying widgets on grid...")
54
55 # First snake should be "snake.exe"
56 first_snake = page.locator("div.drag-handle:has-text('snake.exe')").first
57 expect(first_snake).to_be_visible()
58
59 # Second snake should be "snake2.exe"
60 second_snake = page.locator("div.drag-handle:has-text('snake2.exe')")
61 expect(second_snake).to_be_visible()
62

Callers 1

verify_widgets.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected