Zfilipin has submitted this change and it was merged.

Change subject: Adding tests for collapsing and expanding sidebar sections
......................................................................


Adding tests for collapsing and expanding sidebar sections

Bug: 48449
Change-Id: I42f2d5d9ec0b26d4e39cbe8ef355b306a6b93f7b
---
A features/sidebar.feature
A features/step_definitions/sidebar_steps.rb
M features/support/pages/main_page.rb
M features/support/pages/random_page.rb
4 files changed, 111 insertions(+), 0 deletions(-)

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



diff --git a/features/sidebar.feature b/features/sidebar.feature
new file mode 100644
index 0000000..9132935
--- /dev/null
+++ b/features/sidebar.feature
@@ -0,0 +1,49 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2013 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
[email protected]
+Feature: Sidebar
+
+  Scenario: Go to a random page and interaction should be expanded
+    Given I am at random page
+    Then Interaction section should be expanded
+
+  Scenario: Go to a random page and click interaction and it should collapse
+    Given I am at random page
+    When I click the interaction section
+    Then Interaction section should be collapsed
+
+  Scenario: Go to a random page and print/export section should be collapsed
+    Given I am at random page
+    Then Print export section should be collapsed
+
+  Scenario: Go to a random page and click print/export and it should expand
+    Given I am at random page
+    When I click print export section
+    Then Print export section should be expanded
+
+  Scenario: Go to a random page and tools section should be collapsed
+    Given I am at random page
+    Then Tools section should be collapsed
+
+  Scenario: Go to a random page and click tools and it should expand
+    Given I am at random page
+    When I click tools section
+    Then Tools section should be expanded
+
+  Scenario: Go to the main page and languages section should be expanded
+    Given I am at main page
+    Then Languages section should be expanded
+
+  Scenario: Go to the main page and click languages and it should collapse
+    Given I am at main page
+    When I click languages section
+    Then Languages section should be collapsed
diff --git a/features/step_definitions/sidebar_steps.rb 
b/features/step_definitions/sidebar_steps.rb
new file mode 100644
index 0000000..06a3c63
--- /dev/null
+++ b/features/step_definitions/sidebar_steps.rb
@@ -0,0 +1,56 @@
+#
+# This file is subject to the license terms in the LICENSE file found in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/LICENSE. No part of
+# qa-browsertests, including this file, may be copied, modified, propagated, or
+# distributed except according to the terms contained in the LICENSE file.
+#
+# Copyright 2012-2013 by the Mediawiki developers. See the CREDITS file in the
+# qa-browsertests top-level directory and at
+# https://git.wikimedia.org/blob/qa%2Fbrowsertests/HEAD/CREDITS
+#
+Given(/^I am at main page$/) do
+  visit MainPage
+end
+Then(/^Interaction section should be expanded$/) do
+  on(RandomPage).community_portal_element.when_present.should be_visible
+end
+When(/^I click the interaction section$/) do
+  on(RandomPage).interaction_section_element.click
+end
+Then(/^Interaction section should be collapsed$/) do
+  on(RandomPage) do |page|
+    page.community_portal_element.element.wait_while_present
+    page.community_portal_element.should_not be_visible
+  end
+end
+Then(/^Print export section should be collapsed$/) do
+  on(RandomPage).download_as_pdf_element.should_not be_visible
+end
+When(/^I click print export section$/) do
+  on(RandomPage).print_export_element.click
+end
+Then(/^Print export section should be expanded$/) do
+  on(RandomPage).download_as_pdf_element.when_present.should be_visible
+end
+Then(/^Tools section should be collapsed$/) do
+  on(RandomPage).upload_file_element.should_not be_visible
+end
+When(/^I click tools section$/) do
+  on(RandomPage).tools_element.click
+end
+Then(/^Tools section should be expanded$/) do
+  on(RandomPage).upload_file_element.when_present.should be_visible
+end
+Then(/^Languages section should be expanded$/) do
+  on(MainPage).simple_english_element.should be_visible
+end
+When(/^I click languages section$/) do
+  on(MainPage).languages_element.click
+end
+Then(/^Languages section should be collapsed$/) do
+  on(MainPage) do |page|
+    page.simple_english_element.element.wait_while_present
+    page.simple_english_element.should_not be_visible
+  end
+end
diff --git a/features/support/pages/main_page.rb 
b/features/support/pages/main_page.rb
index c76f2c8..00e4884 100644
--- a/features/support/pages/main_page.rb
+++ b/features/support/pages/main_page.rb
@@ -17,7 +17,9 @@
 
   a(:login, text: "Log in")
   a(:logout, text: "Log out")
+  a(:languages, text: "Languages")
   a(:my_sandbox, text: "My sandbox")
   a(:preferences, text: "Preferences")
+  a(:simple_english, title: "Simple English")
   a(:talk, text: "Talk")
 end
diff --git a/features/support/pages/random_page.rb 
b/features/support/pages/random_page.rb
index 6de12e1..2a1455d 100644
--- a/features/support/pages/random_page.rb
+++ b/features/support/pages/random_page.rb
@@ -16,6 +16,7 @@
   page_url URL.url("Special:Random")
 
   span(:cog, title: "Language settings")
+  a(:community_portal, text: "Community portal")
   a(:create_a_book, text: "Create a book")
   a(:download_as_pdf, text: "Download as PDF")
   a(:download_the_file, text: "Download the file")
@@ -26,6 +27,7 @@
   h3(:input_method_ime_list_title, class: "ime-list-title")
   ul(:input_method_language_list, class: "ime-language-list")
   div(:input_method_selector_menu, class: "imeselector-menu")
+  a(:interaction_section, text: "Interaction")
   text_field(:language_filter, id: "languagefilter")
   div(:language_settings_dialog, id: "language-settings-dialog")
   li(:main_page, id: "n-mainpage-description")
@@ -35,5 +37,7 @@
   li(:uls_malayalam_inscript2_item, data_ime_inputmethod: "ml-inscript2")
   button(:search_button, id: "searchButton")
   text_field(:search_input, id: "searchInput")
+  a(:tools, text: "Tools")
   a(:uls_trigger, class: "uls-trigger")
+  a(:upload_file, text: "Upload file")
 end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I42f2d5d9ec0b26d4e39cbe8ef355b306a6b93f7b
Gerrit-PatchSet: 5
Gerrit-Project: qa/browsertests
Gerrit-Branch: master
Gerrit-Owner: Mayankmadan <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Jhall <[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