3333 # Ignore since Minitest::Reporters::JUnitReporter.new fails in deleting files, sometimes
3434end
3535
36- ROOT_REPORT_PATH = " #{ Dir . pwd } / test/ report" . freeze
37- START_AT = Time . now . strftime ( '%Y-%m-%d-%H%M%S' ) . freeze
36+ ROOT_REPORT_PATH = File . expand_path ( File . join ( ' test' , ' report' ) , __dir__ )
37+ START_AT = Time . now . strftime ( '%Y-%m-%d-%H%M%S' )
3838
3939Dir . mkdir ( ROOT_REPORT_PATH ) unless Dir . exist? ROOT_REPORT_PATH
40- FileUtils . mkdir_p ( " #{ ROOT_REPORT_PATH } / #{ START_AT } " ) unless FileTest . exist? " #{ ROOT_REPORT_PATH } / #{ START_AT } "
40+ FileUtils . mkdir_p ( File . join ( ROOT_REPORT_PATH , START_AT ) ) unless FileTest . exist? File . join ( ROOT_REPORT_PATH , START_AT )
4141
4242ANDROID_TEST_APP_URL = 'https://github.com/appium/android-apidemos/releases/tag/v6.0.2/ApiDemos-debug.apk'
4343IOS_TEST_APP_URL = 'https://github.com/appium/ios-uicatalog/releases/download/v4.0.1/UIKitCatalog-iphonesimulator.zip'
@@ -49,11 +49,11 @@ def save_reports(driver)
4949 return if passed?
5050
5151 # Save failed view's screenshot and source
52- base_path = " #{ ROOT_REPORT_PATH } / #{ START_AT } / #{ self . class . name . gsub ( '::' , '_' ) } "
52+ base_path = File . join ( ROOT_REPORT_PATH , START_AT , self . class . name . gsub ( '::' , '_' ) )
5353 FileUtils . mkdir_p ( base_path ) unless FileTest . exist? base_path
5454
55- File . write "#{ base_path } / #{ name } -failed.xml" , driver . page_source
56- driver . save_screenshot "#{ base_path } / #{ name } -failed.png"
55+ File . write File . join ( base_path , "#{ name } -failed.xml" ) , driver . page_source
56+ driver . save_screenshot File . join ( base_path , "#{ name } -failed.png" )
5757 end
5858
5959 # Calls 'skip' if the appium version is not satisfied the version
@@ -234,17 +234,17 @@ def download_content(url, file_path)
234234
235235 def test_app_ios ( os_version )
236236 if over_ios13? ( os_version )
237- test_app = File . expand_path ( File . join ( 'test' , 'functional' , 'app' , 'UIKitCatalog-iphonesimulator.zip' ) , __dir__ ) . to_s
237+ test_app = File . expand_path ( File . join ( 'test' , 'functional' , 'app' , 'UIKitCatalog-iphonesimulator.zip' ) , __dir__ )
238238 return test_app if File . exist? test_app
239239
240240 download_content IOS_TEST_APP_URL , test_app
241241 else
242- File . expand_path ( File . join ( 'test' , 'functional' , 'app' , 'UICatalog.app.zip' ) , __dir__ ) . to_s
242+ File . expand_path ( File . join ( 'test' , 'functional' , 'app' , 'UICatalog.app.zip' ) , __dir__ )
243243 end
244244 end
245245
246246 def test_app_android
247- test_app = File . expand_path ( File . join ( 'test' , 'functional' , 'app' , 'ApiDemos-debug.apk' ) , __dir__ ) . to_s
247+ test_app = File . expand_path ( File . join ( 'test' , 'functional' , 'app' , 'ApiDemos-debug.apk' ) , __dir__ )
248248 return test_app if File . exist? test_app
249249
250250 download_content ANDROID_TEST_APP_URL , test_app
0 commit comments