Bug 1625246 - Make tabindex-focus-flag.html wait load event first before starting tests; r=smaug
authorEdgar Chen <echen@mozilla.com>
Thu, 26 Mar 2020 18:29:31 +0000
changeset 520669 fadc1360393f5eb5e2fa563e171d4cd13d99622d
parent 520668 5cbd560d875d4883cf7144ae0342729e9407f9aa
child 520670 2d758b42bd735b4892c64bd54823bd9412c925d2
push id111239
push userechen@mozilla.com
push dateThu, 26 Mar 2020 22:34:37 +0000
treeherderautoland@fadc1360393f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1625246
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1625246 - Make tabindex-focus-flag.html wait load event first before starting tests; r=smaug Found an issue while running this test on Firefox automation server: test tries to focus iframe before the iframe is ready to be focused. We should wait for load event to ensure page is ready for testings. Differential Revision: https://phabricator.services.mozilla.com/D68430
testing/web-platform/meta/html/interaction/focus/tabindex-focus-flag.html.ini
testing/web-platform/tests/html/interaction/focus/tabindex-focus-flag.html
deleted file mode 100644
--- a/testing/web-platform/meta/html/interaction/focus/tabindex-focus-flag.html.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[tabindex-focus-flag.html]
-  [iframe should be focusable by default.]
-    expected:
-      if (os == 'win' and processor == 'aarch64'): PASS
-      FAIL
-
--- a/testing/web-platform/tests/html/interaction/focus/tabindex-focus-flag.html
+++ b/testing/web-platform/tests/html/interaction/focus/tabindex-focus-flag.html
@@ -12,51 +12,62 @@
 <select><option>abc</option></select>
 <textarea></textarea>
 <summary id="summary-out"></summary>
 <details open><summary id="summary-first"></summary><summary id="summary-second"></summary></details>
 <div contenteditable="true"></div>
 <iframe></iframe>
 </div>
 <script>
-const defaultList = [
-  ['a', false],
-  ['a[href]', true],
-  ['button', true],
-  ['input[type="hidden"]', false],
-  ['input[type="button"]', true],
-  ['select', true],
-  ['textarea', true],
-  ['#summary-out', false],
-  ['#summary-first', true],
-  ['#summary-second', false],
-  ['[contenteditable]', true],
-  ['iframe', true],
-];
-for (entry of defaultList) {
-  test(() => {
-    var element = document.querySelector('#default-samples ' + entry[0]);
-    element.focus();
-    if (entry[1])
-      assert_equals(document.activeElement, element);
-    else
-      assert_not_equals(document.activeElement, element);
-  }, entry[0] + ' should ' + (entry[1] ? '' : 'not ') + 'be focusable by default.');
+setup({ explicit_done: true });
+window.addEventListener("load", runTests);
+
+function runTests() {
+  const defaultList = [
+    ['a', false],
+    ['a[href]', true],
+    ['button', true],
+    ['input[type="hidden"]', false],
+    ['input[type="button"]', true],
+    ['select', true],
+    ['textarea', true],
+    ['#summary-out', false],
+    ['#summary-first', true],
+    ['#summary-second', false],
+    ['[contenteditable]', true],
+    ['iframe', true],
+  ];
+  for (entry of defaultList) {
+    test(() => {
+      var element = document.querySelector('#default-samples ' + entry[0]);
+      element.focus();
+      if (entry[1])
+        assert_equals(document.activeElement, element);
+      else
+        assert_not_equals(document.activeElement, element);
+    }, entry[0] + ' should ' + (entry[1] ? '' : 'not ') + 'be focusable by default.');
+  }
+
+  runTests_tabindex0();
 }
 </script>
 
 <div id="tabindex-0">
 <a tabindex="0"></a>
 <summary tabindex="0" id="summary-out-tabindex0"></summary>
 <details open><summary id="summary-first"></summary><summary tabindex="0" id="summary-second-tabindex0"></summary></details>
 </div>
 <script>
-for (element of document.querySelectorAll('#tabindex-0 [tabindex]')) {
-  var elementDesc = element.tagName;
-  if (element.id)
-    elementDesc += '#' + element.id;
-  test(() => {
-    element.focus();
-    assert_equals(document.activeElement, element);
-  }, elementDesc + ' with tabindex=0 should be focusable.');
+function runTests_tabindex0() {
+  for (element of document.querySelectorAll('#tabindex-0 [tabindex]')) {
+    var elementDesc = element.tagName;
+    if (element.id)
+      elementDesc += '#' + element.id;
+    test(() => {
+      element.focus();
+      assert_equals(document.activeElement, element);
+    }, elementDesc + ' with tabindex=0 should be focusable.');
+  }
+
+  done();
 }
 </script>
 </body>