WMDE-Fisch has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/315680

Change subject: Wait for pointers to finish moving in browsertests
......................................................................

Wait for pointers to finish moving in browsertests

This will avoid checking pointer data prematurely when
they are still moving and the diff was not reloaded yet.

Change-Id: I3c29a43940e40b7c338a00b3520e5aa6b237ea4a
---
M tests/browser/features/pointers.feature
M tests/browser/features/support/pages/diff_page.rb
M tests/browser/features/support/step_definitions/pointers.rb
3 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/RevisionSlider 
refs/changes/80/315680/1

diff --git a/tests/browser/features/pointers.feature 
b/tests/browser/features/pointers.feature
index 6f812e8..4cf45fd 100644
--- a/tests/browser/features/pointers.feature
+++ b/tests/browser/features/pointers.feature
@@ -37,6 +37,7 @@
     And I wait until the diff has loaded
     And I click on revision 1 to move the upper pointer
     And I wait until the diff has loaded
+    And I wait until the pointers stopped moving
     Then the lower pointer should be on revision 1
     And the upper pointer should be on revision 3
     And revision 1 should be loaded on the left of the diff
diff --git a/tests/browser/features/support/pages/diff_page.rb 
b/tests/browser/features/support/pages/diff_page.rb
index 1dc11d7..b483c2f 100644
--- a/tests/browser/features/support/pages/diff_page.rb
+++ b/tests/browser/features/support/pages/diff_page.rb
@@ -59,6 +59,18 @@
     true
   end
 
+  def wait_for_animations
+    sleep_period = 0.25
+    max_timeout_seconds = 2
+    timeout_loops = (max_timeout_seconds / sleep_period).to_i
+
+    while execute_script('return $(\':animated\').length') != 0 && 
timeout_loops > 0
+      sleep(sleep_period)
+      timeout_loops -= 1
+    end
+    true
+  end
+
   def wait_for_diff_to_load
     wait_until do
       !revisionslider_loading?
diff --git a/tests/browser/features/support/step_definitions/pointers.rb 
b/tests/browser/features/support/step_definitions/pointers.rb
index d73073f..d1e714b 100644
--- a/tests/browser/features/support/step_definitions/pointers.rb
+++ b/tests/browser/features/support/step_definitions/pointers.rb
@@ -26,6 +26,10 @@
   step 'the diff has loaded'
 end
 
+When(/^I wait until the pointers stopped moving$/) do
+  on(DiffPage).wait_for_animations
+end
+
 Then(/^revision (\d+) should be loaded on the left of the diff$/) do |index|
   expect(on(DiffPage).revisionslider_left_summary_element.text).to include 
"RS-Summary-" + index.to_s
 end

-- 
To view, visit https://gerrit.wikimedia.org/r/315680
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c29a43940e40b7c338a00b3520e5aa6b237ea4a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/RevisionSlider
Gerrit-Branch: master
Gerrit-Owner: WMDE-Fisch <christoph.jau...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to