feat: add voice-to-draft mobile capture (Closes #929)
This commit is contained in:
1 parent
9adfcd01b6
commit
3b4bb618dd
9 files changed
+346
-4
No files matched your search
@@ -24,7 +24,7 @@ from fake_gitea import FakeGiteaServer
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[2]
|
||||
TITLE = "Offline artifact journey 863"
|
||||
TITLE = "Offline artifact journey 863."
|
||||
BODY = "Captured on a phone, retained offline, delivered exactly once."
|
||||
ACCESS_TOKEN = "artifact-browser-access-token-863"
|
||||
|
||||
@@ -148,6 +148,14 @@ def test_release_artifact_files_one_mobile_issue_exactly_once_after_offline_relo
|
||||
service_workers="allow",
|
||||
ignore_https_errors=True,
|
||||
)
|
||||
context.add_init_script("""
|
||||
class DeterministicSpeechRecognition {
|
||||
start() { window.__voiceRecognition = this; }
|
||||
stop() { if (this.onend) this.onend(); }
|
||||
abort() { if (this.onend) this.onend(); }
|
||||
}
|
||||
window.SpeechRecognition = DeterministicSpeechRecognition;
|
||||
""")
|
||||
page = context.new_page()
|
||||
page.on("pageerror", lambda error: browser_errors.append(error.stack or str(error)))
|
||||
page.on("console", lambda message: browser_errors.append(message.text) if message.type == "error" else None)
|
||||
@@ -178,8 +186,18 @@ def test_release_artifact_files_one_mobile_issue_exactly_once_after_offline_relo
|
||||
assert page.evaluate("() => navigator.serviceWorker.controller !== null")
|
||||
|
||||
new_action.click()
|
||||
page.locator("#create-issue-title").fill(TITLE)
|
||||
page.locator("#create-issue-body").fill(BODY)
|
||||
expect(page.locator("#voice-issue-capture")).to_be_visible()
|
||||
page.locator("#start-voice-issue-capture").click()
|
||||
page.evaluate("""([title, body]) => {
|
||||
const result = [{ transcript: title + ' ' + body }];
|
||||
result.isFinal = true;
|
||||
window.__voiceRecognition.onresult({ results: [result] });
|
||||
}""", [TITLE, BODY])
|
||||
expect(page.locator("#voice-issue-review")).to_be_visible()
|
||||
expect(page.locator("#append-voice-issue-transcript")).to_have_text("Use transcript")
|
||||
page.locator("#append-voice-issue-transcript").click()
|
||||
expect(page.locator("#create-issue-title")).to_have_value(TITLE)
|
||||
expect(page.locator("#create-issue-body")).to_have_value(BODY)
|
||||
page.locator("#file-new-issue").click()
|
||||
expect(page.locator("#create-issue-filing")).to_be_visible()
|
||||
page.locator("#create-issue-repository").select_option("acme/mobile")
|
||||
|
||||
Reference in new issue
Block a user