File tree Expand file tree Collapse file tree 4 files changed +21
-4
lines changed
Expand file tree Collapse file tree 4 files changed +21
-4
lines changed Original file line number Diff line number Diff line change 1414 python -m pytest ${{ parameters.testFiles}} ${{ parameters.pytestOpt }}
1515 displayName: Run iOS functional tests
1616 - template : ./publish_test_result.yml
17+ - template : ./save_appium_log.yml
18+ parameters :
19+ name : ${{ parameters.name }}
Original file line number Diff line number Diff line change 99 condition : succeededOrFailed()
1010 inputs :
1111 contents :
12- ' **/test_*.png '
12+ ' **/test_*.mp4 '
1313 targetFolder : $(Build.ArtifactStagingDirectory)
1414- task : PublishBuildArtifacts@1
1515 condition : succeededOrFailed()
Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515
16+ import base64
1617import os
1718import unittest
1819
@@ -57,10 +58,13 @@ class BaseTestCase(unittest.TestCase):
5758 def setUp (self ):
5859 desired_caps = desired_capabilities .get_desired_capabilities ('ApiDemos-debug.apk.zip' )
5960 self .driver = webdriver .Remote ('http://localhost:4723/wd/hub' , desired_caps )
61+ if is_ci ():
62+ self .driver .start_recording_screen ()
6063
6164 def tearDown (self ):
6265 if is_ci ():
63- # Take the screenshot to investigate when tests failed only on CI
64- img_path = os .path .join (os .getcwd (), self ._testMethodName + '.png' )
65- self .driver .get_screenshot_as_file (img_path )
66+ payload = self .driver .stop_recording_screen ()
67+ video_path = os .path .join (os .getcwd (), self ._testMethodName + '.mp4' )
68+ with open (video_path , "wb" ) as fd :
69+ fd .write (base64 .b64decode (payload ))
6670 self .driver .quit ()
Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515
16+ import base64
17+ import os
1618import unittest
1719
1820from appium import webdriver
21+ from test .functional .test_helper import is_ci
1922
2023from . import desired_capabilities
2124
@@ -25,6 +28,13 @@ class BaseTestCase(unittest.TestCase):
2528 def setUp (self ):
2629 desired_caps = desired_capabilities .get_desired_capabilities ('UICatalog.app.zip' )
2730 self .driver = webdriver .Remote ('http://localhost:4723/wd/hub' , desired_caps )
31+ if is_ci ():
32+ self .driver .start_recording_screen ()
2833
2934 def tearDown (self ):
35+ if is_ci ():
36+ payload = self .driver .stop_recording_screen ()
37+ video_path = os .path .join (os .getcwd (), self ._testMethodName + '.mp4' )
38+ with open (video_path , "wb" ) as fd :
39+ fd .write (base64 .b64decode (payload ))
3040 self .driver .quit ()
You can’t perform that action at this time.
0 commit comments