Cmcmahon has uploaded a new change for review.
https://gerrit.wikimedia.org/r/99690
Change subject: [WIP] new test for uploading an image
......................................................................
[WIP] new test for uploading an image
Change-Id: Ib6b14ab3d8bdbf096bfc74b553a058104027f219
---
M tests/browser/features/step_definitions/uploads_steps.rb
M tests/browser/features/support/pages/uploads_page.rb
A tests/browser/features/upload_image.feature
3 files changed, 41 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MobileFrontend
refs/changes/90/99690/1
diff --git a/tests/browser/features/step_definitions/uploads_steps.rb
b/tests/browser/features/step_definitions/uploads_steps.rb
index 608e59b..190976e 100644
--- a/tests/browser/features/step_definitions/uploads_steps.rb
+++ b/tests/browser/features/step_definitions/uploads_steps.rb
@@ -6,8 +6,26 @@
on(LoginPage).login_with("Selenium_newuser", ENV["MEDIAWIKI_PASSWORD"])
end
+When(/^I click Submit$/) do
+ on(UploadsPage).submit_button_element.when_present.click
+end
+
When(/^I go to uploads page$/) do
visit(UploadsPage)
+end
+
+When(/^I type a description$/) do
+ on(UploadsPage).description_textarea.when_present.send_keys("Describing with
#{@random_string}")
+end
+
+When(/^I upload Mobile file (.+)$/) do |file_name|
+ require 'tempfile'
+ path = "#{Dir.tmpdir}/#{file_name}"
+
+ require 'chunky_png'
+ ChunkyPNG::Image.new(Random.new.rand(255), Random.new.rand(255),
Random.new.rand(255)).save path
+
+ on(UploadsPage).select_file = path
end
Then(/^I see a blue tutorial screen$/) do
@@ -17,3 +35,11 @@
Then(/^I see a next button$/) do
on(UploadsPage).next_button_element.when_present.should exist
end
+
+Then(/^my image is on the Uploads page$/) do
+ on(UploadsPage).uploaded_image_link_element.should be_visible
+end
+
+Then(/^The Contribute an image button is visible$/) do
+ on(UploadsPage).uploads_link_element.should be_visible
+end
diff --git a/tests/browser/features/support/pages/uploads_page.rb
b/tests/browser/features/support/pages/uploads_page.rb
index e569488..d07972a 100644
--- a/tests/browser/features/support/pages/uploads_page.rb
+++ b/tests/browser/features/support/pages/uploads_page.rb
@@ -3,6 +3,10 @@
include URL
page_url URL.url("Special:Uploads")
+
+ text_area(:description_textarea, name: "description")
button(:next_button, class: "next")
+ file_field(:select_file, name: 'file')
+ button(:submit_button, text: "Submit")
div(:tutorial, class: "mw-mf-overlay carousel tutorial")
end
\ No newline at end of file
diff --git a/tests/browser/features/upload_image.feature
b/tests/browser/features/upload_image.feature
new file mode 100644
index 0000000..b97f33a
--- /dev/null
+++ b/tests/browser/features/upload_image.feature
@@ -0,0 +1,11 @@
[email protected] @en.m.wikipedia.org @test2.m.wikipedia.org
+Feature: Upload image
+
+ Scenario: Upload image file
+ Given I am logged into the mobile website
+ And I select Uploads
+ When I upload Mobile file image.png
+ And I type a description
+ And I click Submit
+ Then my image is on the Uploads page
+ And The Contribute an image button is visible
--
To view, visit https://gerrit.wikimedia.org/r/99690
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib6b14ab3d8bdbf096bfc74b553a058104027f219
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Cmcmahon <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits