Speedometer 2.0: jQuery test fails occasionally
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2017 22:45:26 +0000 (22:45 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2017 22:45:26 +0000 (22:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176017

Patch by Shiyu Zhang <shiyu.zhang@intel.com> on 2017-08-30
Reviewed by Ryosuke Niwa.

Create a dummy node to notify that app is ready for jQuery suite. It prevents Speedometer injecting items before app.js is loaded.

* Speedometer/resources/tests.js:
(Suites.push.prepare):
* Speedometer/resources/todomvc/architecture-examples/jquery/js/app.js:
(jQuery.App.init):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221401 268f45cc-cd09-0410-ab3c-d52691b4dbfc

PerformanceTests/ChangeLog
PerformanceTests/Speedometer/resources/tests.js
PerformanceTests/Speedometer/resources/todomvc/architecture-examples/jquery/js/app.js

index e0aa16a..e3b9902 100644 (file)
@@ -1,3 +1,17 @@
+2017-08-30  Shiyu Zhang  <shiyu.zhang@intel.com>
+
+        Speedometer 2.0: jQuery test fails occasionally
+        https://bugs.webkit.org/show_bug.cgi?id=176017
+
+        Reviewed by Ryosuke Niwa.
+
+        Create a dummy node to notify that app is ready for jQuery suite. It prevents Speedometer injecting items before app.js is loaded.
+
+        * Speedometer/resources/tests.js:
+        (Suites.push.prepare):
+        * Speedometer/resources/todomvc/architecture-examples/jquery/js/app.js:
+        (jQuery.App.init):
+
 2017-08-25  Mathias Bynens  <mathias@qiwi.be>
 
         Speedometer: Restructure Ember example
index 70bc585..a52353a 100644 (file)
@@ -355,9 +355,10 @@ Suites.push({
     name: 'jQuery-TodoMVC',
     url: 'todomvc/architecture-examples/jquery/index.html',
     prepare: function (runner, contentWindow, contentDocument) {
-        return runner.waitForElement('#new-todo').then(function (element) {
-            element.focus();
-            return element;
+        return runner.waitForElement('#appIsReady').then(function (element) {
+            var newTodo = contentDocument.getElementById('new-todo');
+            newTodo.focus();
+            return newTodo;
         });
     },
     tests: [
index 23f4aea..f345d09 100644 (file)
@@ -46,6 +46,10 @@ jQuery(function ($) {
                     this.render();
                 }.bind(this)
             }).init('/all');
+
+            var dummyNodeToNotifyAppIsReady = document.createElement('div');
+            dummyNodeToNotifyAppIsReady.id = 'appIsReady';
+            document.body.appendChild(dummyNodeToNotifyAppIsReady);
         },
         bindEvents: function () {
             $('#new-todo').on('keyup', this.create.bind(this));