jenkins-bot has submitted this change and it was merged.
Change subject: Browser tests: various fixes for firefox
......................................................................
Browser tests: various fixes for firefox
* Scroll menu items into view before trying to click them
* Click on the element with a click handler, not on his parent.
For instance, if a div contains a span and the span acts as a
button, clicking the div with the firefox driver doesn't work.
We have to click the span.
* Higher default timeouts. Opening VE and changing sort order
often fail with 5 second timeouts.
Change-Id: I53cc10729a1edf4675d9063101e26c588ccb5295
---
M tests/browser/features/action_menu_permalink.feature
M tests/browser/features/edit_existing.feature
M tests/browser/features/flow_in_recent_changes.feature
M tests/browser/features/flow_logged_in.feature
M tests/browser/features/moderation.feature
M tests/browser/features/step_definitions/action_menu_permalink_steps.rb
M tests/browser/features/step_definitions/edit_existing_steps.rb
M tests/browser/features/step_definitions/flow_steps.rb
M tests/browser/features/step_definitions/reply_moderation_steps.rb
M tests/browser/features/step_definitions/reply_steps.rb
M tests/browser/features/step_definitions/resolve_reopen_steps.rb
M tests/browser/features/step_definitions/suppress_steps.rb
M tests/browser/features/support/env.rb
M tests/browser/features/support/pages/abstract_flow_page.rb
M tests/browser/features/support/pages/wiki_page.rb
15 files changed, 82 insertions(+), 86 deletions(-)
Approvals:
Matthias Mullie: Looks good to me, approved
jenkins-bot: Verified
diff --git a/tests/browser/features/action_menu_permalink.feature
b/tests/browser/features/action_menu_permalink.feature
index 03f6bc2..bd4fb84 100644
--- a/tests/browser/features/action_menu_permalink.feature
+++ b/tests/browser/features/action_menu_permalink.feature
@@ -8,8 +8,7 @@
And I am on Flow page
Scenario: Topic Actions menu Permalink
- When I hover on the Topic Actions link
- And I click Permalink from the Actions menu
+ When I select the permalink for the first post of the first topic
And I am viewing Topic page
Then I see only one topic on the page
And the top post should have a heading which contains "Permalinktest"
diff --git a/tests/browser/features/edit_existing.feature
b/tests/browser/features/edit_existing.feature
index c3bd8a9..9c62ef7 100644
--- a/tests/browser/features/edit_existing.feature
+++ b/tests/browser/features/edit_existing.feature
@@ -8,8 +8,7 @@
Scenario: Edit an existing title
Given I am on Flow page
- When I hover on the Topic Actions link
- And I click the Edit title action
+ When I select the Edit title action
And I edit the title field with Title edited
And I save the new title
Then the top post should have a heading which contains "Title edited"
@@ -17,8 +16,7 @@
Scenario: Edit existing post
Given I am logged in
And I am on Flow page
- When I hover on the Post Actions link
- And I click Edit post
+ When I select Edit post
And I edit the post field with Post edited
And I save the new post
Then the saved post should contain Post edited
diff --git a/tests/browser/features/flow_in_recent_changes.feature
b/tests/browser/features/flow_in_recent_changes.feature
index 94a8b87..d9e57c0 100644
--- a/tests/browser/features/flow_in_recent_changes.feature
+++ b/tests/browser/features/flow_in_recent_changes.feature
@@ -12,9 +12,8 @@
Then the new topic should be in the Recent Changes page
Scenario: Edited topic is in Recent Changes
- When I hover on the Topic Actions link
- And I click the Edit title action
- And I edit the title field with Title should be in Recent Changes
- And I save the new title
- And I navigate to the Recent Changes page
+ When I select the Edit title action
+ And I edit the title field with Title should be in Recent Changes
+ And I save the new title
+ And I navigate to the Recent Changes page
Then the new title should be in the Recent Changes page
diff --git a/tests/browser/features/flow_logged_in.feature
b/tests/browser/features/flow_logged_in.feature
index d109db4..c0f925d 100644
--- a/tests/browser/features/flow_logged_in.feature
+++ b/tests/browser/features/flow_logged_in.feature
@@ -19,16 +19,3 @@
When I hover over the author link
Then the talk to author link should be visible
And the block author link should be visible
-
- # todo: replace with actual tests on those actions
- Scenario: Post Actions
- When I hover on the Post Actions link
- Then I should see a Hide button
- And I should see a Delete button
- And I should see a Suppress button
-
- Scenario: Topic Actions
- When I hover on the Topic Actions link
- Then I should see a Hide topic button
- And I should see a Delete topic button
- And I should see a Suppress topic button
diff --git a/tests/browser/features/moderation.feature
b/tests/browser/features/moderation.feature
index 7bfb63d..6711490 100644
--- a/tests/browser/features/moderation.feature
+++ b/tests/browser/features/moderation.feature
@@ -9,8 +9,7 @@
And I am on Flow page
Scenario: Deleting a topic
- When I hover on the Topic Actions link
- And I click the Delete topic button
+ When I select the Delete topic button
And I see a dialog box
And I give reason for deletion as being "He's a naughty boy"
And I click Delete topic
diff --git
a/tests/browser/features/step_definitions/action_menu_permalink_steps.rb
b/tests/browser/features/step_definitions/action_menu_permalink_steps.rb
index d2c9058..28a5651 100644
--- a/tests/browser/features/step_definitions/action_menu_permalink_steps.rb
+++ b/tests/browser/features/step_definitions/action_menu_permalink_steps.rb
@@ -5,10 +5,19 @@
end
end
+When(/^I select the permalink for the first post of the first topic$/) do
+ on(FlowPage) do |page|
+ menu = page.post_actions_link_element
+ option = page.permalink_button_element
+ page.select_menu_option menu, option
+ end
+end
+
When(/^I select the permalink for the second post of the first topic$/) do
on(FlowPage) do |page|
- page.second_post_actions_link_element.when_present.click
- page.actions_link_permalink_second_comment_element.when_present.click
+ menu = page.second_post_actions_link_element
+ option = page.actions_link_permalink_second_comment_element
+ page.select_menu_option menu, option
end
end
@@ -18,14 +27,6 @@
When(/^I click Permalink from the 3rd comment Post Actions menu$/) do
on(FlowPage).actions_link_permalink_3rd_comment_element.when_present.click
-end
-
-When(/^I hover on the Post Actions link on the 3rd comment on the topic$/) do
- on(FlowPage) do |page|
- page.scroll_to_top
- page.third_post_actions_link_element.when_present.focus
- page.third_post_actions_link_element.click
- end
end
When(/^I go to an old style permalink to my topic$/) do
diff --git a/tests/browser/features/step_definitions/edit_existing_steps.rb
b/tests/browser/features/step_definitions/edit_existing_steps.rb
index 7d89d59..eaaee3b 100644
--- a/tests/browser/features/step_definitions/edit_existing_steps.rb
+++ b/tests/browser/features/step_definitions/edit_existing_steps.rb
@@ -1,12 +1,16 @@
-When(/^I click Edit post$/) do
+When(/^I select Edit post$/) do
on(FlowPage) do |page|
- page.edit_post_button_element.when_present.click
+ menu = page.post_actions_link_element
+ option = page.edit_post_button_element
+ page.select_menu_option menu, option
end
end
-When(/^I click the Edit title action$/) do
+When(/^I select the Edit title action$/) do
on(FlowPage) do |page|
- page.edit_title_button_element.when_present.click
+ menu = page.topic_actions_link_element
+ option = page.edit_title_button_element
+ page.select_menu_option menu, option
end
end
diff --git a/tests/browser/features/step_definitions/flow_steps.rb
b/tests/browser/features/step_definitions/flow_steps.rb
index e145fbb..36590e6 100644
--- a/tests/browser/features/step_definitions/flow_steps.rb
+++ b/tests/browser/features/step_definitions/flow_steps.rb
@@ -61,8 +61,12 @@
end
end
-When(/^I click the Delete topic button$/) do
- on(FlowPage).topic_delete_button_element.when_present.click
+When(/^I select the Delete topic button$/) do
+ on(FlowPage) do |page|
+ menu = page.topic_actions_link_element
+ option = page.topic_delete_button_element
+ page.select_menu_option menu, option
+ end
end
When(/^I click the flow creator element$/) do
@@ -73,18 +77,7 @@
on(FlowPage).topic_hide_button_element.when_present.click
end
-When(/^I hover on the Post Actions link$/) do
- on(FlowPage).scroll_to_top
- on(FlowPage).post_actions_link_element.when_present.hover
-end
-
-When(/^I hover on the Topic Actions link$/) do
- on(FlowPage).scroll_to_top
- on(FlowPage).topic_actions_link_element.when_present.hover
-end
-
When(/^I hover over the author link$/) do
- on(FlowPage).scroll_to_top
on(FlowPage).author_link_element.hover
end
@@ -119,13 +112,16 @@
end
When(/^I visit the topic history page$/) do
- step 'I hover on the Topic Actions link'
- step 'I click History from the Actions menu'
+ step 'I select History from the Actions menu'
on(TopicHistoryPage).flow_topic_history_element.when_present
end
-When(/^I click History from the Actions menu$/) do
- on(FlowPage).topic_history_button_element.when_present.click
+When(/^I select History from the Actions menu$/) do
+ on(FlowPage) do |page|
+ menu = page.topic_actions_link_element
+ option = page.topic_history_button_element
+ page.select_menu_option menu, option
+ end
end
Then(/^I am on my user page$/) do
diff --git a/tests/browser/features/step_definitions/reply_moderation_steps.rb
b/tests/browser/features/step_definitions/reply_moderation_steps.rb
index 9e939f3..f11bf78 100644
--- a/tests/browser/features/step_definitions/reply_moderation_steps.rb
+++ b/tests/browser/features/step_definitions/reply_moderation_steps.rb
@@ -14,8 +14,9 @@
When(/^I hide the second comment with reason "(.*?)"$/) do |reason|
on(FlowPage) do |page|
- page.second_post_actions_link_element.when_present.click
- page.actions_link_hide_second_comment_element.when_present.click
+ menu = page.second_post_actions_link_element
+ option = page.actions_link_hide_second_comment_element
+ page.select_menu_option menu, option
end
step "I type \"#{reason}\" in the dialog box"
step 'I click the Hide button in the dialog'
diff --git a/tests/browser/features/step_definitions/reply_steps.rb
b/tests/browser/features/step_definitions/reply_steps.rb
index b4af778..41b4f3a 100644
--- a/tests/browser/features/step_definitions/reply_steps.rb
+++ b/tests/browser/features/step_definitions/reply_steps.rb
@@ -8,12 +8,11 @@
When(/^I reply with comment "(.*?)"$/) do |content|
on(FlowPage) do |page|
page.new_reply_save_element.when_not_present
- page.new_reply_placeholder_element.when_present.click
+ page.first_reply_placeholder_element.when_present.click
page.new_reply_editor_element.when_present.send_keys(content)
page.new_reply_save_element.when_present.click
page.new_reply_save_element.when_not_present
page.flow_first_topic_element.paragraph_element(text: content).when_present
- page.scroll_to_top
end
end
diff --git a/tests/browser/features/step_definitions/resolve_reopen_steps.rb
b/tests/browser/features/step_definitions/resolve_reopen_steps.rb
index d758ebf..1b3235a 100644
--- a/tests/browser/features/step_definitions/resolve_reopen_steps.rb
+++ b/tests/browser/features/step_definitions/resolve_reopen_steps.rb
@@ -1,8 +1,9 @@
When(/^I mark the first topic as resolved$/) do
on(FlowPage) do |page|
- page.topic_actions_link_element.when_present.click
- page.topic_resolve_button_element.when_present.click
+ menu = page.topic_actions_link_element
+ option = page.topic_resolve_button_element
+ page.select_menu_option menu, option
# dismiss the menu
page.edit_summary_element.when_present.click
@@ -12,8 +13,9 @@
When(/^I reopen the first topic$/) do
on(FlowPage) do |page|
- page.topic_actions_link_element.when_present.click
- page.topic_reopen_button_element.when_present.click
+ menu = page.topic_actions_link_element
+ option = page.topic_reopen_button_element
+ page.select_menu_option menu, option
# dismiss the menu
page.edit_summary_element.when_present.click
@@ -57,8 +59,9 @@
When(/^I click the summarize menu item$/) do
on(FlowPage) do |page|
- page.topic_actions_link_element.when_present.click
- page.topic_summarize_button_element.when_present.click
+ menu = page.topic_actions_link_element
+ option = page.topic_summarize_button_element
+ page.select_menu_option menu, option
end
end
diff --git a/tests/browser/features/step_definitions/suppress_steps.rb
b/tests/browser/features/step_definitions/suppress_steps.rb
index e9cb687..067c327 100644
--- a/tests/browser/features/step_definitions/suppress_steps.rb
+++ b/tests/browser/features/step_definitions/suppress_steps.rb
@@ -4,10 +4,6 @@
step 'I undo the suppression'
end
-When(/^I click the Suppress topic button$/) do
- on(FlowPage).topic_suppress_button_element.when_present.click
-end
-
When(/^I click Suppress topic$/) do
on(FlowPage).dialog_submit_suppress_element.when_present.click
end
@@ -19,9 +15,16 @@
end
end
+When(/^I select to suppress the first topic$/) do
+ on(FlowPage) do |page|
+ menu = page.topic_actions_link_element
+ option = page.topic_suppress_button_element
+ page.select_menu_option menu, option
+ end
+end
+
When(/^I suppress the first topic with reason "(.*?)"$/) do |reason|
- step 'I hover on the Topic Actions link'
- step 'I click the Suppress topic button'
+ step 'I select to suppress the first topic'
step 'I see a dialog box'
step "I type \"#{reason}\" in the dialog box"
step 'I click Suppress topic'
diff --git a/tests/browser/features/support/env.rb
b/tests/browser/features/support/env.rb
index 0fba164..8e9b3f5 100644
--- a/tests/browser/features/support/env.rb
+++ b/tests/browser/features/support/env.rb
@@ -5,10 +5,9 @@
require_relative 'div_extension'
-if ENV['PAGE_WAIT_TIMEOUT']
- PageObject.default_page_wait = ENV['PAGE_WAIT_TIMEOUT'].to_i
+def env_or_default(key, default)
+ ENV[key].nil? ? default : ENV[key].to_i
end
-if ENV['ELEMENT_WAIT_TIMEOUT']
- PageObject.default_element_wait = ENV['ELEMENT_WAIT_TIMEOUT'].to_i
-end
+PageObject.default_page_wait = env_or_default 'PAGE_WAIT_TIMEOUT', 10
+PageObject.default_element_wait = env_or_default 'ELEMENT_WAIT_TIMEOUT', 30
diff --git a/tests/browser/features/support/pages/abstract_flow_page.rb
b/tests/browser/features/support/pages/abstract_flow_page.rb
index 57a8f9e..6a5ad0d 100644
--- a/tests/browser/features/support/pages/abstract_flow_page.rb
+++ b/tests/browser/features/support/pages/abstract_flow_page.rb
@@ -5,6 +5,13 @@
page_section(:description, BoardDescription, class: 'flow-board-header')
+ def select_menu_option(menu, option)
+ menu.when_present.click
+ option.scroll_into_view
+ menu.when_present.click
+ option.when_present.click
+ end
+
# board component
div(:flow_component, class: 'flow-component')
div(:flow_board, class: 'flow-board')
@@ -154,6 +161,9 @@
### First post of first topic actions menu
a(:post_actions_link, css: ".flow-topic .flow-post .flow-menu-js-drop a",
index: 0)
ul(:post_actions_menu, css: ".flow-topic .flow-post .flow-menu ul", index: 0)
+ a(:permalink_button) do |page|
+ page.post_actions_menu_element.link_element(text: "Permalink")
+ end
a(:hide_button) do |page|
page.post_actions_menu_element.link_element(title: "Hide")
end
@@ -238,10 +248,12 @@
# top-level replies to the topic, and replies to regular posts
form(:new_reply_form, css: ".flow-reply-form")
- div(:new_reply_placeholder, class: 'flow-ui-replyWidget')
-
div(:first_reply_widget) do
flow_first_topic_element.div_element(class: 'flow-ui-replyWidget')
+ end
+
+ div(:first_reply_placeholder) do
+ first_reply_widget_element.text_field_element
end
def new_reply_editor_element
@@ -283,8 +295,8 @@
div(:sorting, class: 'flow-ui-reorderTopicsWidget')
link(:newest_topics_link, text: "Newest topics")
link(:recently_active_topics_link, text: "Recently active topics")
- div(:newest_topics_choice, text: "Newest topics")
- div(:recently_active_topics_choice, text: "Recently active topics")
+ span(:newest_topics_choice, text: "Newest topics")
+ span(:recently_active_topics_choice, text: "Recently active topics")
## Watch and unwatch links
div(:first_topic_watchlist_container, css: ".flow-topic-watchlist", index: 0)
diff --git a/tests/browser/features/support/pages/wiki_page.rb
b/tests/browser/features/support/pages/wiki_page.rb
index 9a92df6..3f0c5c9 100644
--- a/tests/browser/features/support/pages/wiki_page.rb
+++ b/tests/browser/features/support/pages/wiki_page.rb
@@ -1,8 +1,4 @@
class WikiPage
include PageObject
a(:logout, css: "#pt-logout a")
-
- def scroll_to_top
- browser.execute_script("window.scrollTo(0, 0);")
- end
end
--
To view, visit https://gerrit.wikimedia.org/r/233944
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I53cc10729a1edf4675d9063101e26c588ccb5295
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Sbisson <[email protected]>
Gerrit-Reviewer: Matthias Mullie <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits