summaryrefslogtreecommitdiffstats
path: root/toolkit/components/narrate/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /toolkit/components/narrate/test
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/narrate/test')
-rw-r--r--toolkit/components/narrate/test/browser_narrate_toggle.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/toolkit/components/narrate/test/browser_narrate_toggle.js b/toolkit/components/narrate/test/browser_narrate_toggle.js
index 54de276001..a7713f01b1 100644
--- a/toolkit/components/narrate/test/browser_narrate_toggle.js
+++ b/toolkit/components/narrate/test/browser_narrate_toggle.js
@@ -4,6 +4,8 @@
// This test verifies that the keyboard shortcut "n" will Start/Stop the
// narration of an article in readermode when the article is in focus.
+// This test also verifies that the keyboard shortcut "←" (left arrow) will
+// skip the narration backward, while "→" (right arrow) skips it forward.
registerCleanupFunction(teardown);
@@ -11,18 +13,39 @@ add_task(async function testToggleNarrate() {
setup();
await spawnInNewReaderTab(TEST_ARTICLE, async function () {
+ let TEST_VOICE = "urn:moz-tts:fake:teresa";
let $ = content.document.querySelector.bind(content.document);
+ let prefChanged = NarrateTestUtils.waitForPrefChange("narrate.voice");
+ NarrateTestUtils.selectVoice(content, TEST_VOICE);
+ await prefChanged;
+
await NarrateTestUtils.waitForNarrateToggle(content);
let eventUtils = NarrateTestUtils.getEventUtils(content);
NarrateTestUtils.isStoppedState(content, ok);
+ let promiseEvent = ContentTaskUtils.waitForEvent(content, "paragraphstart");
$(NarrateTestUtils.TOGGLE).focus();
eventUtils.synthesizeKey("n", {}, content);
+ let speechinfo = (await promiseEvent).detail;
+ let paragraph = speechinfo.paragraph;
+
+ NarrateTestUtils.isStartedState(content, ok);
+
+ promiseEvent = ContentTaskUtils.waitForEvent(content, "paragraphstart");
+ eventUtils.synthesizeKey("KEY_ArrowRight", {}, content);
+ speechinfo = (await promiseEvent).detail;
+ isnot(speechinfo.paragraph, paragraph, "next paragraph is being spoken");
+
+ NarrateTestUtils.isStartedState(content, ok);
+
+ promiseEvent = ContentTaskUtils.waitForEvent(content, "paragraphstart");
+ eventUtils.synthesizeKey("KEY_ArrowLeft", {}, content);
+ speechinfo = (await promiseEvent).detail;
+ is(speechinfo.paragraph, paragraph, "first paragraph being spoken");
- await ContentTaskUtils.waitForEvent(content, "paragraphstart");
NarrateTestUtils.isStartedState(content, ok);
$(NarrateTestUtils.TOGGLE).focus();