Cmcmahon has uploaded a new change for review.

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

Change subject: QA: WIP update tests for RSpec3 syntax
......................................................................

QA: WIP update tests for RSpec3 syntax

* make a Then statement with no assertion into a When
* prefer single quotes per rubocop
* use strings instead of regexes where appropriate for match operator

Change-Id: I24435362836945833942e87d7caee49c9b34368d
---
M tests/browser/features/mmv.download.feature
M tests/browser/features/step_definitions/mmv_download_steps.rb
2 files changed, 26 insertions(+), 26 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MultimediaViewer 
refs/changes/05/178205/1

diff --git a/tests/browser/features/mmv.download.feature 
b/tests/browser/features/mmv.download.feature
index cc70839..837e4e5 100644
--- a/tests/browser/features/mmv.download.feature
+++ b/tests/browser/features/mmv.download.feature
@@ -36,20 +36,20 @@
   Scenario: The small download option has the correct information
     Given I open the download dropdown
     When I click the small download size
-    Then the download size options should disappear
-      And the download image size label should match the small size
+      And the download size options disappears
+    Then the download image size label should match the small size
       And the download links should be the small thumbnail
 
   Scenario: The medium download option has the correct information
     Given I open the download dropdown
     When I click the medium download size
-    Then the download size options should disappear
-      And the download image size label should match the medium size
+      And the download size options disappears
+    Then the download image size label should match the medium size
       And the download links should be the medium thumbnail
 
   Scenario: The large download option has the correct information
     Given I open the download dropdown
     When I click the large download size
-    Then the download size options should disappear
-      And the download image size label should match the large size
+      And the download size options disappears
+    Then the download image size label should match the large size
       And the download links should be the large thumbnail
\ No newline at end of file
diff --git a/tests/browser/features/step_definitions/mmv_download_steps.rb 
b/tests/browser/features/step_definitions/mmv_download_steps.rb
index dc2188a..e8fbbee 100644
--- a/tests/browser/features/step_definitions/mmv_download_steps.rb
+++ b/tests/browser/features/step_definitions/mmv_download_steps.rb
@@ -50,53 +50,53 @@
   end
 end
 
+When /^the download size options disappears$/ do
+  on(E2ETestPage).mmv_download_size_menu_element.when_not_present
+end
+
 Then /^the download menu should appear$/ do
-  on(E2ETestPage).mmv_download_menu_element.when_present.should be_visible
+  expect(on(E2ETestPage).mmv_download_menu_element.when_present).to be_visible
 end
 
 Then /^the download menu should disappear$/ do
-  on(E2ETestPage).mmv_download_menu_element.should_not be_visible
+  expect(on(E2ETestPage).mmv_download_menu_element).not_to be_visible
 end
 
 Then /^the download image size label should match the original$/ do
-  on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq 
"4000 × 3000 px jpg"
+  expect(on(E2ETestPage).mmv_download_size_label_element.when_present.text).to 
eq '4000 × 3000 px jpg'
 end
 
 Then /^the download image size label should match the small size$/ do
-  on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq 
"193 × 145 px jpg"
+  expect(on(E2ETestPage).mmv_download_size_label_element.when_present.text).to 
eq '193 × 145 px jpg'
 end
 
 Then /^the download image size label should match the medium size$/ do
-  on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq 
"640 × 480 px jpg"
+  expect(on(E2ETestPage).mmv_download_size_label_element.when_present.text).to 
eq '640 × 480 px jpg'
 end
 
 Then /^the download image size label should match the large size$/ do
-  on(E2ETestPage).mmv_download_size_label_element.when_present.text.should eq 
"1200 × 900 px jpg"
+  expect(on(E2ETestPage).mmv_download_size_label_element.when_present.text).to 
eq '1200 × 900 px jpg'
 end
 
 Then /^the download size options should appear$/ do
-  on(E2ETestPage).mmv_download_size_menu_element.when_present.should be_visible
-end
-
-Then /^the download size options should disappear$/ do
-  on(E2ETestPage).mmv_download_size_menu_element.when_not_present
+  expect(on(E2ETestPage).mmv_download_size_menu_element.when_present).to 
be_visible
 end
 
 Then /^the download links should be the original image$/ do
   on(E2ETestPage) do |page|
-    page.mmv_download_link_element.attribute('href').should match /^?download$/
-    page.mmv_download_preview_link_element.attribute('href').should_not match 
/^?download$/
-    page.mmv_download_link_element.attribute('href').should_not match 
/\/thumb\//
-    page.mmv_download_preview_link_element.attribute('href').should_not match 
/\/thumb\//
+    expect(page.mmv_download_link_element.attribute('href')).to match 
/^?download$/
+    expect(page.mmv_download_preview_link_element.attribute('href')).not_to 
match /^?download$/
+    expect(page.mmv_download_link_element.attribute('href')).not_to match 
/\/thumb\//
+    expect(page.mmv_download_preview_link_element.attribute('href')).not_to 
match /\/thumb\//
   end
 end
 
 Then /^the download links should be the (\d+) thumbnail$/ do |thumb_size|
   on(E2ETestPage) do |page|
     Watir::Wait.until { page.mmv_download_link_element.attribute('href').match 
thumb_size }
-    page.mmv_download_link_element.attribute('href').should match /^?download$/
-    page.mmv_download_preview_link_element.attribute('href').should_not match 
/^?download$/
-    page.mmv_download_preview_link_element.attribute('href').should match 
thumb_size
+    expect(page.mmv_download_link_element.attribute('href')).to match 
/^?download$/
+    expect(page.mmv_download_preview_link_element.attribute('href')).not_to 
match /^?download$/
+    expect(page.mmv_download_preview_link_element.attribute('href')).to match 
thumb_size
   end
 end
 
@@ -113,9 +113,9 @@
 end
 
 Then /^the attribution area should be collapsed$/ do
-  
on(E2ETestPage).mmv_download_attribution_area_element.attribute('class').should 
match /mw-mmv-download-attribution-collapsed/
+  
exzpect(on(E2ETestPage).mmv_download_attribution_area_element.attribute('class')).to
 match 'mw-mmv-download-attribution-collapsed'
 end
 
 Then /^the attribution area should be open$/ do
-  
on(E2ETestPage).mmv_download_attribution_area_element.attribute('class').should_not
 match /mw-mmv-download-attribution-collapsed/
+  
expect(on(E2ETestPage).mmv_download_attribution_area_element.attribute('class')).not_to
 match 'mw-mmv-download-attribution-collapsed'
 end
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I24435362836945833942e87d7caee49c9b34368d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MultimediaViewer
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <[email protected]>

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

Reply via email to