Mgrover has uploaded a new change for review.

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


Change subject: Stable Automation Tests for logged in/logged out QA:#1136
......................................................................

Stable Automation Tests for logged in/logged out QA:#1136

Change-Id: Icb2fc6e8ec9f22609dbc71ddeaadf65cacb1735b
---
A tests/acceptance/features/create_article.feature
A tests/acceptance/features/footer.feature
A tests/acceptance/features/footer_logged_in.feature
A tests/acceptance/features/header.feature
A tests/acceptance/features/header_logged_in.feature
A tests/acceptance/features/language.feature
A tests/acceptance/features/language_logged_in.feature
A tests/acceptance/features/notification.feature
A tests/acceptance/features/step_definitions/create_article_steps.rb
A tests/acceptance/features/step_definitions/footer_steps.rb
A tests/acceptance/features/step_definitions/header_logged_in_steps.rb
A tests/acceptance/features/step_definitions/header_steps.rb
A tests/acceptance/features/step_definitions/language_steps.rb
M tests/acceptance/features/step_definitions/menu_opens_page_steps.rb
A tests/acceptance/features/step_definitions/notification_steps.rb
M tests/acceptance/features/step_definitions/watchlist_steps.rb
A tests/acceptance/features/support/pages/create_article_page.rb
A tests/acceptance/features/support/pages/create_user_page.rb
A tests/acceptance/features/support/pages/edit_page.rb
M tests/acceptance/features/support/pages/home_page.rb
A tests/acceptance/features/support/pages/language_page.rb
M tests/acceptance/features/support/pages/login_page.rb
A tests/acceptance/features/support/pages/notification_page.rb
23 files changed, 303 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend 
refs/changes/79/81179/1

diff --git a/tests/acceptance/features/create_article.feature 
b/tests/acceptance/features/create_article.feature
new file mode 100644
index 0000000..fbb3ede
--- /dev/null
+++ b/tests/acceptance/features/create_article.feature
@@ -0,0 +1,6 @@
+Feature: Create Article
+
+  Scenario: Create Article
+
+    Given I am logged into the mobile website
+      And SelAutomationTestArticle has not been created
diff --git a/tests/acceptance/features/footer.feature 
b/tests/acceptance/features/footer.feature
new file mode 100644
index 0000000..4ef9785
--- /dev/null
+++ b/tests/acceptance/features/footer.feature
@@ -0,0 +1,24 @@
+Feature: Footer links resolve
+
+  Background:
+    Given I am on the home page
+
+    Scenario: View Edit history link resolves
+      When I click on the view edit history link
+      Then I go to the edit history page
+
+    Scenario: Desktop link resolves
+      When I click on the desktop link
+      Then I go to the desktop wiki page
+
+    Scenario:
+      When I click on the CC BY-SA link
+      Then I go to the CC BY-SA page
+
+    Scenario:
+      When I click on the Terms of Use link
+      Then I go to the Terms of Use page
+
+    Scenario:
+      When I click on the Privacy link
+      Then I go to the Privacy page
\ No newline at end of file
diff --git a/tests/acceptance/features/footer_logged_in.feature 
b/tests/acceptance/features/footer_logged_in.feature
new file mode 100644
index 0000000..b197977
--- /dev/null
+++ b/tests/acceptance/features/footer_logged_in.feature
@@ -0,0 +1,25 @@
+Feature: Feature: Footer links resolve - Logged In
+
+  Background:
+    Given I am logged into the mobile website
+      And I am on the home page
+
+    Scenario: View Edit history link resolves
+      When I click on the view edit history link
+      Then I go to the edit history page
+
+    Scenario: Desktop link resolves
+      When I click on the desktop link
+      Then I go to the desktop wiki page
+
+    Scenario:
+      When I click on the CC BY-SA link
+      Then I go to the CC BY-SA page
+
+    Scenario:
+      When I click on the Terms of Use link
+      Then I go to the Terms of Use page
+
+    Scenario:
+      When I click on the Privacy link
+      Then I go to the Privacy page
\ No newline at end of file
diff --git a/tests/acceptance/features/header.feature 
b/tests/acceptance/features/header.feature
new file mode 100644
index 0000000..95b882b
--- /dev/null
+++ b/tests/acceptance/features/header.feature
@@ -0,0 +1,17 @@
+Feature: Header Validation
+
+  Background:
+    Given I am on the home page
+
+  Scenario: Receive notification message - Edit Icon
+    When I click the edit icon
+    Then I receive edit icon message You must be logged in to edit pages on 
mobile.
+
+
+  Scenario: Receive notification message - Upload Icon
+    When I click on the upload icon
+    Then I receive upload icon message You need to be logged in to add an 
image to this page.
+
+  Scenario: Receive notification message - Watchlist Icon
+    When I click on watchlist icon
+    Then I receive watchlist icon message Please login or sign up to watch 
this page.
\ No newline at end of file
diff --git a/tests/acceptance/features/header_logged_in.feature 
b/tests/acceptance/features/header_logged_in.feature
new file mode 100644
index 0000000..f646ac4
--- /dev/null
+++ b/tests/acceptance/features/header_logged_in.feature
@@ -0,0 +1,19 @@
+Feature: Header Validation - Logged In
+
+  Background:
+    Given I am logged into the mobile website
+      And I am on the home page
+      And I click on Random from the left Nav
+
+  Scenario: Edit mode
+    When I click the enabled edit icon
+    Then I can click Cancel
+
+
+  Scenario: Uploading Image
+    When I click on the upload icon
+    Then I receive upload dialog
+
+  Scenario: Watchlist icon from article page
+    When I click on watchlist icon
+    Then I receive notification that the article has been added to the 
watchlist
\ No newline at end of file
diff --git a/tests/acceptance/features/language.feature 
b/tests/acceptance/features/language.feature
new file mode 100644
index 0000000..d374a49
--- /dev/null
+++ b/tests/acceptance/features/language.feature
@@ -0,0 +1,6 @@
+Feature: Language Validation
+
+  Scenario: Validate Language selection availability
+    Given I am on the home page
+    When I click the language button
+    Then I move to the language screen
\ No newline at end of file
diff --git a/tests/acceptance/features/language_logged_in.feature 
b/tests/acceptance/features/language_logged_in.feature
new file mode 100644
index 0000000..e074508
--- /dev/null
+++ b/tests/acceptance/features/language_logged_in.feature
@@ -0,0 +1,9 @@
+Feature: Language Validation - Logged In
+
+    Background:
+      Given I am logged into the mobile website
+
+    Scenario: Validate Language selection availability
+      And I am on the home page
+      When I click the language button
+      Then I move to the language screen
\ No newline at end of file
diff --git a/tests/acceptance/features/notification.feature 
b/tests/acceptance/features/notification.feature
new file mode 100644
index 0000000..854f349
--- /dev/null
+++ b/tests/acceptance/features/notification.feature
@@ -0,0 +1,8 @@
+Feature: Notification
+
+  Scenario: Notification Validation
+    Given I am logged into the mobile website
+    When I click on the notification icon
+    Then I go to the notifications page
+
+
diff --git a/tests/acceptance/features/step_definitions/create_article_steps.rb 
b/tests/acceptance/features/step_definitions/create_article_steps.rb
new file mode 100644
index 0000000..ad4e7d3
--- /dev/null
+++ b/tests/acceptance/features/step_definitions/create_article_steps.rb
@@ -0,0 +1,7 @@
+Given /^(.+) has not been created$/ do |article|
+  visit(CreateArticlePage, :using_params => {:article_name => article})
+  if on(CreateArticlePage).doesnotexist_msg_element.element
+    on(EditPage).edit_icon_enabled_element.when_present.click
+  end
+end
+
diff --git a/tests/acceptance/features/step_definitions/footer_steps.rb 
b/tests/acceptance/features/step_definitions/footer_steps.rb
new file mode 100644
index 0000000..043b652
--- /dev/null
+++ b/tests/acceptance/features/step_definitions/footer_steps.rb
@@ -0,0 +1,39 @@
+When(/^I click on the view edit history link$/) do
+  on(HomePage).edit_history_link_element.when_present.click
+end
+
+Then(/^I go to the edit history page$/) do
+  @browser.url.should match Regexp.escape('Main_Page&action=history')
+end
+
+When /^I click on the desktop link$/ do
+  on(HomePage).desktop_link_element.when_present.click
+end
+
+Then /^I go to the desktop wiki page$/ do
+  @browser.url.should match Regexp.escape('toggle_view_desktop')
+end
+
+When /^I click on the CC BY\-SA link$/ do
+  on(HomePage).content_link_element.when_present.click
+end
+
+Then /^I go to the CC BY\-SA page$/ do
+  @browser.url.should match 
Regexp.escape('Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License?useformat=mobile')
+end
+
+When /^I click on the Terms of Use link$/ do
+  on(HomePage).terms_link_element.when_present.click
+end
+
+Then /^I go to the Terms of Use page$/ do
+  @browser.url.should match Regexp.escape('Terms_of_use?useformat=mobile')
+end
+
+When /^I click on the Privacy link$/ do
+  on(HomePage).privacy_link_element.when_present.click
+end
+
+Then(/^I go to the Privacy page$/) do
+  @browser.url.should match Regexp.escape('Privacy_policy')
+end
\ No newline at end of file
diff --git 
a/tests/acceptance/features/step_definitions/header_logged_in_steps.rb 
b/tests/acceptance/features/step_definitions/header_logged_in_steps.rb
new file mode 100644
index 0000000..3cbc2a6
--- /dev/null
+++ b/tests/acceptance/features/step_definitions/header_logged_in_steps.rb
@@ -0,0 +1,11 @@
+Then /^I click the enabled edit icon$/ do
+  on(HomePage).edit_icon_enabled_element.when_present.click
+end
+
+Then /^I can click Cancel$/ do
+  on(EditPage).edit_cancel_button_element.when_present.click
+end
+
+Then /^I receive upload dialog$/ do
+  pending # express the regexp above with the code you wish you had
+end
diff --git a/tests/acceptance/features/step_definitions/header_steps.rb 
b/tests/acceptance/features/step_definitions/header_steps.rb
new file mode 100644
index 0000000..5d4b230
--- /dev/null
+++ b/tests/acceptance/features/step_definitions/header_steps.rb
@@ -0,0 +1,26 @@
+
+When /^I click the edit icon$/  do
+ on(HomePage).edit_icon_element.when_present.click
+end
+
+Then /^I receive edit icon message (.+)$/  do |text|
+  on(HomePage).fe_notification_element.when_present.text.should match text
+end
+
+When /^I click on the upload icon$/  do
+ on(HomePage).upload_icon_element.when_present.click
+end
+
+Then /^I receive upload icon message (.+)$/  do  |text|
+  on(HomePage).rl_notification_element.when_present.text.should match text
+end
+
+When /^I click on watchlist icon$/  do
+  on(HomePage).watch_link_element.when_present.click
+end
+
+Then /^I receive watchlist icon message (.+)$/ do |text|
+  on(HomePage).fe_notification_element.when_present.text.should match text
+end
+
+
diff --git a/tests/acceptance/features/step_definitions/language_steps.rb 
b/tests/acceptance/features/step_definitions/language_steps.rb
new file mode 100644
index 0000000..f638c07
--- /dev/null
+++ b/tests/acceptance/features/step_definitions/language_steps.rb
@@ -0,0 +1,11 @@
+When /^I click the language button$/ do
+  on(HomePage).language_button_element.when_present.click
+end
+
+Then /^I move to the language screen$/ do
+  on(LanguagePage)  do |page|
+  page.number_languages_element.element.should exist
+  page.search_box_placeholder_element.element.when_present.set 'Esp'
+  page.language_search_results_element.element.should exist
+  end
+end
diff --git 
a/tests/acceptance/features/step_definitions/menu_opens_page_steps.rb 
b/tests/acceptance/features/step_definitions/menu_opens_page_steps.rb
index 85847b1..4bb7c80 100644
--- a/tests/acceptance/features/step_definitions/menu_opens_page_steps.rb
+++ b/tests/acceptance/features/step_definitions/menu_opens_page_steps.rb
@@ -32,6 +32,17 @@
   on(RandomPage).watchlist_link_element.when_present.click
 end
 
+When /^I click on About Wikipedia from the left Nav$/ do
+  on(HomePage).mainmenu_button_element.when_present.click
+  on(HomePage).about_link_element.when_present.click
+end
+
+
+When /^I click on the Disclaimer link on the left Nav$/ do
+  on(HomePage).mainmenu_button_element.when_present.click
+  on(HomePage).disclaimer_link_element.when_present.click
+end
+
 Then /^my URL should be set to the Watchlist Page$/ do
   @browser.url.should match Regexp.escape('Special%3AWatchlist')
 end
@@ -58,4 +69,13 @@
 
 Then /^my URL should be set to the Log In Page$/ do
   @browser.url.should match Regexp.escape('Special:UserLogin')
-end
\ No newline at end of file
+end
+
+Then /^my URL should be set to the About Wikipedia Page$/ do
+  @browser.url.should match Regexp.escape('Wikipedia:About')
+end
+
+
+Then /^my URL should be set to the Disclaimer Page$/ do
+  @browser.url.should match Regexp.escape('Wikipedia:General_disclaimer')
+end
diff --git a/tests/acceptance/features/step_definitions/notification_steps.rb 
b/tests/acceptance/features/step_definitions/notification_steps.rb
new file mode 100644
index 0000000..dc49fe2
--- /dev/null
+++ b/tests/acceptance/features/step_definitions/notification_steps.rb
@@ -0,0 +1,8 @@
+When /^I click on the notification icon$/ do
+  on(HomePage).notification_button_element.when_present.click
+end
+
+Then /^I go to the notifications page$/  do
+  @browser.url.should match Regexp.escape('Special:Notifications')
+end
+
diff --git a/tests/acceptance/features/step_definitions/watchlist_steps.rb 
b/tests/acceptance/features/step_definitions/watchlist_steps.rb
index dee4f12..a37e4e3 100644
--- a/tests/acceptance/features/step_definitions/watchlist_steps.rb
+++ b/tests/acceptance/features/step_definitions/watchlist_steps.rb
@@ -24,14 +24,26 @@
   end
 end
 
-#Signup takes you to the sign in page... should it take you to the Mobile 
Create Account page??
-
 Given /^I am logged into the mobile website$/ do
   visit(HomePage) do |page|
     page.mainmenu_button_element.when_present.click
     page.login_button
   end
-  on(LoginPage).login_with(@mediawiki_username, @mediawiki_password)
+  on(LoginPage) do |page|
+  page.login_with(@mediawiki_username, @mediawiki_password)
+  if page.text.include? "There is no user by the name "
+    puts @mediawiki_username + ' does not exist... trying to add user'
+    on(HomePage).create_account_element.when_present.click
+    on(LoginPage) do |page|
+      page.username_element.element.when_present.set @mediawiki_username
+      page.signup_password_element.element.when_present.set @mediawiki_password
+      page.confirm_password_element.element.when_present.set 
@mediawiki_password
+      page.signup_submit_element.element.when_present.click
+      page.text.should include 'Welcome, ' + @mediawiki_username + '!'
+      #Can't get around captcha in order to create a user
+    end
+  end
+  end
 end
 
 When /^I go to random page$/ do
diff --git a/tests/acceptance/features/support/pages/create_article_page.rb 
b/tests/acceptance/features/support/pages/create_article_page.rb
new file mode 100644
index 0000000..0654e1c
--- /dev/null
+++ b/tests/acceptance/features/support/pages/create_article_page.rb
@@ -0,0 +1,8 @@
+class CreateArticlePage
+  include PageObject
+
+  include URL
+  page_url URL.url('<%=params[:article_name]%>')
+
+  a(:doesnotexist_msg, text:'Look for pages within Wikipedia that link to this 
title')
+end
\ No newline at end of file
diff --git a/tests/acceptance/features/support/pages/create_user_page.rb 
b/tests/acceptance/features/support/pages/create_user_page.rb
new file mode 100644
index 0000000..1e2174f
--- /dev/null
+++ b/tests/acceptance/features/support/pages/create_user_page.rb
@@ -0,0 +1,6 @@
+class CreateUserPage
+include PageObject
+
+
+
+end
diff --git a/tests/acceptance/features/support/pages/edit_page.rb 
b/tests/acceptance/features/support/pages/edit_page.rb
new file mode 100644
index 0000000..b0d0f58
--- /dev/null
+++ b/tests/acceptance/features/support/pages/edit_page.rb
@@ -0,0 +1,6 @@
+class EditPage
+  include PageObject
+
+  button(:edit_cancel_button, text:'Cancel')
+  button(:edit_continue_button, text:'Continue')
+end
\ No newline at end of file
diff --git a/tests/acceptance/features/support/pages/home_page.rb 
b/tests/acceptance/features/support/pages/home_page.rb
index e492553..a0eb02c 100644
--- a/tests/acceptance/features/support/pages/home_page.rb
+++ b/tests/acceptance/features/support/pages/home_page.rb
@@ -7,10 +7,10 @@
   end
   page_url url
 
-  a(:about_link, text: 'About')
+  a(:about_link, text: 'About Wikipedia')
   a(:content_link, text: 'CC BY-SA 3.0')
-  a(:contrib_link, text: 'contributors')
-  a(:disclaimer_link, text: 'Disclaimers')
+  a(:desktop_link, text: 'Desktop')
+  a(:disclaimer_link, text: 'Disclaimer')
   a(:login_button, href: /Special:UserLogin/)
   a(:login_watchlist, href: 
'/wiki/Special:UserLogin?returnto=Main_Page&returntoquery=article_action%3Dwatch')
   div(:main_page, id: 'mainpage')
@@ -37,4 +37,13 @@
   div(:watch_note, text: 'Added San Francisco Chronicle to your watchlist')
   div(:watch_note_removed, text: 'Removed San Francisco Chronicle from your 
watchlist')
   a(:watched_link, class: 'watch-this-article watched')
+  a(:create_account, class: 'mw-mf-create-account')
+  button(:language_button, text: 'Read in another language')
+  li(:edit_icon, id:'ca-edit')
+  li(:upload_icon, id:'ca-upload')
+  div(:fe_notification, class:'drawer position-fixed visible')
+  div(:rl_notification, id:'notifications')
+  a(:edit_history_link, id:'mw-mf-last-modified')
+  a(:notification_button, id:'user-button')
+  a(:edit_icon_enabled, text:'Edit')
 end
diff --git a/tests/acceptance/features/support/pages/language_page.rb 
b/tests/acceptance/features/support/pages/language_page.rb
new file mode 100644
index 0000000..023a5c3
--- /dev/null
+++ b/tests/acceptance/features/support/pages/language_page.rb
@@ -0,0 +1,7 @@
+class LanguagePage
+  include PageObject
+
+  text_field(:search_box_placeholder, placeholder:'Search language')
+  p(:number_languages, text:'This page is available in 42 languages')
+  a(:language_search_results, lang:'es')
+end
\ No newline at end of file
diff --git a/tests/acceptance/features/support/pages/login_page.rb 
b/tests/acceptance/features/support/pages/login_page.rb
index 583752a..64f1c9a 100644
--- a/tests/acceptance/features/support/pages/login_page.rb
+++ b/tests/acceptance/features/support/pages/login_page.rb
@@ -7,10 +7,13 @@
   div(:feedback, class: 'errorbox')
   button(:login, id: 'wpLoginAttempt')
   text_field(:password, id: 'wpPassword1')
+  text_field(:signup_password, id:'wpPassword2')
+  text_field(:confirm_password, id:'wpRetype')
   a(:phishing, text: 'phishing')
   a(:password_strength, text: 'password strength')
   text_field(:username, id: 'wpName1')
   a(:login_wl, class: 'button')
+  button(:signup_submit, id:'wpCreateaccount')
 
   def logged_in_as_element
     @browser.div(id: 'mw-content-text').p.b
diff --git a/tests/acceptance/features/support/pages/notification_page.rb 
b/tests/acceptance/features/support/pages/notification_page.rb
new file mode 100644
index 0000000..5d862a3
--- /dev/null
+++ b/tests/acceptance/features/support/pages/notification_page.rb
@@ -0,0 +1,9 @@
+class NotificationPage
+  include PageObject
+
+  div(:content, id:'content')
+  a(:content) do |page|
+    page.content_element.p.a
+  end
+  #a(:return_to_main_link, text:'Return to Main Page')
+end
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb2fc6e8ec9f22609dbc71ddeaadf65cacb1735b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Mgrover <mgro...@wikimedia.org>

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

Reply via email to