Cmcmahon has uploaded a new change for review.

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

Change subject: QA: untangle steps in language test
......................................................................

QA: untangle steps in language test

refactoring for great good

Change-Id: I3c8981fc2a29cc78476ddd28822353c467e68f13
---
M tests/browser/features/editor_wikitext_saving.feature
M tests/browser/features/language.feature
M tests/browser/features/special_history.feature
M tests/browser/features/step_definitions/common_article_steps.rb
M tests/browser/features/step_definitions/editor_steps.rb
M tests/browser/features/step_definitions/language_steps.rb
6 files changed, 22 insertions(+), 28 deletions(-)


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

diff --git a/tests/browser/features/editor_wikitext_saving.feature 
b/tests/browser/features/editor_wikitext_saving.feature
index a6d9c42..aa0ce83 100644
--- a/tests/browser/features/editor_wikitext_saving.feature
+++ b/tests/browser/features/editor_wikitext_saving.feature
@@ -6,26 +6,24 @@
 
   Scenario: Successful edit on page without languages shows no language button 
[bug 63675]
     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
       And I click continue
       And I click submit
     Then I see a toast notification
-      And the text of the first heading is "Selenium no languages test page"
-      And I do not see the read in another language button
+      And the text of the first heading should be "Selenium no languages test 
page"
+      And I should not see the read in another language button
 
   Scenario: Successful edit reloads 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
       And I click continue
       And I click submit
     Then I see a toast notification
-      And I see the read in another language button
+      And I should see the read in another language button
 
   Scenario: Redirects
     Given the page "Selenium wikitext editor test" exists
@@ -37,7 +35,7 @@
       And I click submit
       And I say OK in the confirm dialog
       And I do not see the wikitext editor overlay
-    Then the text of the first heading is "Selenium wikitext editor test"
+    Then the text of the first heading should be "Selenium wikitext editor 
test"
 
   Scenario: Broken redirects
     Given I am on a page that does not exist
diff --git a/tests/browser/features/language.feature 
b/tests/browser/features/language.feature
index ab7df8a..5b3a765 100644
--- a/tests/browser/features/language.feature
+++ b/tests/browser/features/language.feature
@@ -5,17 +5,13 @@
   Background:
     Given I am using the mobile site
       And I go to a page that has languages
-      And I see the read in another language button
     When I click the language button
-
-  Scenario: Opening language overlay
-    Then I see the language overlay
+      And I see the language overlay
 
   Scenario: Closing language overlay (overlay button)
     When I click the language overlay close button
-    Then I don't see the languages overlay
+    Then I should not see the languages overlay
 
   Scenario: Closing language overlay (browser button)
-    Given I see the language overlay
     When I click the browser back button
-    Then I don't see the languages overlay
+    Then I should not see the languages overlay
diff --git a/tests/browser/features/special_history.feature 
b/tests/browser/features/special_history.feature
index 251219e..8ee5a5f 100644
--- a/tests/browser/features/special_history.feature
+++ b/tests/browser/features/special_history.feature
@@ -12,7 +12,7 @@
 
   Scenario: Check components in diff summary
     When I click the link in the header bar
-    Then the text of the first heading is "Selenium diff test"
+    Then the text of the first heading should be "Selenium diff test"
 
   Scenario: Check components in diff summary
     Then I see a list of page contributions
diff --git a/tests/browser/features/step_definitions/common_article_steps.rb 
b/tests/browser/features/step_definitions/common_article_steps.rb
index 650befc..b9c2a0a 100644
--- a/tests/browser/features/step_definitions/common_article_steps.rb
+++ b/tests/browser/features/step_definitions/common_article_steps.rb
@@ -58,12 +58,12 @@
   on(ArticlePage).watch_link_element.parent.class_name.should match "watched"
 end
 
-Then(/^the text of the first heading is "(.*)"$/) do |title|
+Then(/^the text of the first heading should be "(.*)"$/) do |title|
   on(ArticlePage) do |page|
     page.wait_until do
       page.first_heading_element.when_present.text.include? title
     end
-    page.first_heading_element.when_present.text.should match title
+    expect(page.first_heading_element.when_present.text).to_enum match title
   end
 end
 
diff --git a/tests/browser/features/step_definitions/editor_steps.rb 
b/tests/browser/features/step_definitions/editor_steps.rb
index 9c17725..47339f9 100644
--- a/tests/browser/features/step_definitions/editor_steps.rb
+++ b/tests/browser/features/step_definitions/editor_steps.rb
@@ -34,6 +34,14 @@
   on(ArticlePage).editor_textarea_element.when_present.send_keys(text)
 end
 
+Then(/^I should not see the read in another language button$/) do
+  expect(on(ArticlePage).language_button_element).not to be_visible
+end
+
 Then(/^I should not see the wikitext editor overlay$/) do
   expect(on(ArticlePage).editor_overlay_element).not_to be_visible
 end
+
+When /^I should see the read in another language button$/ do
+  expect(on(ArticlePage).language_button_element.when_present).to be_visible
+end
diff --git a/tests/browser/features/step_definitions/language_steps.rb 
b/tests/browser/features/step_definitions/language_steps.rb
index 2c4cdcd..5886a1d 100644
--- a/tests/browser/features/step_definitions/language_steps.rb
+++ b/tests/browser/features/step_definitions/language_steps.rb
@@ -1,23 +1,15 @@
-When /^I see the read in another language button$/ do
-  on(ArticlePage).language_button_element.when_present.should be_visible
-end
-
 When /^I click the language button$/ do
   on(ArticlePage).language_button_element.when_present.click
-end
-
-Then(/^I see the language overlay$/) do
-  on(ArticlePage).overlay_languages_element.when_present.class_name.should 
match "language-overlay"
 end
 
 When(/^I click the language overlay close button$/) do
   on(ArticlePage).overlay_languages_element.when_present.button_element(class: 
"cancel").click
 end
 
-Then(/^I don't see the languages overlay$/) do
-  on(ArticlePage).overlay_languages_element.should_not be_visible
+When(/^I see the language overlay$/) do
+  on(ArticlePage).overlay_languages_element.when_present
 end
 
-Then(/^I do not see the read in another language button$/) do
-  on(ArticlePage).language_button_element.should_not be_visible
+Then(/^I should not see the languages overlay$/) do
+  expect(on(ArticlePage).overlay_languages_element).not_to be_visible
 end

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c8981fc2a29cc78476ddd28822353c467e68f13
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <cmcma...@wikimedia.org>

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

Reply via email to