Cmcmahon has uploaded a new change for review.
https://gerrit.wikimedia.org/r/174795
Change subject: QA: add refactored no-javascript test back to the build
......................................................................
QA: add refactored no-javascript test back to the build
This test never has run in any form, but it passes now for FF
Change-Id: Ie95b6037e971ba33641c936d096ffe508953af6d
---
M tests/browser/features/flow_no_javascript.feature
M tests/browser/features/step_definitions/flow_no_javascript_steps.rb
M tests/browser/features/support/pages/flow_page.rb
3 files changed, 74 insertions(+), 37 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/95/174795/1
diff --git a/tests/browser/features/flow_no_javascript.feature
b/tests/browser/features/flow_no_javascript.feature
index cfb7245..439bbd6 100644
--- a/tests/browser/features/flow_no_javascript.feature
+++ b/tests/browser/features/flow_no_javascript.feature
@@ -1,18 +1,21 @@
-@custom-browser @en.m.wikipedia.beta.wmflabs.org @firefox @login
@test2.m.wikipedia.org
+@custom-browser @en.wikipedia.beta.wmflabs.org @firefox @login
@test2.m.wikipedia.org
Feature: Basic site for legacy devices
Background:
- Given I am viewing the site without JavaScript
- And I am on a Flow page without JavaScript
+ Given I am using user agent "Mozilla/4.0 (compatible; MSIE 5.5b1;
Mac_PowerPC)"
+ And I am on a Flow page without JavaScript
- Scenario: I can see form to post a new topic without JavaScript
- Then I see the form to post a new topic
- And the post new topic form has an add topic button
- And the post new topic form has a preview button
- And the post new topic form does not have a cancel button
+ Scenario: I post a new topic without JavaScript
+ When I see the form to post a new topic
+ And I click Add topic no javascript
+ And I enter a no javascript topic title of "Selenium no javascript title"
+ And I enter a no javascript topic body of "Selenium no javascript body"
+ And I save a no javascript new topic
+ Then the page contains my no javascript topic
+ And the page contains my no javascript body
- Scenario: I can see form to reply to a topic without JavaScript
- Then I see the form to reply to a topic
- And the post new reply form has an add topic button
- And the post new reply form has a preview button
- And the post new reply form does not have a cancel button
+ Scenario: I reply to a topic without JavaScript
+ When I see the form to reply to a topic
+ And I enter a no javascript reply of "Selenium no javascript reply"
+ And I save a no javascript reply
+ Then the page contains my no javascript reply
diff --git
a/tests/browser/features/step_definitions/flow_no_javascript_steps.rb
b/tests/browser/features/step_definitions/flow_no_javascript_steps.rb
index 1bd6084..cb1d083 100644
--- a/tests/browser/features/step_definitions/flow_no_javascript_steps.rb
+++ b/tests/browser/features/step_definitions/flow_no_javascript_steps.rb
@@ -1,43 +1,65 @@
-Given(/^I am viewing the site without JavaScript$/) do
- # Using IE5 user agent which is currently blocked by ResourceLoader
- user_agent = "Mozilla/4.0 (compatible; MSIE 5.5b1; Mac_PowerPC)"
- @user_agent = user_agent
- @browser = browser(test_name(@scenario), { user_agent: user_agent })
- $session_id = @browser.driver.instance_variable_get(:@bridge).session_id
-end
+# This test has no javascript
+# Therefore this test has no AJAX
+# Therefore it should run without any "when_present" clauses
+# If you need a "when_present" to make the test run, that is a bug
-Given(/^I am on a Flow page without JavaScript$/) do
+Given(/^I am on a Flow page without JavaScript$/ ) do
visit(FlowPage)
end
-Then(/^I see the form to post a new topic$/) do
- on(FlowPage).new_topic_form_element.should be_visible
+Given(/^I am using user agent "(.+)"$/) do |user_agent|
+ @user_agent = user_agent
+ @browser = browser(test_name(@scenario), {user_agent: user_agent})
+ $session_id = @browser.driver.instance_variable_get(:@bridge).session_id
end
-Then(/^the post new topic form has an add topic button$/) do
- on(FlowPage).new_topic_save_element.should be_visible
+When(/^I click Add topic no javascript$/) do
+ on(FlowPage).no_javascript_topic_title_text_element.click
end
-Then(/^the post new topic form has a preview button$/) do
- on(FlowPage).new_topic_preview_element.should be_visible
+When(/^I enter a no javascript reply of "(.*?)"$/) do |no_javascript_reply|
+ @no_javascript_reply = no_javascript_reply
+ on(FlowPage).no_javascript_reply_form_element.send_keys
"#{@no_javascript_reply} #{@random_string}"
end
-Then(/^the post new topic form does not have a cancel button$/) do
- on(FlowPage).new_topic_cancel_element.should_not be_visible
+When(/^I enter a no javascript topic body of "(.*?)"$/) do
|no_javascript_topic_body|
+ @no_javascript_topic_body = no_javascript_topic_body
+ on(FlowPage).no_javascript_topic_body_text_element.send_keys
"#{@no_javascript_topic_body} #{@random_string}"
end
-Then(/^I see the form to reply to a topic$/) do
- on(FlowPage).new_reply_form_element.should be_visible
+When(/^I enter a no javascript topic title of "(.*?)"$/) do
|no_javascript_topic_title|
+ @no_javascript_topic_title = no_javascript_topic_title
+ on(FlowPage).no_javascript_topic_title_text_element.send_keys
"#{@no_javascript_topic_title} #{@random_string}"
end
-Then(/^the post new reply form has an add topic button$/) do
- on(FlowPage).new_reply_save_element.should be_visible
+When(/^I save a no javascript new topic$/) do
+ on(FlowPage).no_javascript_add_topic_element.click
end
-Then(/^the post new reply form has a preview button$/) do
- on(FlowPage).new_reply_preview_element.should be_visible
+When(/^I save a no javascript reply$/) do
+ on(FlowPage).no_javascript_reply_element.click
end
-Then(/^the post new reply form does not have a cancel button$/) do
- on(FlowPage).new_reply_cancel_element.should_not be_visible
+When(/^I see the form to post a new topic$/) do
+ on(FlowPage) do |page|
+ page.no_javascript_start_topic_element.click
+ end
+end
+
+When(/^I see the form to reply to a topic$/) do
+ on(FlowPage) do |page|
+ page.no_javascript_start_reply_element.click
+ end
+end
+
+Then(/^the page contains my no javascript body$/) do
+ expect(on(FlowPage).no_javascript_page_content_body).to match
"#{@no_javascript_topic_body} #{@random_string}"
+end
+
+Then(/^the page contains my no javascript topic$/) do
+ expect(on(FlowPage).no_javascript_page_content_title).to match
"#{@no_javascript_topic_title} #{@random_string}"
+end
+
+Then(/^the page contains my no javascript reply$/) do
+ expect(on(FlowPage).no_javascript_page_flow_topics).to match
"#{@no_javascript_reply} #{@random_string}"
end
diff --git a/tests/browser/features/support/pages/flow_page.rb
b/tests/browser/features/support/pages/flow_page.rb
index d0348d3..5b08010 100644
--- a/tests/browser/features/support/pages/flow_page.rb
+++ b/tests/browser/features/support/pages/flow_page.rb
@@ -211,6 +211,18 @@
button(:edit_header_save, text: "Save header")
+ # No javascript elements
+ button(:no_javascript_add_topic, text: "Add topic")
+ div(:no_javascript_page_content_body, class: "flow-post-content")
+ div(:no_javascript_page_content_title, class: "flow-topic-titlebar
flow-click-interactive")
+ div(:no_javascript_page_flow_topics, class: "flow-topics")
+ button(:no_javascript_reply, text: "Reply")
+ text_area(:no_javascript_reply_form, name: "topic_content")
+ a(:no_javascript_start_reply, href: /action=reply/)
+ a(:no_javascript_start_topic, href: /action=new-topic/)
+ text_field(:no_javascript_topic_body_text, name: "topiclist_content")
+ text_field(:no_javascript_topic_title_text, name: "topiclist_topic")
+
# Sorting
a(:newest_topics_link, text: "Newest topics")
a(:recently_active_topics_choice, href: /topiclist_sortby=updated/)
--
To view, visit https://gerrit.wikimedia.org/r/174795
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie95b6037e971ba33641c936d096ffe508953af6d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits