Speedometer 2.0: Add dummy node to notify app is ready for Backbone suite
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Sep 2017 08:17:25 +0000 (08:17 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Sep 2017 08:17:25 +0000 (08:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=176142

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

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

* Speedometer/resources/tests.js:
(Suites.push.prepare):
* Speedometer/resources/todomvc/architecture-examples/backbone/js/app.js:

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

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

index e3b9902..617ba40 100644 (file)
@@ -1,3 +1,16 @@
+2017-09-05  Shiyu Zhang  <shiyu.zhang@intel.com>
+
+        Speedometer 2.0: Add dummy node to notify app is ready for Backbone suite
+        https://bugs.webkit.org/show_bug.cgi?id=176142
+
+        Reviewed by Ryosuke Niwa.
+
+        Create a dummy node to notify that app is ready for Backbone suite. It prevents Speedometer injecting items before app.js is loaded.
+
+        * Speedometer/resources/tests.js:
+        (Suites.push.prepare):
+        * Speedometer/resources/todomvc/architecture-examples/backbone/js/app.js:
+
 2017-08-30  Shiyu Zhang  <shiyu.zhang@intel.com>
 
         Speedometer 2.0: jQuery test fails occasionally
index a52353a..c8261e3 100644 (file)
@@ -227,9 +227,10 @@ Suites.push({
     url: 'todomvc/architecture-examples/backbone/index.html',
     prepare: function (runner, contentWindow, contentDocument) {
     contentWindow.Backbone.sync = function () {}
-        return runner.waitForElement('.new-todo').then(function (element) {
-            element.focus();
-            return element;
+        return runner.waitForElement('#appIsReady').then(function (element) {
+            var newTodo = contentDocument.querySelector('.new-todo');
+            newTodo.focus();
+            return newTodo;
         });
     },
     tests: [
@@ -241,12 +242,12 @@ Suites.push({
         }),
         new BenchmarkTestStep('CompletingAllItems', function (newTodo, contentWindow, contentDocument) {
             var checkboxes = contentDocument.querySelectorAll('.toggle');
-            for (var i = 0; i < checkboxes.length; i++)
+            for (var i = 0; i < numberOfItemsToAdd; i++)
                 checkboxes[i].click();
         }),
         new BenchmarkTestStep('DeletingAllItems', function (newTodo, contentWindow, contentDocument) {
             var deleteButtons = contentDocument.querySelectorAll('.destroy');
-            for (var i = 0; i < deleteButtons.length; i++)
+            for (var i = 0; i < numberOfItemsToAdd; i++)
                 deleteButtons[i].click();
         }),
     ]
index 1e139d3..4c4bde3 100644 (file)
@@ -9,4 +9,8 @@ $(function () {
 
     // kick things off by creating the `App`
     window.appView = new app.AppView();
+
+    var dummyNodeToNotifyAppIsReady = document.createElement('div');
+    dummyNodeToNotifyAppIsReady.id = 'appIsReady';
+    document.body.appendChild(dummyNodeToNotifyAppIsReady);
 });