зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1310448 - Wait for narrate button to appear before starting tests. r=Gijs
MozReview-Commit-ID: 8MPzdZvAT1 --HG-- extra : rebase_source : 8b28455d6da601582252674d3092845857b1d0cf
This commit is contained in:
Родитель
a0f9171658
Коммит
b69aa4a817
|
@ -108,12 +108,10 @@ this.NarrateTestUtils = {
|
|||
});
|
||||
},
|
||||
|
||||
waitForVoiceOptions: function(window) {
|
||||
let options = window.document.querySelector(this.VOICE_OPTIONS);
|
||||
waitForNarrateToggle: function(window) {
|
||||
let toggle = window.document.querySelector(this.TOGGLE);
|
||||
return ContentTaskUtils.waitForCondition(
|
||||
() => {
|
||||
return options.childElementCount > 1;
|
||||
}, "voice select options populated.");
|
||||
() => !toggle.hidden, "");
|
||||
},
|
||||
|
||||
waitForPrefChange: function(pref) {
|
||||
|
|
|
@ -15,6 +15,8 @@ add_task(function* testNarrate() {
|
|||
let TEST_VOICE = "urn:moz-tts:fake-indirect:teresa";
|
||||
let $ = content.document.querySelector.bind(content.document);
|
||||
|
||||
yield NarrateTestUtils.waitForNarrateToggle(content);
|
||||
|
||||
let popup = $(NarrateTestUtils.POPUP);
|
||||
ok(!NarrateTestUtils.isVisible(popup), "popup is initially hidden");
|
||||
|
||||
|
@ -23,8 +25,6 @@ add_task(function* testNarrate() {
|
|||
|
||||
ok(NarrateTestUtils.isVisible(popup), "popup toggled");
|
||||
|
||||
yield NarrateTestUtils.waitForVoiceOptions(content);
|
||||
|
||||
let voiceOptions = $(NarrateTestUtils.VOICE_OPTIONS);
|
||||
ok(!NarrateTestUtils.isVisible(voiceOptions),
|
||||
"voice options are initially hidden");
|
||||
|
|
|
@ -14,7 +14,7 @@ add_task(function* testVoiceselectDropdownAutoclose() {
|
|||
yield spawnInNewReaderTab(TEST_ARTICLE, function* () {
|
||||
let $ = content.document.querySelector.bind(content.document);
|
||||
|
||||
yield NarrateTestUtils.waitForVoiceOptions(content);
|
||||
yield NarrateTestUtils.waitForNarrateToggle(content);
|
||||
|
||||
ok(!!$(".option[data-value='urn:moz-tts:fake-direct:bob']"),
|
||||
"Jamaican English voice available");
|
||||
|
@ -46,7 +46,7 @@ add_task(function* testVoiceselectDropdownAutoclose() {
|
|||
yield spawnInNewReaderTab(TEST_ITALIAN_ARTICLE, function* () {
|
||||
let $ = content.document.querySelector.bind(content.document);
|
||||
|
||||
yield NarrateTestUtils.waitForVoiceOptions(content);
|
||||
yield NarrateTestUtils.waitForNarrateToggle(content);
|
||||
|
||||
ok(!!$(".option[data-value='urn:moz-tts:fake-indirect:zanetta']"),
|
||||
"Italian voice available");
|
||||
|
|
|
@ -14,7 +14,7 @@ add_task(function* testVoiceselectDropdownAutoclose() {
|
|||
yield spawnInNewReaderTab(TEST_ARTICLE, function* () {
|
||||
let $ = content.document.querySelector.bind(content.document);
|
||||
|
||||
yield NarrateTestUtils.waitForVoiceOptions(content);
|
||||
yield NarrateTestUtils.waitForNarrateToggle(content);
|
||||
|
||||
$(NarrateTestUtils.TOGGLE).click();
|
||||
ok(NarrateTestUtils.isVisible($(NarrateTestUtils.POPUP)),
|
||||
|
@ -49,7 +49,7 @@ add_task(function* testVoiceselectLabelChange() {
|
|||
yield spawnInNewReaderTab(TEST_ARTICLE, function* () {
|
||||
let $ = content.document.querySelector.bind(content.document);
|
||||
|
||||
yield NarrateTestUtils.waitForVoiceOptions(content);
|
||||
yield NarrateTestUtils.waitForNarrateToggle(content);
|
||||
|
||||
$(NarrateTestUtils.TOGGLE).click();
|
||||
ok(NarrateTestUtils.isVisible($(NarrateTestUtils.POPUP)),
|
||||
|
@ -72,7 +72,7 @@ add_task(function* testVoiceselectKeyboard() {
|
|||
yield spawnInNewReaderTab(TEST_ARTICLE, function* () {
|
||||
let $ = content.document.querySelector.bind(content.document);
|
||||
|
||||
yield NarrateTestUtils.waitForVoiceOptions(content);
|
||||
yield NarrateTestUtils.waitForNarrateToggle(content);
|
||||
|
||||
$(NarrateTestUtils.TOGGLE).click();
|
||||
ok(NarrateTestUtils.isVisible($(NarrateTestUtils.POPUP)),
|
||||
|
|
|
@ -14,6 +14,8 @@ add_task(function* testNarrate() {
|
|||
yield spawnInNewReaderTab(TEST_ARTICLE, function* () {
|
||||
let $ = content.document.querySelector.bind(content.document);
|
||||
|
||||
yield NarrateTestUtils.waitForNarrateToggle(content);
|
||||
|
||||
let popup = $(NarrateTestUtils.POPUP);
|
||||
ok(!NarrateTestUtils.isVisible(popup), "popup is initially hidden");
|
||||
|
||||
|
@ -21,7 +23,6 @@ add_task(function* testNarrate() {
|
|||
toggle.click();
|
||||
|
||||
ok(NarrateTestUtils.isVisible(popup), "popup toggled");
|
||||
yield NarrateTestUtils.waitForVoiceOptions(content);
|
||||
|
||||
NarrateTestUtils.isStoppedState(content, ok);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче