Cmcmahon has submitted this change and it was merged.

Change subject: Created a test for ProveIt gadget
......................................................................


Created a test for ProveIt gadget

Change-Id: I038a1d1d6d2e5b5eaf4fda351bac209e883a00eb
---
A features/proveit.feature
A features/step_definitions/proveit_steps.rb
A features/support/pages/proveit_page.rb
M features/support/pages/random_page.rb
4 files changed, 103 insertions(+), 0 deletions(-)

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



diff --git a/features/proveit.feature b/features/proveit.feature
new file mode 100644
index 0000000..a11ca0a
--- /dev/null
+++ b/features/proveit.feature
@@ -0,0 +1,27 @@
+@login @en.wikipedia.beta.wmflabs.org @phantomjs-bug
+Feature: ProveIt
+
+  Background:
+    Given I am logged in
+    When I am at random page
+      And I click Edit button on the page
+      And I click ProveIt show button
+      And I click add a reference link
+
+
+  Scenario: Add a new reference
+    When I choose a Book reference
+      And I enter new reference data
+      And I click Insert into edit form
+    Then I see the new reference in the list
+      And I see the new reference in the page editor
+
+  Scenario: Edit and update a reference
+    When I choose a Web reference
+      And I enter new reference data
+      And I click Insert into edit form
+      And I click on the edit button for the new reference
+      And I enter updated reference data
+      And I click on the update edit form button
+    Then I see the updated reference in the list
+      And I see the updated reference in the page editor
\ No newline at end of file
diff --git a/features/step_definitions/proveit_steps.rb 
b/features/step_definitions/proveit_steps.rb
new file mode 100644
index 0000000..a50a8b1
--- /dev/null
+++ b/features/step_definitions/proveit_steps.rb
@@ -0,0 +1,57 @@
+When(/^I choose a (.+) reference$/) do | reference_type |
+  on(ProveItPage).cite_menu=reference_type
+end
+
+When(/^I click Edit button on the page$/) do
+  on(RandomPage).edit_page
+end
+
+When(/^I click Insert into edit form$/) do
+  on(ProveItPage).insert_reference
+end
+
+When(/^I click on the edit button for the new reference$/) do
+  on(ProveItPage).edit_reference
+end
+
+When(/^I click on the update edit form button$/) do
+  on(ProveItPage).update_edit_form
+end
+
+When(/^I click ProveIt show button$/) do
+  on(ProveItPage).show_hide
+end
+
+When(/^I click add a reference link$/) do
+  on(ProveItPage).add_reference
+end
+
+When(/^I enter new reference data$/) do
+  on(ProveItPage) do |page|
+    page.new_title='ProveIt Automated Test Reference'
+    page.new_url='www.canyouproveit.com'
+  end
+end
+
+When(/^I enter updated reference data$/) do
+  on(ProveItPage) do |page|
+    page.edit_title='ProveIt Automated Test Reference - updated'
+    page.edit_url='www.canyouproveit.com - updated'
+  end
+end
+
+Then(/^I see the new reference in the list$/) do
+  on(ProveItPage).refs_table.should include 'ProveIt Automated Test Reference'
+end
+
+Then(/^I see the updated reference in the list$/) do
+  on(ProveItPage).refs_table.should include 'ProveIt Automated Test Reference 
- updated'
+end
+
+Then(/^I see the new reference in the page editor$/) do
+  on(RandomPage).editor_text.should include 'ProveIt Automated Test Reference'
+end
+
+Then(/^I see the updated reference in the page editor$/) do
+  on(RandomPage).editor_text.should include 'ProveIt Automated Test Reference 
- updated'
+end
diff --git a/features/support/pages/proveit_page.rb 
b/features/support/pages/proveit_page.rb
new file mode 100644
index 0000000..d09c531
--- /dev/null
+++ b/features/support/pages/proveit_page.rb
@@ -0,0 +1,17 @@
+class ProveItPage
+  include PageObject
+
+  a(:add_reference, id: 'add-link')
+  select_list(:cite_menu, id: 'citemenu')
+  button(:edit_reference, css: '#refs tr:last-child .edit button')
+  text_field(:edit_title, id: 'editparamtitle')
+  text_field(:edit_url, id: 'editparamurl')
+  button(:insert_reference, text: 'insert into edit form')
+  text_field(:new_title, id: 'newparamtitle')
+  text_field(:new_url, id: 'newparamurl')
+  div(:proveit, id: 'proveit')
+  table(:refs_table, id: 'refs')
+  button(:show_hide, title: 'show/hide')
+  button(:update_edit_form, text: 'update edit form')
+  div(:view_tab, id: 'view-tab')
+end
diff --git a/features/support/pages/random_page.rb 
b/features/support/pages/random_page.rb
index fe0ebae..b958b09 100644
--- a/features/support/pages/random_page.rb
+++ b/features/support/pages/random_page.rb
@@ -8,6 +8,8 @@
   a(:create_a_book, text: 'Create a book')
   a(:download_as_pdf, text: 'Download as PDF')
   a(:download_the_file, text: 'Download the file')
+  a(:edit_page, title: /You can edit this page/)
+  text_area(:editor_text, id: 'wpTextbox1')
   div(:input_method, class: 'imeselector imeselector-toggle')
   a(:input_method_enabled, class: 'ime-name imeselector-toggle')
   h3(:input_method_ime_list_title, class: 'ime-list-title')

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I038a1d1d6d2e5b5eaf4fda351bac209e883a00eb
Gerrit-PatchSet: 10
Gerrit-Project: qa/browsertests
Gerrit-Branch: master
Gerrit-Owner: Plavi <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Plavi <[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