Skip to content

Commit b8046c2

Browse files
test(e2e): multi-worker server + robust compare wait — kills full-suite flakiness (#221)
The full e2e suite (e2e-full.yml, self-hosted with models) ran the 13 Playwright tests against the single-worker demo app, so back-to-back heavy requests queued and timed out. Fixes: - e2e-full.yml starts a dedicated 4-worker uvicorn on :8011 (isolated from the live :8000 demo), waits for readiness, runs the suite, and tears it down. - test_compare_loads_and_loaders_clear waited for the FIRST card image then a fixed 500ms before asserting BOTH images visible; the second card lags under load. Now polls for two non-loading cards with images (no fixed sleep). Validated locally against a 4-worker server: 13/13 passed, twice, ~30s. Closes #212. Signed-off-by: Austin L. <86896075+rvnminers-A-and-N@users.noreply.github.com>
1 parent b2c76b5 commit b8046c2

2 files changed

Lines changed: 22 additions & 4 deletions

File tree

.github/workflows/e2e-full.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,22 @@ jobs:
2525
run: |
2626
python -m pip install --quiet pytest playwright
2727
python -m playwright install chromium || true
28-
- name: Full suite against the running app (all models loaded)
28+
- name: Start a dedicated multi-worker test server
29+
# A dedicated 4-worker server (the box is 32-core) so the 13 back-to-back Playwright
30+
# tests don't queue behind a single worker and time out. Isolated on :8011 so it never
31+
# disturbs the live demo app on :8000. Each worker loads its own copy of the models.
32+
working-directory: training
33+
run: |
34+
nohup python -m uvicorn app:app --host 127.0.0.1 --port 8011 --workers 4 \
35+
> /tmp/flavor-e2e-app.log 2>&1 &
36+
for i in $(seq 1 60); do
37+
curl -sf http://127.0.0.1:8011/api/studio_terms >/dev/null && { echo "app up"; break; }
38+
sleep 2
39+
done
40+
- name: Full suite against the multi-worker server (all models loaded)
2941
env:
30-
FLAVORMANCER_URL: http://127.0.0.1:8000
42+
FLAVORMANCER_URL: http://127.0.0.1:8011
3143
run: pytest tests/e2e -q
44+
- name: Stop the test server
45+
if: always()
46+
run: pkill -f "uvicorn app:app.*8011" || true

tests/e2e/test_workbench_e2e.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ def test_formulation_studio_starter(page, base_url, needs_models):
7171
def test_compare_loads_and_loaders_clear(page, base_url, needs_models):
7272
_open(page, base_url)
7373
page.locator(".cmp-ex", has_text="vanillin vs").click()
74-
page.wait_for_selector("#cmpResults .cmp-card:not(.loading) img", timeout=30000)
75-
page.wait_for_timeout(500)
74+
# wait for BOTH comparison cards to finish loading (not just the first) — the second can lag
75+
# under load, so poll for the pair of non-loading cards with images rather than a fixed sleep
76+
page.wait_for_function(
77+
"document.querySelectorAll('#cmpResults .cmp-card:not(.loading) img').length === 2",
78+
timeout=30000)
7679
assert page.locator("#cmpResults .cmp-card img:visible").count() == 2
7780
assert page.locator("#cmpResults .cmp-load:visible").count() == 0, "loaders must clear after load"
7881

0 commit comments

Comments
 (0)