2016-06-27 12:38:23 +00:00
|
|
|
class DiffPage
|
|
|
|
include PageObject
|
|
|
|
|
2017-02-28 12:03:53 +00:00
|
|
|
link(:differences_prevlink, id: 'differences-prevlink')
|
|
|
|
link(:differences_nextlink, id: 'differences-nextlink')
|
2017-02-02 17:24:51 +00:00
|
|
|
|
2016-07-02 20:14:00 +00:00
|
|
|
p(:revisionslider_placeholder, css: '.mw-revslider-placeholder')
|
2018-06-29 07:49:09 +00:00
|
|
|
p(:revisionslider_slider, css: '.mw-revslider-revision-slider')
|
2016-07-02 20:14:00 +00:00
|
|
|
div(:revisionslider_wrapper, css: '.mw-revslider-slider-wrapper')
|
2017-03-22 13:13:01 +00:00
|
|
|
span(:revisionslider_auto_expand_button, css: '.mw-revslider-auto-expand-button')
|
|
|
|
span(:revisionslider_toggle_button, css: '.mw-revslider-toggle-button')
|
2016-07-02 20:17:40 +00:00
|
|
|
table(:revisionslider_loading, css: '.mw-revslider-diff-loading')
|
2016-07-02 20:14:00 +00:00
|
|
|
|
2017-03-16 14:53:39 +00:00
|
|
|
div(:revisionslider_help_dialog, css: '.mw-revslider-help-dialog')
|
2016-07-02 20:14:00 +00:00
|
|
|
button(:revisionslider_help, css: '.mw-revision-slider-container > button')
|
2017-03-16 14:53:39 +00:00
|
|
|
link(:revisionslider_help_next, css: '.mw-revslider-help-next > a')
|
|
|
|
link(:revisionslider_help_previous, css: '.mw-revslider-help-previous > a')
|
|
|
|
link(:revisionslider_help_close_start, css: '.mw-revslider-help-close-start > a')
|
|
|
|
link(:revisionslider_help_close_end, css: '.mw-revslider-help-close-end > a')
|
2016-06-29 10:52:05 +00:00
|
|
|
|
2017-03-22 13:13:01 +00:00
|
|
|
span(:revisionslider_timeline_backwards, css: '.mw-revslider-arrow.mw-revslider-arrow-backwards:not(.oo-ui-widget-disabled)')
|
|
|
|
span(:revisionslider_timeline_forwards, css: '.mw-revslider-arrow.mw-revslider-arrow-forwards:not(.oo-ui-widget-disabled)')
|
2016-10-12 09:00:14 +00:00
|
|
|
|
2017-03-22 13:13:01 +00:00
|
|
|
span(:revisionslider_timeline_backwards_disabled, css: '.mw-revslider-arrow.mw-revslider-arrow-backwards.oo-ui-widget-disabled')
|
|
|
|
span(:revisionslider_timeline_forwards_disabled, css: '.mw-revslider-arrow.mw-revslider-arrow-forwards.oo-ui-widget-disabled')
|
2016-07-04 14:43:47 +00:00
|
|
|
|
2017-07-11 08:17:24 +00:00
|
|
|
div(:revisionslider_pointer_older, css: '.mw-revslider-pointer-older')
|
|
|
|
div(:revisionslider_pointer_newer, css: '.mw-revslider-pointer-newer')
|
2016-07-04 18:22:22 +00:00
|
|
|
|
|
|
|
div(:revisionslider_left_summary, id: 'mw-diff-otitle3')
|
|
|
|
div(:revisionslider_right_summary, id: 'mw-diff-ntitle3')
|
|
|
|
|
2016-07-04 16:26:13 +00:00
|
|
|
def revisionslider_rev(index = 1)
|
|
|
|
element('div', css: '.mw-revslider-revision[data-pos="' + index.to_s + '"]')
|
|
|
|
end
|
|
|
|
|
2017-07-11 08:17:24 +00:00
|
|
|
def click_revision_older(index = 1)
|
2016-10-07 15:06:59 +00:00
|
|
|
revbar = revisionslider_rev(index).element.wd
|
|
|
|
browser.driver.action.move_to(revbar, 1, revbar.size.height - 1).click.perform
|
|
|
|
end
|
|
|
|
|
2017-07-11 08:17:24 +00:00
|
|
|
def click_revision_newer(index = 1)
|
2016-10-07 15:06:59 +00:00
|
|
|
revbar = revisionslider_rev(index).element.wd
|
|
|
|
browser.driver.action.move_to(revbar, 1, 0).click.perform
|
|
|
|
end
|
2017-02-02 17:24:51 +00:00
|
|
|
|
|
|
|
def click_older_edit_link
|
2018-06-29 07:49:09 +00:00
|
|
|
sleep 0.2
|
2017-02-02 17:24:51 +00:00
|
|
|
differences_prevlink_element.when_visible.click
|
|
|
|
end
|
|
|
|
|
|
|
|
def click_newer_edit_link
|
2018-06-29 07:49:09 +00:00
|
|
|
sleep 0.2
|
2017-02-02 17:24:51 +00:00
|
|
|
differences_nextlink_element.when_visible.click
|
|
|
|
end
|
2016-10-07 15:06:59 +00:00
|
|
|
|
2016-07-04 16:26:13 +00:00
|
|
|
def revisionslider_tooltip(index = 1)
|
2016-07-02 20:14:00 +00:00
|
|
|
element('div', css: '.mw-revslider-revision-tooltip-' + index.to_s)
|
2016-07-04 16:26:13 +00:00
|
|
|
end
|
|
|
|
|
2016-06-27 12:38:23 +00:00
|
|
|
def wait_for_slider_to_load
|
|
|
|
wait_until do
|
2018-06-29 07:49:09 +00:00
|
|
|
revisionslider_slider_element
|
2016-06-27 12:38:23 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-08-12 07:35:12 +00:00
|
|
|
def wait_for_ajax_calls
|
|
|
|
sleep_period = 0.25
|
|
|
|
max_timeout_seconds = 2
|
|
|
|
timeout_loops = (max_timeout_seconds / sleep_period).to_i
|
|
|
|
|
|
|
|
while execute_script('return jQuery.active') != 0 && timeout_loops > 0
|
|
|
|
sleep(sleep_period)
|
|
|
|
timeout_loops -= 1
|
|
|
|
end
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2016-10-13 14:41:19 +00:00
|
|
|
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
|
|
|
|
|
2016-07-02 20:17:40 +00:00
|
|
|
def wait_for_diff_to_load
|
2016-07-04 18:22:22 +00:00
|
|
|
wait_until do
|
2016-07-02 20:17:40 +00:00
|
|
|
!revisionslider_loading?
|
2016-07-04 18:22:22 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2016-07-04 14:43:47 +00:00
|
|
|
def wait_for_help_dialog_to_hide
|
|
|
|
wait_until do
|
2016-07-05 11:23:16 +00:00
|
|
|
!revisionslider_help_dialog_element.visible?
|
2016-07-04 14:43:47 +00:00
|
|
|
end
|
|
|
|
end
|
2017-03-08 11:24:05 +00:00
|
|
|
end
|