jenkins-bot has submitted this change and it was merged.

Change subject: QA: Refactoring browser tests
......................................................................


QA: Refactoring browser tests

Simplified created_account_failure_messages and editor_ve features with
a more declarative style.

Refactored login steps and added a "I am using the mobile site" step for
explicit setup of mobile context.

Using API to set up Given context where appropriate. Using watch support
in the new API client.

Fixed some ArticlePage element selectors.

Implemented a ArticlePage#type_into method that helps generalize fill-in
behavior that works with both content-editable and textarea elements.

Tagged features with @vagrant that are known to work in
mediawiki-vagrant assuming all the necessary roles are enabled.

Change-Id: Icbd9958b42222343879a48f34147c9595e03bcdc
---
A tests/browser/.gitignore
M tests/browser/Gemfile
M tests/browser/Gemfile.lock
M tests/browser/features/create_account_failure_messages.feature
M tests/browser/features/diff.feature
M tests/browser/features/editor_ve.feature
M tests/browser/features/editor_wikitext_nosave.feature
M tests/browser/features/editor_wikitext_saving.feature
M tests/browser/features/geonotahack.feature
M tests/browser/features/issues.feature
M tests/browser/features/language.feature
M tests/browser/features/language_logged_in.feature
M tests/browser/features/login.feature
M tests/browser/features/mainmenu.feature
M tests/browser/features/mainmenu_loggedin.feature
M tests/browser/features/nearby.feature
M tests/browser/features/no_javascript_site.feature
M tests/browser/features/notification.feature
M tests/browser/features/page_loading.feature
M tests/browser/features/pageactions.feature
M tests/browser/features/pageactions_logged_in.feature
M tests/browser/features/pageactions_logged_in_but_new.feature
M tests/browser/features/pageactions_protected.feature
M tests/browser/features/references.feature
M tests/browser/features/search.feature
M tests/browser/features/special.feature
M tests/browser/features/special_contributions.feature
M tests/browser/features/special_history.feature
M tests/browser/features/special_uploads.feature
M tests/browser/features/special_userprofile.feature
M tests/browser/features/special_watchlist.feature
M tests/browser/features/step_definitions/common_article_steps.rb
M tests/browser/features/step_definitions/common_steps.rb
M 
tests/browser/features/step_definitions/create_account_failure_messages_steps.rb
M tests/browser/features/step_definitions/create_page_api_steps.rb
M tests/browser/features/step_definitions/editor_steps.rb
M tests/browser/features/step_definitions/editor_ve_steps.rb
A tests/browser/features/step_definitions/messages_steps.rb
M tests/browser/features/step_definitions/nearby_steps.rb
M tests/browser/features/step_definitions/uploads_steps.rb
M tests/browser/features/step_definitions/watchstar_steps.rb
M tests/browser/features/support/env.rb
M tests/browser/features/support/hooks.rb
D tests/browser/features/support/modules/url_module.rb
M tests/browser/features/support/pages/article_page.rb
A tests/browser/features/support/pages/main_page.rb
M tests/browser/features/support/pages/special_uploads_page.rb
M tests/browser/features/support/pages/special_userlogin_page.rb
M tests/browser/features/talk.feature
M tests/browser/features/toc.feature
M tests/browser/features/toggling.feature
M tests/browser/features/toggling_tablet.feature
M tests/browser/features/ui_links.feature
M tests/browser/features/uploads_copyvio.feature
M tests/browser/features/uploads_lead.feature
M tests/browser/features/uploads_page_tutorial.feature
M tests/browser/features/watchstar.feature
57 files changed, 353 insertions(+), 330 deletions(-)

Approvals:
  JGonera: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/tests/browser/.gitignore b/tests/browser/.gitignore
new file mode 100644
index 0000000..5509614
--- /dev/null
+++ b/tests/browser/.gitignore
@@ -0,0 +1,5 @@
+# Puppet-managed dependencies for browser tests
+.bundle
+.gem
+.ruby-version
+screenshots
diff --git a/tests/browser/Gemfile b/tests/browser/Gemfile
index 9b55222..718dc1f 100755
--- a/tests/browser/Gemfile
+++ b/tests/browser/Gemfile
@@ -4,5 +4,4 @@
 source "https://rubygems.org";
 
 gem "chunky_png"
-gem "mediawiki_api"
-gem "mediawiki_selenium"
+gem "mediawiki_selenium", "~> 0.3.1"
diff --git a/tests/browser/Gemfile.lock b/tests/browser/Gemfile.lock
index cb4f6c5..20b6dd5 100644
--- a/tests/browser/Gemfile.lock
+++ b/tests/browser/Gemfile.lock
@@ -5,7 +5,7 @@
     childprocess (0.5.3)
       ffi (~> 1.0, >= 1.0.11)
     chunky_png (1.3.1)
-    cucumber (1.3.15)
+    cucumber (1.3.16)
       builder (>= 2.1.2)
       diff-lcs (>= 1.1.3)
       gherkin (~> 2.12)
@@ -32,14 +32,14 @@
       domain_name (~> 0.5)
     i18n (0.6.11)
     json (1.8.1)
-    mediawiki_api (0.1.4)
+    mediawiki_api (0.2.0)
       faraday (~> 0.9, >= 0.9.0)
       faraday-cookie_jar (~> 0.0, >= 0.0.6)
-    mediawiki_selenium (0.2.26)
+    mediawiki_selenium (0.3.1)
       cucumber (~> 1.3, >= 1.3.10)
       headless (~> 1.0, >= 1.0.1)
       json (~> 1.8, >= 1.8.1)
-      mediawiki_api (~> 0.1.3)
+      mediawiki_api (~> 0.2, >= 0.2.0)
       page-object (~> 1.0)
       rest-client (~> 1.6, >= 1.6.7)
       rspec-expectations (~> 2.14, >= 2.14.4)
@@ -49,7 +49,7 @@
     multi_test (0.1.1)
     multipart-post (2.0.0)
     netrc (0.7.7)
-    page-object (1.0)
+    page-object (1.0.2)
       page_navigation (>= 0.9)
       selenium-webdriver (>= 2.42.0)
       watir-webdriver (>= 0.6.9)
@@ -58,7 +58,7 @@
     rest-client (1.7.2)
       mime-types (>= 1.16, < 3.0)
       netrc (~> 0.7)
-    rspec-expectations (2.99.1)
+    rspec-expectations (2.99.2)
       diff-lcs (>= 1.1.3, < 2.0)
     rubyzip (1.1.6)
     selenium-webdriver (2.42.0)
@@ -80,5 +80,4 @@
 
 DEPENDENCIES
   chunky_png
-  mediawiki_api
-  mediawiki_selenium
+  mediawiki_selenium (~> 0.3.1)
diff --git a/tests/browser/features/create_account_failure_messages.feature 
b/tests/browser/features/create_account_failure_messages.feature
index 4354531..e298482 100644
--- a/tests/browser/features/create_account_failure_messages.feature
+++ b/tests/browser/features/create_account_failure_messages.feature
@@ -1,27 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Create failure messages
-  Scenario: Can refresh captcha
-    Given I am on the "Special:Userlogin" page
-      And I click Create Account
-    Then I see the refresh captcha icon
+  Background:
+    Given I am on the sign-up page
 
   Scenario: Create account password mismatch message
-    Given I am on the "Special:Userlogin" page
-      And I click Create Account
-      And I type "thisisuser" into Username field
-      And I type "thisisgoodpassword" into Password field
-      And I type "thisisbadpassword" into Confirm password field
-    When I click Sign up
-    Then I should see the error box message "Whoops"
-      And I should see the error box message "The passwords you entered do not 
match"
-
-  Scenario: Create account mistype captcha message
-    Given I am on the "Special:Userlogin" page
-      And I click Create Account
-      And I type "thisisuser" into Username field
-      And I type "thisisgoodpassword" into Password field
-      And I type "thisisgoodpassword" into Confirm password field
-      And I type "abcdefghijklmnop" into Enter confirmation code field
-    When I click Sign up
-    Then I should see the error box message "Whoops"
-      And I should see the error box message "Incorrect or missing CAPTCHA"
+    When I sign up with two different passwords
+    Then I see an error indicating they do not match
+      And I should still be on the sign-up page
diff --git a/tests/browser/features/diff.feature 
b/tests/browser/features/diff.feature
index 0ba5997..df16e1c 100644
--- a/tests/browser/features/diff.feature
+++ b/tests/browser/features/diff.feature
@@ -1,4 +1,4 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Page diff
 
   Scenario: Added and removed content
diff --git a/tests/browser/features/editor_ve.feature 
b/tests/browser/features/editor_ve.feature
index a91aebe..dc41970 100644
--- a/tests/browser/features/editor_ve.feature
+++ b/tests/browser/features/editor_ve.feature
@@ -1,50 +1,28 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login
-Feature: VisualEditor
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @vagrant
+Feature: VisualEditor Mobile
 
-Background:
-  Given I am logged into the mobile website
-    And I am viewing the site in tablet mode
-    And I am in beta mode
+  Background:
+    Given I am logged into the mobile website
+      And I am in beta mode
+      And I am editing a new article with VisualEditor
 
-Scenario: Switch from VisualEditor to source editor
-  Given the page "Selenium Edit Test" exists
-    And I click the edit button
-    And I switch to VisualEditor
-    And I see the VisualEditor overlay
-    And I am on the "Selenium Edit Test" page
-    And I click the edit button
-    And I see the VisualEditor overlay
-    And the VisualEditor overlay has an editor mode switcher button
-    And I click the editor mode switcher button
-  When I click the source editor button
-  Then I see the wikitext editor overlay
+  Scenario: Switch from VisualEditor to source editor
+    When I switch to editing the source
+    Then I see the wikitext editor
 
-Scenario: Toolbar VisualEditor
-  Given the page "Selenium Edit Test" exists
-    And I click the edit button
-    And I switch to VisualEditor
-  Then I see the VisualEditor overlay
-    And I see a toolbar in the overlay header
-    And the VisualEditor toolbar has a bold button
-    And the VisualEditor toolbar has an italic button
+  Scenario: VisualEditor provides bold
+    When I look at the VisualEditor toolbar
+    Then I see a bold button
 
-Scenario: I can edit a page using VisualEditor
-  Given the page "Selenium Edit Test" exists
-    And I click the edit button
-    And I switch to VisualEditor
-    And VisualEditor has loaded
-    And I type "ABCDEFG" into VisualEditor
-    And I click continue
-  When I click submit
-  Then I do not see the VisualEditor overlay
-    And I see a toast notification
+  Scenario: VisualEditor provides italicize
+    When I look at the VisualEditor toolbar
+    Then I see an italicize button
 
-Scenario: Going back from save screen in VisualEditor
-  Given the page "Selenium Edit Test" exists
-    And I click the edit button
-    And I switch to VisualEditor
-    And VisualEditor has loaded
-    And I type "ABCDEFG" into VisualEditor
-    And I click continue
-  When I click the escape button
-  Then I see the VisualEditor
+  Scenario: I can edit a page using VisualEditor
+    When I edit the article using VisualEditor
+    Then I see the edit reflected in the article content
+
+  Scenario: Going back from save screen in VisualEditor
+    When I click the escape button
+    Then I see the article content
+      But I no longer see the VisualEditor
diff --git a/tests/browser/features/editor_wikitext_nosave.feature 
b/tests/browser/features/editor_wikitext_nosave.feature
index 9d4925e..4586fd2 100644
--- a/tests/browser/features/editor_wikitext_nosave.feature
+++ b/tests/browser/features/editor_wikitext_nosave.feature
@@ -1,10 +1,10 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
-Feature: Wikitext Editor (TEST RUN ON WIKIPEDIA SO SHOULD NOT CAUSE SAVES)
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
+Feature: Wikitext Editor
 
   Background:
     Given I am logged into the mobile website
       And I am on a page that does not exist
-    When I click the edit button
+      And I click the edit button
 
   Scenario: Opening editor
     Then I see the wikitext editor overlay
diff --git a/tests/browser/features/editor_wikitext_saving.feature 
b/tests/browser/features/editor_wikitext_saving.feature
index 67e10f9..07069bb 100644
--- a/tests/browser/features/editor_wikitext_saving.feature
+++ b/tests/browser/features/editor_wikitext_saving.feature
@@ -5,8 +5,8 @@
     Given I am logged into the mobile website
 
   Scenario: Successful edit on page without languages shows no language button 
[bug 63675]
-    And the page "Selenium no languages test page" exists
-    And I do not see the read in another language button
+    Given the page "Selenium no languages test page" exists
+      And I do not see the read in another language button
     When I click the edit button
       And I see the wikitext editor overlay
       And I type "ABC GHI" into the editor
@@ -17,8 +17,8 @@
       And I do not see the read in another language button
 
   Scenario: Successful edit reloads language button
-    And I go to a page that has languages
-    And I see the read in another language button
+    Given I go to a page that has languages
+      And I see the read in another language button
     When I click the edit button
       And I see the wikitext editor overlay
       And I type "ABC GHI" into the editor
@@ -28,8 +28,8 @@
       And I see the read in another language button
 
   Scenario: Redirects
-    And the page "Selenium wikitext editor test" exists
-    And I am on a page that does not exist
+    Given the page "Selenium wikitext editor test" exists
+      And I am on a page that does not exist
     When I click the edit button
       And I clear the editor
       And I type "#REDIRECT [[Selenium wikitext editor test]]" into the editor
@@ -40,7 +40,7 @@
       And the text of the first heading is "Selenium wikitext editor test"
 
   Scenario: Broken redirects
-    And I am on a page that does not exist
+    Given I am on a page that does not exist
     When I click the edit button
       And I clear the editor
       And I type "#REDIRECT [[AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA]]" into the 
editor
diff --git a/tests/browser/features/geonotahack.feature 
b/tests/browser/features/geonotahack.feature
index 82a1965..755a863 100644
--- a/tests/browser/features/geonotahack.feature
+++ b/tests/browser/features/geonotahack.feature
@@ -1,19 +1,20 @@
 @chrome @en.m.wikipedia.beta.wmflabs.org @firefox
 Feature: Nearby pages
 
-Background:
-  Given I am in beta mode
-    And I am on a page with geodata
+  Background:
+    Given I am logged into the mobile website
+      And I am in beta mode
+      And I am on a page with geodata
 
-Scenario: Nearby button visible
-  Then I see the nearby button
+  Scenario: Nearby button visible
+    Then I see the nearby button
 
-Scenario: Nearby button visible
-  When I click the nearby button
-  Then I see the nearby overlay
+  Scenario: Nearby button visible
+    When I click the nearby button
+    Then I see the nearby overlay
 
-Scenario: Page preview
-  Given I click the nearby button
-    And I see the nearby overlay
-  When I click a nearby result
-  Then I see the page preview overlay
+  Scenario: Page preview
+    Given I click the nearby button
+      And I see the nearby overlay
+    When I click a nearby result
+    Then I see the page preview overlay
diff --git a/tests/browser/features/issues.feature 
b/tests/browser/features/issues.feature
index 6a9fc29..841976d 100644
--- a/tests/browser/features/issues.feature
+++ b/tests/browser/features/issues.feature
@@ -1,27 +1,28 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Issues
 
   Background:
-    Given I am on a page which has cleanup templates
+    Given I am using the mobile site
+      And I am on a page which has cleanup templates
 
   Scenario: I see the this page has issues stamp
     Then I should see that this page has issues
 
   Scenario: Clicking page issues opens overlay
-      And I should see that this page has issues
+    Given I should see that this page has issues
     When I click the page issues stamp
     Then I see the issues overlay
 
   Scenario: Closing page issues
-      And I should see that this page has issues
+    Given I should see that this page has issues
       And I click the page issues stamp
       And I see the issues overlay
     When I click the overlay issue close button
     Then I don't see the issues overlay
 
   Scenario: Closing page issues (browser back)
-      And I should see that this page has issues
+    Given I should see that this page has issues
       And I click the page issues stamp
       And I see the issues overlay
     When I click the browser back button
-    Then I don't see the issues overlay
\ No newline at end of file
+    Then I don't see the issues overlay
diff --git a/tests/browser/features/language.feature 
b/tests/browser/features/language.feature
index 3f729f3..b9fa755 100644
--- a/tests/browser/features/language.feature
+++ b/tests/browser/features/language.feature
@@ -3,7 +3,8 @@
 Feature: Language selection
 
   Background:
-    Given I am on the "Main Page" page
+    Given I am using the mobile site
+      And I am on the "Main Page" page
       And I see the read in another language button
     When I click the language button
 
@@ -15,6 +16,6 @@
     Then I don't see the languages overlay
 
   Scenario: Closing language overlay (browser button)
-    And I see the language overlay
+    Given I see the language overlay
     When I click the browser back button
     Then I don't see the languages overlay
diff --git a/tests/browser/features/language_logged_in.feature 
b/tests/browser/features/language_logged_in.feature
index 84c0a62..01ae6a5 100644
--- a/tests/browser/features/language_logged_in.feature
+++ b/tests/browser/features/language_logged_in.feature
@@ -3,7 +3,7 @@
 
   Background:
     Given I am logged into the mobile website
-    And I go to a page that has languages
+      And I go to a page that has languages
 
   Scenario: Validate Language selection availability
     When I click the language button
diff --git a/tests/browser/features/login.feature 
b/tests/browser/features/login.feature
index 5ce919f..d62ec0c 100644
--- a/tests/browser/features/login.feature
+++ b/tests/browser/features/login.feature
@@ -1,6 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Login
 
+  Background:
+    Given I am using the mobile site
+
   Scenario: Not logged in
     Given I am on the "Main Page" page
     When I click on "Log in" in the main navigation menu
diff --git a/tests/browser/features/mainmenu.feature 
b/tests/browser/features/mainmenu.feature
index fdb6905..034c18d 100644
--- a/tests/browser/features/mainmenu.feature
+++ b/tests/browser/features/mainmenu.feature
@@ -1,8 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Menus open correct page for anonymous users
 
   Background:
-    Given I am on the "Main Page" page
+    Given I am using the mobile site
+      And I am on the "Main Page" page
 
   Scenario: Check links in menu
     When I click on the main navigation button
@@ -13,7 +14,11 @@
       And I see a link to "Settings" in the main navigation menu
       And I see a link to "Watchlist" in the main navigation menu
       And I see a link to "Log in" in the main navigation menu
-      And I see a link to "Nearby" in the main navigation menu
+
+  Scenario: Nearby link in menu
+    Given at least one article with geodata exists
+    When I click on the main navigation button
+    Then I see a link to "Nearby" in the main navigation menu
 
   Scenario: Watchlist URL is set correctly
     When I click on "Watchlist" in the main navigation menu
diff --git a/tests/browser/features/mainmenu_loggedin.feature 
b/tests/browser/features/mainmenu_loggedin.feature
index 2b202db..be4e991 100644
--- a/tests/browser/features/mainmenu_loggedin.feature
+++ b/tests/browser/features/mainmenu_loggedin.feature
@@ -1,9 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Menus open correct page for anonymous users
 
   Background:
-    Given I am on the "Main Page" page
-      And  I am logged into the mobile website
+    Given I am logged into the mobile website
+      And I am on the "Main Page" page
 
   Scenario: Check links in menu
     When I click on the main navigation button
@@ -16,4 +16,8 @@
       And I see a link to "Settings" in the main navigation menu
       And I see a link to "Watchlist" in the main navigation menu
       And I see a link to "Uploads" in the main navigation menu
-      And I see a link to "Nearby" in the main navigation menu
+
+  Scenario: Nearby link in menu
+    Given at least one article with geodata exists
+    When I click on the main navigation button
+    Then I see a link to "Nearby" in the main navigation menu
diff --git a/tests/browser/features/nearby.feature 
b/tests/browser/features/nearby.feature
index 3ed59d4..d055433 100644
--- a/tests/browser/features/nearby.feature
+++ b/tests/browser/features/nearby.feature
@@ -1,6 +1,10 @@
+@firefox @vagrant
 Feature: Nearby page (mobile interface)
   Test currently only works with Firefox
 
+  Background:
+    Given I am using the mobile site
+
   Scenario: Nearby exists
     When I click on "Nearby" in the main navigation menu
       And I give permission for the page to access my location
diff --git a/tests/browser/features/no_javascript_site.feature 
b/tests/browser/features/no_javascript_site.feature
index 9f73c6a..cb3667e 100644
--- a/tests/browser/features/no_javascript_site.feature
+++ b/tests/browser/features/no_javascript_site.feature
@@ -2,7 +2,8 @@
 Feature: Basic site for legacy devices
 
   Background:
-    Given I am viewing the basic non-JavaScript site
+    Given I am using the mobile site
+      And I am viewing the basic non-JavaScript site
       And I am on the "Main Page" page
 
   # FIXME: Add scenario to check search actually works
diff --git a/tests/browser/features/notification.feature 
b/tests/browser/features/notification.feature
index 1d639fd..f6d685b 100644
--- a/tests/browser/features/notification.feature
+++ b/tests/browser/features/notification.feature
@@ -1,4 +1,4 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Notification
 
   Background:
diff --git a/tests/browser/features/page_loading.feature 
b/tests/browser/features/page_loading.feature
index 071c568..ec4c0ba 100644
--- a/tests/browser/features/page_loading.feature
+++ b/tests/browser/features/page_loading.feature
@@ -1,4 +1,4 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @vagrant
 Feature: Loading pages
 
   Background:
diff --git a/tests/browser/features/pageactions.feature 
b/tests/browser/features/pageactions.feature
index 155cc4f..2fb48f5 100644
--- a/tests/browser/features/pageactions.feature
+++ b/tests/browser/features/pageactions.feature
@@ -1,9 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Page actions menu when anonymous
 
   Background:
-    Given I am on the "Main Page" page
-       And I click on "Random" in the main navigation menu
+    Given I am using the mobile site
+      And I am viewing an article
 
   Scenario: Receive notification message - Edit Icon
     When I click the edit icon holder
diff --git a/tests/browser/features/pageactions_logged_in.feature 
b/tests/browser/features/pageactions_logged_in.feature
index 2e32b01..d088c9d 100644
--- a/tests/browser/features/pageactions_logged_in.feature
+++ b/tests/browser/features/pageactions_logged_in.feature
@@ -1,10 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Page actions menu when logged in
 
   Background:
     Given I am logged into the mobile website
-      And I am on the "Main Page" page
-      And I click on "Random" in the main navigation menu
+      And I am viewing an article
 
   Scenario: I can see the edit button
     Then I should see the edit icon
diff --git a/tests/browser/features/pageactions_logged_in_but_new.feature 
b/tests/browser/features/pageactions_logged_in_but_new.feature
index 6850802..b0f1b6b 100644
--- a/tests/browser/features/pageactions_logged_in_but_new.feature
+++ b/tests/browser/features/pageactions_logged_in_but_new.feature
@@ -2,8 +2,9 @@
 Feature: Page actions menu when logged in as a new user
 
   Background:
-    Given I am logged in as a new user
-      And I am on the "Main Page" page
+    Given I am using the mobile site
+      And I am logged in as a new user
+      And I am viewing an article
 
   Scenario: I can not see the upload button
     Then there is not an upload an image to this page button
diff --git a/tests/browser/features/pageactions_protected.feature 
b/tests/browser/features/pageactions_protected.feature
index 3295e01..b9a9fdd 100644
--- a/tests/browser/features/pageactions_protected.feature
+++ b/tests/browser/features/pageactions_protected.feature
@@ -2,7 +2,8 @@
 Feature: Page actions menu when anonymous
 
   Background:
-    Given I visit a protected page
+    Given I am using the mobile site
+      And I visit a protected page
 
   Scenario: I cannot edit a protected page when anonymous
     When I click the edit icon holder
diff --git a/tests/browser/features/references.feature 
b/tests/browser/features/references.feature
index 2df3526..8f6754d 100644
--- a/tests/browser/features/references.feature
+++ b/tests/browser/features/references.feature
@@ -1,6 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Reference popup drawer
 
+  Background:
+    Given I am using the mobile site
+
   Scenario: Opening the reference drawer
     Given I go to a page that has references
     When I click on a reference
diff --git a/tests/browser/features/search.feature 
b/tests/browser/features/search.feature
index 020832c..589a3cc 100644
--- a/tests/browser/features/search.feature
+++ b/tests/browser/features/search.feature
@@ -1,9 +1,10 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Search
 
   Background:
-    Given the page "Selenium search test" exists
+    Given I am using the mobile site
       And I am on the "Main Page" page
+      And the page "Selenium search test" exists
     When I click the placeholder search box
 
   Scenario: Opening search
diff --git a/tests/browser/features/special.feature 
b/tests/browser/features/special.feature
index 180ac1e..677fde1 100644
--- a/tests/browser/features/special.feature
+++ b/tests/browser/features/special.feature
@@ -1,8 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Generic special page features
 
   Background:
-    Given I am on the "Main Page" page
+    Given I am using the mobile site
+      And I am on the "Main Page" page
 
   Scenario: Search from Uploads
     Given I am logged into the mobile website
diff --git a/tests/browser/features/special_contributions.feature 
b/tests/browser/features/special_contributions.feature
index 35f9871..418d43d 100644
--- a/tests/browser/features/special_contributions.feature
+++ b/tests/browser/features/special_contributions.feature
@@ -1,4 +1,4 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Special:Contributions
 
   Background:
diff --git a/tests/browser/features/special_history.feature 
b/tests/browser/features/special_history.feature
index c6808fb..8d8215a 100644
--- a/tests/browser/features/special_history.feature
+++ b/tests/browser/features/special_history.feature
@@ -1,8 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Special:History (Note test may take a long time to run on first run)
 
   Background:
-    Given the page "Selenium diff test" exists and has at least 51 edits
+    Given I am using the mobile site
+      And the page "Selenium diff test" exists and has at least 51 edits
       And I am on the "Selenium diff test" page
     When I click on the history link in the last modified bar
 
diff --git a/tests/browser/features/special_uploads.feature 
b/tests/browser/features/special_uploads.feature
index 4da6fed..8a67bbb 100644
--- a/tests/browser/features/special_uploads.feature
+++ b/tests/browser/features/special_uploads.feature
@@ -1,5 +1,7 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @login @test2.m.wikipedia.org @vagrant
 Feature: Special:Uploads uploads
+  Background:
+    Given I am using the mobile site
 
 # The progress bar may or may not appear based on browser capability.
 # The progress bar does not appear for Firefox as of May 2014
diff --git a/tests/browser/features/special_userprofile.feature 
b/tests/browser/features/special_userprofile.feature
index 4b46fad..c0e3fb2 100644
--- a/tests/browser/features/special_userprofile.feature
+++ b/tests/browser/features/special_userprofile.feature
@@ -1,8 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Special:UserProfile
 
   Background:
-    Given I visit my user profile page
+    Given I am logged into the mobile website
+      And I visit my user profile page
 
   Scenario: Check components in profile page
     Then I am on my user profile page
diff --git a/tests/browser/features/special_watchlist.feature 
b/tests/browser/features/special_watchlist.feature
index 7cacd04..54ebde3 100644
--- a/tests/browser/features/special_watchlist.feature
+++ b/tests/browser/features/special_watchlist.feature
@@ -1,18 +1,18 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Manage Watchlist
 
-  Scenario: Switching to Feed view
+  Background:
     Given I am logged into the mobile website
       And I am on the "Special:Watchlist" page
+
+  Scenario: Switching to Feed view
     When I switch to the modified view of the watchlist
       And I click the Pages tab
     Then I see a list of diff summary links
       And the modified button is selected
 
   Scenario: Switching to List view
-    Given I am logged into the mobile website
-      And I am on the "Special:Watchlist" page
-      And I switch to the modified view of the watchlist
-    When I switch to the list view of the watchlist
+    When I switch to the modified view of the watchlist
+      And I switch to the list view of the watchlist
     Then I see a list of pages I am watching
       And the a to z button is selected
diff --git a/tests/browser/features/step_definitions/common_article_steps.rb 
b/tests/browser/features/step_definitions/common_article_steps.rb
index 267bff3..daefcd2 100644
--- a/tests/browser/features/step_definitions/common_article_steps.rb
+++ b/tests/browser/features/step_definitions/common_article_steps.rb
@@ -33,6 +33,10 @@
   end
 end
 
+Given(/^I am viewing an article$/) do
+  step "I am at a random page"
+end
+
 # Watch star
 Then(/^I see the watch star$/) do
   on(ArticlePage).watch_link_element.should be_visible
@@ -63,19 +67,6 @@
   on(ArticlePage).toast_element.when_present.text.should match text
 end
 
-Then(/^I see a toast with message about adding the random page$/) do
-  on(ArticlePage).toast_element.when_present.text.should match "Added 
#{@random_string} to your watchlist"
-end
-
-Then(/^I see a toast with message about removing the random page$/) do
-  on(ArticlePage) do |page|
-    page.wait_until do
-      page.text.include? "Removed" #Chrome needs this, FF does not
-    end
-    page.toast_element.when_present.text.should match "Removed 
#{@random_string} from your watchlist"
-  end
-end
-
 Then(/^I see a toast error$/) do
   on(ArticlePage).toast_element.when_present.class_name.should match "error"
 end
@@ -84,7 +75,7 @@
    on(ArticlePage) do |page|
     page.wait_until do
       page.first_heading_element.when_present.text.include? title
-      end
+    end
     page.first_heading_element.when_present.text.should match title
   end
 end
@@ -100,3 +91,4 @@
 Then(/^I should see the error box message "(.+)"$/) do |error_message|
   on(ArticlePage).error_message.should match (error_message)
 end
+
diff --git a/tests/browser/features/step_definitions/common_steps.rb 
b/tests/browser/features/step_definitions/common_steps.rb
index 69920da..79cfeb4 100644
--- a/tests/browser/features/step_definitions/common_steps.rb
+++ b/tests/browser/features/step_definitions/common_steps.rb
@@ -1,4 +1,4 @@
-Given /^I am using user agent "(.+)"$/ do |user_agent|
+Given(/^I am using user agent "(.+)"$/) do |user_agent|
   @user_agent = user_agent
   @browser = browser(test_name(@scenario), {user_agent: user_agent})
   @browser.window.resize_to(480, 800)
@@ -9,24 +9,25 @@
   step 'I am using user agent "Opera/9.80 (J2ME/MIDP; Opera Mini/9.80 (S60; 
SymbOS; Opera Mobi/23.348; U; en) Presto/2.5.25 Version/10.54"'
 end
 
-Given /^I am logged into the mobile website$/ do
-  step 'I am on the "Main Page" page'
-  step 'I click on "Log in" in the main navigation menu'
-  on(SpecialUserLoginPage) do |page|
-  page.login_with(ENV["MEDIAWIKI_USER"], ENV["MEDIAWIKI_PASSWORD"])
-  if page.text.include? "There is no user by the name "
-    puts ENV["MEDIAWIKI_USER"] + " does not exist... trying to add user"
-    on(SpecialUserLoginPage).create_account_element.when_present.click
-    on(SpecialUserLoginPage) do |page|
-      page.username_element.element.when_present.set ENV["MEDIAWIKI_USER"]
-      page.signup_password_element.element.when_present.set 
ENV["MEDIAWIKI_PASSWORD"]
-      page.confirm_password_element.element.when_present.set 
ENV["MEDIAWIKI_PASSWORD"]
-      page.signup_submit_element.element.when_present.click
-      page.text.should include "Welcome, " + ENV["MEDIAWIKI_USER"] + "!"
-      #Can't get around captcha in order to create a user
-    end
+Given(/^I am logged into the mobile website$/) do
+  step "I am using the mobile site"
+  visit(LoginPage).login_with(ENV["MEDIAWIKI_USER"], 
ENV["MEDIAWIKI_PASSWORD"], false)
+end
+
+Given(/^I am using the mobile site$/) do
+  visit(MainPage)
+  @browser.cookies.add 'mf_useformat', 'true'
+  on(MainPage).refresh
+end
+
+Given(/^I am on the sign-up page$/) do
+  visit(SpecialUserLoginPage) do |page|
+    page.create_account_link_element.when_present.click
   end
-  end
+end
+
+Given(/^I choose to create an account$/) do
+  on(SpecialUserLoginPage).create_account_link_element.when_present.click
 end
 
 Given /^I am logged in as a new user$/ do
diff --git 
a/tests/browser/features/step_definitions/create_account_failure_messages_steps.rb
 
b/tests/browser/features/step_definitions/create_account_failure_messages_steps.rb
index 3bb4a2f..5e27597 100644
--- 
a/tests/browser/features/step_definitions/create_account_failure_messages_steps.rb
+++ 
b/tests/browser/features/step_definitions/create_account_failure_messages_steps.rb
@@ -1,28 +1,16 @@
-Given(/^I click Create Account$/) do
-  on(SpecialUserLoginPage).create_account_link_element.when_present.click
+When(/^I sign up with two different passwords$/) do
+  on(SpecialUserLoginPage) do |page|
+    page.username = "some_username"
+    page.password = "s0me decent password"
+    page.confirm_password = "s0me wrong password"
+    page.signup_submit
+  end
 end
 
-Then(/^I see the refresh captcha icon$/) do
-  on(SpecialUserLoginPage).refresh_captcha_element.when_present.should exist
+Then(/^I see an error indicating they do not match$/) do
+  expect(on(SpecialUserLoginPage).feedback).to match("The passwords you 
entered do not match")
 end
 
-Given(/^I type "(.+)" into Username field$/) do |username|
-  on(SpecialUserLoginPage).username_element.when_present.send_keys(username)
+Then(/^I should still be on the sign-up page$/) do
+  expect(on(SpecialUserLoginPage).first_heading).to match("Create account")
 end
-
-Given(/^I type "(.+)" into Password field$/) do |password|
-  on(SpecialUserLoginPage).password_element.when_present.send_keys(password)
-end
-
-Given(/^I type "(.+)" into Confirm password field$/) do |confirm|
-  
on(SpecialUserLoginPage).confirm_password_element.when_present.send_keys(confirm)
-end
-
-When(/^I click Sign up$/) do
-  on(SpecialUserLoginPage).signup_submit_element.when_present.click
-end
-
-Given(/^I type (.+) into Enter confirmation code field$/) do |conf_code|
-  on(SpecialUserLoginPage).confirmation_field_element.when_present.send_keys 
(conf_code)
-end
-
diff --git a/tests/browser/features/step_definitions/create_page_api_steps.rb 
b/tests/browser/features/step_definitions/create_page_api_steps.rb
index 2293f40..38688ad 100644
--- a/tests/browser/features/step_definitions/create_page_api_steps.rb
+++ b/tests/browser/features/step_definitions/create_page_api_steps.rb
@@ -46,12 +46,16 @@
   step 'I am on the "' + title + '" page'
 end
 
-Given(/^I am on a page with geodata$/) do
-  wikitext = 'This page is used by Selenium to test geo related features.
+Given(/^at least one article with geodata exists$/) do
+  on(APIPage).create "Selenium geo test page", <<-end
+This page is used by Selenium to test geo related features.
 
 {{#coordinates:43|-75|primary}}
-'
-  on(APIPage).create "Selenium geo test page", wikitext
+  end
+end
+
+Given(/^I am on a page with geodata$/) do
+  step 'at least one article exists with geodata'
   step 'I am on the "Selenium geo test page" page'
 end
 
@@ -77,11 +81,8 @@
   # Open the third section which contains the edit count
   on(ArticlePage).third_section_element.when_present.click
   on(ArticlePage) do |page|
-    # Clean up edit count, removing any commas.
-    edit_count = page.edit_count_element.text.sub!(',', '').to_i
-    while edit_count < min_edit_count
-      edit_count += 1
-      on(APIPage).create title, "Test is used by Selenium web driver edit #" + 
edit_count.to_s
+    (page.edit_count.gsub(',', '').to_i + 1).upto(min_edit_count) do |n|
+      on(APIPage).create title, "Test is used by Selenium web driver edit 
##{n}"
     end
   end
 end
diff --git a/tests/browser/features/step_definitions/editor_steps.rb 
b/tests/browser/features/step_definitions/editor_steps.rb
index 01d673c..08e355f 100644
--- a/tests/browser/features/step_definitions/editor_steps.rb
+++ b/tests/browser/features/step_definitions/editor_steps.rb
@@ -8,6 +8,10 @@
   on(ArticlePage).edit_link_element.when_present.click
 end
 
+Then(/^I see the wikitext editor$/) do
+  on(ArticlePage).editor_textarea_element.when_present.should be_visible
+end
+
 Then(/^I see the wikitext editor overlay$/) do
   on(ArticlePage).editor_textarea_element.when_present.should be_visible
 end
@@ -18,9 +22,7 @@
 
 Then(/^I should not see the wikitext editor overlay$/) do
   on(ArticlePage) do |page|
-    page.wait_until do
-      page.editor_overlay_element.visible? != true
-      end
+    page.wait_until { !page.editor_overlay_element.visible? }
     page.editor_overlay_element.should_not be_visible
   end
 end
diff --git a/tests/browser/features/step_definitions/editor_ve_steps.rb 
b/tests/browser/features/step_definitions/editor_ve_steps.rb
index a79ae01..9906265 100644
--- a/tests/browser/features/step_definitions/editor_ve_steps.rb
+++ b/tests/browser/features/step_definitions/editor_ve_steps.rb
@@ -1,53 +1,61 @@
+Given(/^I am editing a new article with VisualEditor$/) do
+  api.create_page "Selenium Test Edit", ""
+  step 'I am on the "Selenium Test Edit" page'
+  step "I click the edit button"
+  step "I click the editor mode switcher button"
+  step "I click the VisualEditor button"
+  step "VisualEditor has loaded"
+end
+
 Given(/^VisualEditor has loaded$/) do
-  on(ArticlePage).editor_ve_element.when_present(20).should exist
+  expect(on(ArticlePage).editor_ve_element.when_present(20)).to exist
 end
 
-Then(/^I see the VisualEditor$/) do
-  on(ArticlePage).editor_ve_element.when_present.should exist
+When(/^I switch to editing the source$/) do
+  step "I click the editor mode switcher button"
+  step "I click the source editor button"
 end
 
-Then(/^I see the VisualEditor overlay$/) do
-  on(ArticlePage).overlay_ve_element.when_present.should exist
+When(/^I look at the VisualEditor toolbar$/) do
+  expect(on(ArticlePage).overlay_ve_header_toolbar_element).to exist
 end
 
-Then(/^I do not see the VisualEditor overlay$/) do
-  on(ArticlePage).overlay_ve_element.when_not_present(15)
+Then(/^I see a bold button$/) do
+  expect(on(ArticlePage).overlay_ve_header_toolbar_bold_button_element).to 
exist
 end
 
-Then(/^I see a toolbar in the overlay header$/) do
-  on(ArticlePage).overlay_ve_header_toolbar_element.when_present.should exist
+Then(/^I see an italicize button$/) do
+  expect(on(ArticlePage).overlay_ve_header_toolbar_italic_button_element).to 
exist
 end
 
-Then(/^the VisualEditor toolbar has a bold button$/) do
-  
on(ArticlePage).overlay_ve_header_toolbar_bold_button_element.when_present.should
 exist
-end
-
-Then(/^the VisualEditor toolbar has an italic button$/) do
-  
on(ArticlePage).overlay_ve_header_toolbar_italic_button_element.when_present.should
 exist
-end
-
-Then(/^the VisualEditor overlay has an editor mode switcher button$/) do
-  on(ArticlePage).overlay_editor_mode_switcher_element.when_present.should 
exist
-end
-
-Then(/^the wikitext editor overlay has an editor mode switcher button$/) do
-  on(ArticlePage).overlay_editor_mode_switcher_element.when_present.should 
exist
-end
-
-Given(/^I type "(.+)" into VisualEditor$/) do |text|
+When(/^I edit the article using VisualEditor$/) do
   on(ArticlePage) do |page|
-    page.editor_ve_element.when_present(15).fire_event("onfocus")
-    page.editor_ve_element.when_present.send_keys(text)
+    @article_text = page.type_into(:editor_ve)
+
+    expect(page.editor_ve).to include(@article_text)
+
+    page.wait_until { page.continue_button_element.enabled? }
+    page.continue_button
+
+    page.wait_until { page.submit_button_element.enabled? }
+    page.confirm(true) { page.submit_button }
   end
 end
 
-Given(/^I click the edit button for section (\d+)$/) do |arg1|
-  on(ArticlePage).link_element(css: ".edit-page", index: 
arg1.to_i).when_present.click
+Then(/^I see the edit reflected in the article content$/) do
+  on(ArticlePage) do |page|
+    page.wait_until { page.toast.include?("Your edit was saved") }
+    page.wait_until { page.content_element.visible? }
+
+    expect(page.content).to include(@article_text)
+  end
 end
 
-Given(/^I switch to VisualEditor$/) do
-  step "I see the wikitext editor overlay"
-       step "the wikitext editor overlay has an editor mode switcher button"
-       step "I click the editor mode switcher button"
-       step "I click the VisualEditor button"
+Then(/^I see the article content$/) do
+  expect(on(ArticlePage).content_element.when_present).to exist
 end
+
+Then(/^I no longer see the VisualEditor$/) do
+  expect(on(ArticlePage).editor_ve_element).to_not exist
+end
+
diff --git a/tests/browser/features/step_definitions/messages_steps.rb 
b/tests/browser/features/step_definitions/messages_steps.rb
new file mode 100644
index 0000000..2d6fcda
--- /dev/null
+++ b/tests/browser/features/step_definitions/messages_steps.rb
@@ -0,0 +1,3 @@
+Then('I should see the error "$message"') do |message|
+  expect(on(ArticlePage).error_message).to match(message)
+end
diff --git a/tests/browser/features/step_definitions/nearby_steps.rb 
b/tests/browser/features/step_definitions/nearby_steps.rb
index 199d074..38d3890 100644
--- a/tests/browser/features/step_definitions/nearby_steps.rb
+++ b/tests/browser/features/step_definitions/nearby_steps.rb
@@ -7,14 +7,14 @@
 Then(/^I should see at least one result in the nearby items list$/) do
   on(ArticlePage) do |page|
     page.page_list_element.when_present(20).should be_visible
-    page.page_list_element.link_element(:css => "a.title" ).should be_visible
+    page.page_list_element.link_element(class: "title").should be_visible
   end
 end
 
 When(/^I click a nearby result$/) do
-  on(ArticlePage).page_list_element.when_present(20).link_element(:css => 
"a.title" ).click
+  on(ArticlePage).page_list_element.when_present(20).link_element(class: 
"title").click
 end
 
 Then(/^I see the page preview overlay$/) do
-  on(ArticlePage).overlay_element.when_present(20).div_element(:class => 
"content").should be_visible
+  on(ArticlePage).overlay_element.when_present(20).div_element(class: 
"content").should be_visible
 end
diff --git a/tests/browser/features/step_definitions/uploads_steps.rb 
b/tests/browser/features/step_definitions/uploads_steps.rb
index 551e671..452be77 100644
--- a/tests/browser/features/step_definitions/uploads_steps.rb
+++ b/tests/browser/features/step_definitions/uploads_steps.rb
@@ -1,4 +1,3 @@
-
 Given(/^I can see the uploads interface$/) do
   on(UploadPage).contribute_image_element.when_present
 end
diff --git a/tests/browser/features/step_definitions/watchstar_steps.rb 
b/tests/browser/features/step_definitions/watchstar_steps.rb
index 1bdc4e6..1c2912c 100644
--- a/tests/browser/features/step_definitions/watchstar_steps.rb
+++ b/tests/browser/features/step_definitions/watchstar_steps.rb
@@ -1,5 +1,25 @@
-Given(/^the page is unwatched$/) do
-  unwatch_url = ENV["MEDIAWIKI_URL"] + @random_string + "?action=unwatch"
-  @browser.goto(unwatch_url)
-  on(ArticlePage).watch_confirm_element.when_present.click
+Given(/^I am viewing a watched page$/) do
+  api.create_page "Selenium mobile watch test", "watch test"
+  api.watch_page "Selenium mobile watch test"
+  step 'I am on the "Selenium mobile watch test" page'
 end
+
+Given(/^I am viewing an unwatched page$/) do
+  api.create_page "Selenium mobile watch test", "watch test"
+  api.unwatch_page "Selenium mobile watch test"
+  step 'I am on the "Selenium mobile watch test" page'
+end
+
+Then(/^I see a toast with message about watching the page$/) do
+  expect(on(ArticlePage).toast_element.when_present.text).to match "Added 
Selenium mobile watch test to your watchlist"
+end
+
+Then(/^I see a toast with message about unwatching the page$/) do
+  on(ArticlePage) do |page|
+    page.wait_until do
+      page.text.include? "Removed" #Chrome needs this, FF does not
+    end
+    expect(page.toast_element.when_present.text).to match "Removed Selenium 
mobile watch test from your watchlist"
+  end
+end
+
diff --git a/tests/browser/features/support/env.rb 
b/tests/browser/features/support/env.rb
index 491c8ce..febb48d 100644
--- a/tests/browser/features/support/env.rb
+++ b/tests/browser/features/support/env.rb
@@ -1,10 +1,4 @@
-require "mediawiki_selenium"
-require "mediawiki_api"
+require "rubygems"
+require "bundler/setup"
 
-def set_cookie(browser)
-  # we can set cookies only for current domain
-  # see http://code.google.com/p/selenium/issues/detail?id=1953
-  browser.goto URL.url("Main_Page")
-  # set a cookie forcing mobile mode
-  browser.cookies.add "mf_useformat", "true"
-end
+Bundler.require
diff --git a/tests/browser/features/support/hooks.rb 
b/tests/browser/features/support/hooks.rb
index 85309f3..6bc910b 100644
--- a/tests/browser/features/support/hooks.rb
+++ b/tests/browser/features/support/hooks.rb
@@ -1,2 +1,2 @@
 # Needed for cucumber --dry-run -f stepdefs
-require 'page-object'
+require_relative "env"
diff --git a/tests/browser/features/support/modules/url_module.rb 
b/tests/browser/features/support/modules/url_module.rb
deleted file mode 100644
index 6c329e8..0000000
--- a/tests/browser/features/support/modules/url_module.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-module URL
-  def self.url(name)
-    if ENV["MEDIAWIKI_URL"]
-      mediawiki_url = ENV["MEDIAWIKI_URL"]
-    else
-      mediawiki_url = "http://127.0.0.1:80/w/index.php";
-    end
-    "#{mediawiki_url}#{name}"
-  end
-end
diff --git a/tests/browser/features/support/pages/article_page.rb 
b/tests/browser/features/support/pages/article_page.rb
index a25309f..6e8efb3 100644
--- a/tests/browser/features/support/pages/article_page.rb
+++ b/tests/browser/features/support/pages/article_page.rb
@@ -12,10 +12,10 @@
   a(:edit_history_link, id: "mw-mf-last-modified")
 
   # left nav
-  div(:navigation, css:"#mw-mf-page-left")
-  a(:watchlist_link, css:"#mw-mf-page-left .icon-watchlist a")
-  a(:about_link, text: "About Wikipedia")
-  a(:disclaimer_link, text: "Disclaimers")
+  div(:navigation, css: "#mw-mf-page-left")
+  a(:watchlist_link, css: "#mw-mf-page-left .icon-watchlist a")
+  a(:about_link) { |page| page.navigation_element.link_element(text: /^About/) 
}
+  a(:disclaimer_link) { |page| page.navigation_element.link_element(text: 
"Disclaimers") }
 
   # last modified bar
   a(:last_modified_bar_history_link, css: "#mw-mf-last-modified a", index: 0)
@@ -93,10 +93,10 @@
   div(:visual_editor_button, css: ".visual-editor")
 
   # editor
-  textarea(:editor_textarea, css: ".wikitext-editor")
-  button(:escape_button, css:".back.icon")
-  button(:continue_button, css:".continue")
-  button(:submit_button, css:".submit")
+  textarea(:editor_textarea, class: "wikitext-editor")
+  button(:escape_button, class: "icon-back")
+  button(:continue_button, class: "continue")
+  button(:submit_button, class: "submit")
 
   # drawer
   div(:drawer, class:"drawer position-fixed visible")
@@ -126,10 +126,11 @@
   div(:spinner_loading, class: "spinner loading")
 
   # toast
-  div(:toast, css: ".toast")
+  div(:toast, class: "toast")
 
   #loader
-  div(:content_wrapper, id:'content_wrapper')
+  div(:content_wrapper, id: 'content_wrapper')
+  div(:content, id: 'content')
 
   # secondary menu
   ## languages
@@ -164,4 +165,17 @@
   # error and warning boxes
   div(:warning_box, css: ".warning")
   div(:error_message, css: ".error")
+
+  # Enters the given or random text into the given element. Note that a click
+  # event is used over focus to properly handle content-editable elements.
+  #
+  def type_into(element_name, text = nil)
+    text ||= "text-#{rand(32 ** 8).to_s(32)}"
+
+    element = send("#{element_name}_element")
+    element.click
+    element.send_keys(:enter, text)
+
+    text
+  end
 end
diff --git a/tests/browser/features/support/pages/main_page.rb 
b/tests/browser/features/support/pages/main_page.rb
new file mode 100644
index 0000000..b1857be
--- /dev/null
+++ b/tests/browser/features/support/pages/main_page.rb
@@ -0,0 +1,6 @@
+class MainPage
+  include PageObject
+  include URL
+
+  page_url URL.url("Main_Page")
+end
diff --git a/tests/browser/features/support/pages/special_uploads_page.rb 
b/tests/browser/features/support/pages/special_uploads_page.rb
index 3cef9df..4dabdbb 100644
--- a/tests/browser/features/support/pages/special_uploads_page.rb
+++ b/tests/browser/features/support/pages/special_uploads_page.rb
@@ -5,7 +5,7 @@
   include URL
   page_url URL.url("Special:Uploads")
 
-  div(:contribute_image, css: ".ctaUploadPhoto button")
+  div(:contribute_image, class: "ctaUploadPhoto")
   # This may seem confusing but one is a DIV and one is an A tag
   a(:tutorial_link, href: "#/upload-tutorial/uploads")
   file_field(:select_file, name: 'file')
diff --git a/tests/browser/features/support/pages/special_userlogin_page.rb 
b/tests/browser/features/support/pages/special_userlogin_page.rb
index 668079f..d8bebf1 100644
--- a/tests/browser/features/support/pages/special_userlogin_page.rb
+++ b/tests/browser/features/support/pages/special_userlogin_page.rb
@@ -1,31 +1,32 @@
 class SpecialUserLoginPage < ArticlePage
   include PageObject
-
   include URL
+
   page_url URL.url("Special:UserLogin")
 
+  h1(:first_heading, id: "firstHeading")
   div(:login_head_message, class: "headmsg")
 
   div(:feedback, class: "errorbox")
   button(:login, id: "wpLoginAttempt")
-  text_field(:username, id: "wpName1")
+  text_field(:username, name: "wpName")
   text_field(:password, name: "wpPassword")
-  text_field(:confirm_password, id:"wpRetype")
+  text_field(:confirm_password, id: "wpRetype")
   a(:login_wl, class: "button")
-  button(:signup_submit, id:"wpCreateaccount")
+  button(:signup_submit, id: "wpCreateaccount")
   a(:create_account_link, text: "Create account")
-  div(:message_box, class:"headmsg")
+  div(:message_box, class: "headmsg")
   a(:password_reset, css:".mw-userlogin-help")
-
-  def login_with(username, password)
-    # deal with autocomplete
-    self.username_element.when_present.clear()
-    self.username_element.when_present.send_keys(username)
-    self.password_element.when_present.send_keys(password)
-    login
-  end
 
   # signup specific
   text_field(:confirmation_field, id: "wpCaptchaWord")
   div(:refresh_captcha, id:"mf-captcha-reload-container")
+
+  def login_with(username, password)
+    # deal with autocomplete
+    self.username_element.when_present.clear
+    self.username = username
+    self.password = password
+    login
+  end
 end
diff --git a/tests/browser/features/talk.feature 
b/tests/browser/features/talk.feature
index 9d9683a..cddd3e7 100644
--- a/tests/browser/features/talk.feature
+++ b/tests/browser/features/talk.feature
@@ -1,15 +1,17 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Talk
   Background:
-    Given I am in beta mode
+    Given I am using the mobile site
+      And I am in beta mode
 
   Scenario: Talk doesn't show on talk pages
-    Given the page "Talk:Selenium talk test page" exists
+    Given the page "Talk:Selenium talk test" exists
+      And I am on the "Talk:Selenium talk test" page
     Then there is no talk button
 
   Scenario: Talk on a page that does exist
-    Given the page "Talk:Selenium talk test page" exists
-      And the page "Selenium talk test page" exists
+    Given the page "Talk:Selenium talk test" exists
+      And the page "Selenium talk test" exists
     When I click the talk button
     Then I see the talk overlay
 
diff --git a/tests/browser/features/toc.feature 
b/tests/browser/features/toc.feature
index f697722..5969afa 100644
--- a/tests/browser/features/toc.feature
+++ b/tests/browser/features/toc.feature
@@ -1,6 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login 
@test2.m.wikipedia.org @vagrant
 Feature: Table of contents
 
+  Background:
+    Given I am using the mobile site
+
   Scenario: Don't show table of contents on mobile
     Given I am viewing the site in mobile mode
     When I go to a page that has sections
diff --git a/tests/browser/features/toggling.feature 
b/tests/browser/features/toggling.feature
index bf380ff..60539ad 100644
--- a/tests/browser/features/toggling.feature
+++ b/tests/browser/features/toggling.feature
@@ -1,8 +1,9 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Toggling sections
 
   Background:
-    Given I am viewing the site in mobile mode
+    Given I am using the mobile site
+      And I am viewing the site in mobile mode
       And I go to a page that has sections
 
   Scenario: Respect the hash on sections
@@ -13,7 +14,7 @@
     When I click on the first collapsible section heading
     Then I see the content of the first section
 
-  Scenario: Closing  a section on mobile
+  Scenario: Closing a section on mobile
     When I click on the first collapsible section heading
       And I click on the first collapsible section heading
     Then I do not see the content of the first section
diff --git a/tests/browser/features/toggling_tablet.feature 
b/tests/browser/features/toggling_tablet.feature
index f9a219b..9da13ca 100644
--- a/tests/browser/features/toggling_tablet.feature
+++ b/tests/browser/features/toggling_tablet.feature
@@ -1,8 +1,11 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @vagrant
 Feature: Toggling sections
+
+  Background:
+    Given I am using the mobile site
 
   Scenario: Section open by default on tablet
     Given I am viewing the site in tablet mode
-    And I go to a page that has sections
+      And I go to a page that has sections
     When I click on the first collapsible section heading
     Then I do not see the content of the first section
diff --git a/tests/browser/features/ui_links.feature 
b/tests/browser/features/ui_links.feature
index a6f8fcf..40ea0db 100644
--- a/tests/browser/features/ui_links.feature
+++ b/tests/browser/features/ui_links.feature
@@ -1,9 +1,12 @@
 @chrome @en.m.wikipedia.beta.wmflabs.org @firefox
 Feature: Check UI components
 
+  Background:
+    Given I am using the mobile site
+
   Scenario: Check existence of important UI components on the main page
-    Given I am on the "Main Page" page
-      And the wiki has a terms of use
+    Given the wiki has a terms of use
+      And I am on the "Main Page" page
     Then I see the history link
       And I see the switch to desktop link
       And I see the license link
diff --git a/tests/browser/features/uploads_copyvio.feature 
b/tests/browser/features/uploads_copyvio.feature
index ae067d9..277ce08 100644
--- a/tests/browser/features/uploads_copyvio.feature
+++ b/tests/browser/features/uploads_copyvio.feature
@@ -3,7 +3,8 @@
 Feature: Image uploads copyvio notice
 
   Background:
-    Given I am logged in as a user with a > 0 edit count
+    Given I am using the mobile site
+      And I am logged in as a user with a > 0 edit count
       And I am on the "Nonexistent_page_abc" page
       And I click on the lead photo upload button
 
diff --git a/tests/browser/features/uploads_lead.feature 
b/tests/browser/features/uploads_lead.feature
index 7958b0d..70ed100 100644
--- a/tests/browser/features/uploads_lead.feature
+++ b/tests/browser/features/uploads_lead.feature
@@ -2,7 +2,8 @@
 Feature: Lead image uploads
 
   Background:
-    Given I am logged in as a user with a > 0 edit count
+    Given I am using the mobile site
+      And I am logged in as a user with a > 0 edit count
       And I am on the "Nonexistent_page_abc" page
       And I click on the lead photo upload button
       And I upload file "exif.jpg"
diff --git a/tests/browser/features/uploads_page_tutorial.feature 
b/tests/browser/features/uploads_page_tutorial.feature
index a6a095e..a09b03a 100644
--- a/tests/browser/features/uploads_page_tutorial.feature
+++ b/tests/browser/features/uploads_page_tutorial.feature
@@ -2,6 +2,7 @@
 Feature: Special:Uploads tutorial
 
   Scenario: Link to tutorial for new user
-    Given I am logged in as a new user
+    Given I am using the mobile site
+      And I am logged in as a new user
     When I go to uploads page
     Then the upload button links to the tutorial
diff --git a/tests/browser/features/watchstar.feature 
b/tests/browser/features/watchstar.feature
index 260a55f..98780c3 100644
--- a/tests/browser/features/watchstar.feature
+++ b/tests/browser/features/watchstar.feature
@@ -1,21 +1,17 @@
-@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @login @test2.m.wikipedia.org
+@chrome @en.m.wikipedia.beta.wmflabs.org @firefox @test2.m.wikipedia.org 
@vagrant
 Feature: Manage Watchlist
 
   Background:
-    Given I create a random page using the API
-      And I am logged into the mobile website
-      And I am on the random page
-      And the page is unwatched
+    Given I am logged into the mobile website
 
   Scenario: Add an article to the watchlist
+    Given I am viewing an unwatched page
     When I click the watch star
-    Then I see a toast notification
-      And I see a toast with message about adding the random page
+    Then I see a toast with message about watching the page
       And the watch star is selected
 
   Scenario: Remove an article from the watchlist
-    When I click the watch star
-      And I click the unwatch star
-    Then I see a toast notification
-      And I see a toast with message about removing the random page
+    Given I am viewing a watched page
+    When I click the unwatch star
+    Then I see a toast with message about unwatching the page
       And the watch star is not selected

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Icbd9958b42222343879a48f34147c9595e03bcdc
Gerrit-PatchSet: 9
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Dduvall <[email protected]>
Gerrit-Reviewer: Awjrichards <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Dduvall <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Zfilipin <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to