aboutsummaryrefslogtreecommitdiff
path: root/lib/project/tests/test_gui_browser.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-09-12 21:18:34 -0400
committerhistoria <historiavg@proton.me>2026-09-12 21:18:34 -0400
commit544134f0534d2e4e4fd7ab823d8a0da543fa80ef (patch)
treeef0f787b6377608b3814ac642804e8c778980ddf /lib/project/tests/test_gui_browser.py
parent0cd53b67793e74e8be0201b90711cb51b7186d6e (diff)
downloadproducer-544134f0534d2e4e4fd7ab823d8a0da543fa80ef.tar.gz
fix: output wavs from gui go into correct directory
Diffstat (limited to 'lib/project/tests/test_gui_browser.py')
-rw-r--r--lib/project/tests/test_gui_browser.py39
1 files changed, 24 insertions, 15 deletions
diff --git a/lib/project/tests/test_gui_browser.py b/lib/project/tests/test_gui_browser.py
index 5edc114..31a7c37 100644
--- a/lib/project/tests/test_gui_browser.py
+++ b/lib/project/tests/test_gui_browser.py
@@ -70,7 +70,7 @@ def test_gui_browser_real_workflow(studio):
screenshots.mkdir(parents=True, exist_ok=True)
before = hashlib.sha256(studio["source"].read_bytes()).hexdigest()
with sync_playwright() as playwright:
- browser = playwright.chromium.launch(headless=True, args=["--no-sandbox"])
+ browser = playwright.chromium.launch(headless=True, channel=os.environ.get("PRODUCER_BROWSER_CHANNEL") or None, args=["--no-sandbox"])
context = browser.new_context(viewport={"width": 1360, "height": 1000}, accept_downloads=True)
page = context.new_page()
errors, console_errors, media_requests = [], [], []
@@ -173,22 +173,31 @@ def test_gui_browser_real_workflow(studio):
page.locator("#output-dir").fill(str(studio["root"] / "delivery"))
preview_requests = len(media_requests)
page.locator("#prepare-export").click()
- expect(page.locator("#export-dialog")).to_be_visible()
- expect(page.locator("#export-pacing")).to_contain_text("NOT auditioned")
- expect(page.locator("#export-summary")).to_contain_text("whole original 00:00:08")
- page.locator("#confirm-export").click()
+ # Audio is written directly into the chosen output directory; no
+ # pacing dialog exists anymore, and nothing exists to overwrite yet.
expect(page.locator("#export-results")).to_contain_text("Full recording exported", timeout=30000)
- outputs = list((studio["root"] / "delivery").glob("producer-export-*"))
- assert len(outputs) == 1
- assert (outputs[0] / "master.wav").is_file() and (outputs[0] / "master.mp3").is_file()
- assert (outputs[0] / "logs/master.report.json").is_file()
+ assert (studio["root"] / "delivery" / "Narration.custom.wav").is_file()
+ assert (studio["root"] / "delivery" / "Narration.custom.mp3").is_file()
+ reports = list((studio["root"] / "producer-root" / "logs").glob("Narration.custom.*.report.json"))
+ assert len(reports) == 1
import soundfile as sf
- assert sf.info(outputs[0] / "master.wav").duration == pytest.approx(8, abs=.01)
+ assert sf.info(studio["root"] / "delivery" / "Narration.custom.wav").duration == pytest.approx(8, abs=.01)
assert len(media_requests) == preview_requests, "Full exports must not be fetched into browser blobs"
+ # A second export targets the same audio file: the browser asks, and
+ # the red Overwrite confirmation replaces it.
page.locator("#prepare-export").click()
- page.locator("#confirm-export").click()
- expect(page.locator("#export-results .export-result")).to_have_count(2, timeout=30000)
- assert len(list((studio["root"] / "delivery").glob("producer-export-*"))) == 2
+ expect(page.locator("#overwrite-dialog")).to_be_visible()
+ expect(page.locator("#overwrite-paths")).to_contain_text("Narration.custom.wav")
+ page.locator("#overwrite-confirm").click()
+ # Only the latest export stays on display; a new one replaces the card.
+ expect(page.locator("#export-results .export-result")).to_have_count(1, timeout=30000)
+ # The replaced export also leaves its own timestamped report.
+ deadline = time.monotonic() + 30
+ while time.monotonic() < deadline and len(list((studio["root"] / "producer-root" / "logs").glob("Narration.custom.*.report.json"))) < 2:
+ time.sleep(0.2)
+ assert (studio["root"] / "delivery" / "Narration.custom.wav").is_file()
+ assert not list((studio["root"] / "delivery").glob("producer-export-*"))
+ assert len(list((studio["root"] / "producer-root" / "logs").glob("Narration.custom.*.report.json"))) == 2
assert hashlib.sha256(studio["source"].read_bytes()).hexdigest() == before
page.locator("#compare").scroll_into_view_if_needed()
page.screenshot(path=str(screenshots / "desktop-comparison.png"), full_page=True)
@@ -198,7 +207,7 @@ def test_gui_browser_real_workflow(studio):
expect(page.locator("#workspace")).not_to_have_attribute("disabled", "")
expect(page.locator("#comparisons")).to_contain_text("Gentle <snapshot>")
expect(page.locator("#play")).to_be_disabled()
- expect(page.locator("#export-results .export-result")).to_have_count(2, timeout=15000)
+ expect(page.locator("#export-results .export-result")).to_have_count(1, timeout=15000)
page.set_viewport_size({"width": 390, "height": 844})
page.screenshot(path=str(screenshots / "mobile-studio.png"), full_page=True)
page.evaluate("window.scrollTo(0, 0)")
@@ -214,7 +223,7 @@ def test_gui_browser_long_overview(studio):
from playwright.sync_api import sync_playwright, expect
with sync_playwright() as playwright:
- browser = playwright.chromium.launch(headless=True, args=["--no-sandbox"])
+ browser = playwright.chromium.launch(headless=True, channel=os.environ.get("PRODUCER_BROWSER_CHANNEL") or None, args=["--no-sandbox"])
page = browser.new_page(viewport={"width": 1200, "height": 900})
requests, errors = [], []
page.on("request", lambda request: requests.append(request.url))