Skip to content

Commit 2a1cea7

Browse files
Refresh Studio screenshots for the 1.6.0 UI (docs + website)
1 parent e5ee459 commit 2a1cea7

11 files changed

Lines changed: 101 additions & 0 deletions

File tree

-32.3 KB
Loading
5.54 KB
Loading
219 Bytes
Loading
785 Bytes
Loading
-1.33 KB
Loading
-33.1 KB
Loading
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
"""Regenerate the Circuit-mode and Where-mode documentation screenshots.
2+
3+
Boots Studio on a database named `demo` (which must exist with the
4+
provsql extension and the upstream `personnel` fixture loaded -- i.e.
5+
test/sql/setup.sql + test/sql/add_provenance.sql), runs the Paris
6+
personnel query in each mode and captures into
7+
doc/source/_static/studio/:
8+
9+
circuit-mode.png the provenance circuit of a pinned result row with
10+
the input-gate inspector open
11+
where-mode.png the where-provenance highlight of a pinned result
12+
cell against the source table
13+
14+
Run from studio/ with the dev venv (playwright + chromium installed):
15+
16+
.venv/bin/python scripts/circuit_where_doc_shot.py
17+
18+
The viewport (1920x976, scale 1) matches the other full-page Studio
19+
shots (contributions-mode.png, notebook-mode.png).
20+
"""
21+
import subprocess
22+
import sys
23+
import time
24+
import urllib.request
25+
from pathlib import Path
26+
27+
from playwright.sync_api import expect, sync_playwright
28+
29+
REPO = Path(__file__).resolve().parents[2]
30+
OUT = REPO / "doc" / "source" / "_static" / "studio"
31+
PORT = 8076
32+
URL = f"http://127.0.0.1:{PORT}"
33+
34+
# A DISTINCT query collapses the three Paris rows into one answer whose
35+
# provenance is a plus (the caption's "DISTINCT-circuit / plus-rooted DAG").
36+
CIRCUIT_Q = "SELECT DISTINCT city FROM personnel WHERE city = 'Paris';"
37+
WHERE_Q = ("SELECT name, position, city, classification\n"
38+
"FROM personnel WHERE city = 'Paris';")
39+
40+
server = subprocess.Popen(
41+
[sys.executable, "-m", "provsql_studio",
42+
"--host", "127.0.0.1", "--port", str(PORT),
43+
"--dsn", "dbname=demo", "--search-path", "public",
44+
"--ignore-version"],
45+
stdout=open("/tmp/circuit_where_doc_shot_server.log", "wb"),
46+
stderr=subprocess.STDOUT,
47+
)
48+
try:
49+
for _ in range(100):
50+
try:
51+
urllib.request.urlopen(URL, timeout=1)
52+
break
53+
except Exception:
54+
time.sleep(0.2)
55+
else:
56+
sys.exit("server did not come up; "
57+
"see /tmp/circuit_where_doc_shot_server.log")
58+
59+
with sync_playwright() as p:
60+
browser = p.chromium.launch()
61+
page = browser.new_page(viewport={"width": 1920, "height": 976})
62+
63+
# --- Circuit mode ---
64+
page.goto(URL + "/circuit")
65+
expect(page.locator("body")).to_have_class(
66+
"mode-circuit", timeout=15000)
67+
page.locator("#request").fill(CIRCUIT_Q)
68+
page.locator("#run-btn").click()
69+
expect(page.locator("#result-count")).to_have_text("1", timeout=15000)
70+
# Pin the result row's provsql cell to render its plus-rooted DAG.
71+
page.locator("#result-body tr").first.locator("td").last.click()
72+
svg = page.locator("#sidebar-body svg").first
73+
expect(svg).to_be_visible(timeout=15000)
74+
# Pin an input gate (leaf) to open the inspector on a base tuple.
75+
page.locator("#sidebar-body svg .node-group.node--input").first.click()
76+
expect(page.locator("#inspector")).to_be_visible(timeout=8000)
77+
page.wait_for_timeout(400)
78+
page.screenshot(path=str(OUT / "circuit-mode.png"))
79+
print("circuit-mode.png")
80+
81+
# --- Where mode ---
82+
page.goto(URL + "/where")
83+
expect(page.locator("body")).to_have_class("mode-where", timeout=15000)
84+
page.locator("#request").fill(WHERE_Q)
85+
page.locator("#run-btn").click()
86+
expect(page.locator("#result-count")).to_have_text("3", timeout=15000)
87+
# Pin the first result cell to highlight its where-provenance.
88+
first_cell = page.locator("#result-body tr").first.locator("td").first
89+
first_cell.click()
90+
page.wait_for_timeout(400)
91+
page.screenshot(path=str(OUT / "where-mode.png"))
92+
print("where-mode.png")
93+
94+
browser.close()
95+
finally:
96+
server.terminate()
97+
try:
98+
server.wait(timeout=5)
99+
except subprocess.TimeoutExpired:
100+
server.kill()
101+
server.wait()
-127 KB
Loading
5.54 KB
Loading
-141 KB
Loading

0 commit comments

Comments
 (0)