Zfilipin has submitted this change and it was merged.

Change subject: Use temp folder to manage temporary test images
......................................................................


Use temp folder to manage temporary test images

Bug: 50384
Change-Id: I48c4b0e45436f7d7d3167d2d903ec612d74074df
---
M features/step_definitions/upload_wizard_steps.rb
1 file changed, 6 insertions(+), 3 deletions(-)

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



diff --git a/features/step_definitions/upload_wizard_steps.rb 
b/features/step_definitions/upload_wizard_steps.rb
index b0f25b7..3ba9462 100644
--- a/features/step_definitions/upload_wizard_steps.rb
+++ b/features/step_definitions/upload_wizard_steps.rb
@@ -37,16 +37,19 @@
   on(ReleaseRightsPage).thumbnail_element.should be_visible
 end
 When(/^upload 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 file_name
-  path = Dir.pwd + '/' + file_name
+  ChunkyPNG::Image.new(Random.new.rand(255), Random.new.rand(255), 
Random.new.rand(255)).save path
+
   if @browser.driver.browser == :chrome
     @browser.execute_script 
'document.getElementsByName("file")[0].removeAttribute("class");'
     @browser.execute_script 
'document.getElementsByName("file")[0].removeAttribute("style");'
   end
+
   on(UploadPage).select_file = path
 end
-
 Then(/^(.+) checkbox should be there$/) do |_|
   on(LearnPage).skip_element.should exist
 end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I48c4b0e45436f7d7d3167d2d903ec612d74074df
Gerrit-PatchSet: 5
Gerrit-Project: qa/browsertests
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Cmcmahon <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Rachel99 <[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