summaryrefslogtreecommitdiffstats
path: root/toolkit/components/narrate/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:14:29 +0000
commitfbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch)
tree4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /toolkit/components/narrate/test
parentReleasing progress-linux version 124.0.1-1~progress7.99u1. (diff)
downloadfirefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz
firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip
Merging upstream version 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();