Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions ci-jobs/functional/run_ios_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ jobs:
python -m pytest ${{ parameters.testFiles}} ${{ parameters.pytestOpt }}
displayName: Run iOS functional tests
- template: ./publish_test_result.yml
- template: ./save_appium_log.yml
parameters:
name: ${{ parameters.name }}
2 changes: 1 addition & 1 deletion ci-jobs/functional/save_appium_log.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ steps:
condition: succeededOrFailed()
inputs:
contents:
'**/test_*.png'
'**/test_*.mp4'
targetFolder: $(Build.ArtifactStagingDirectory)
- task: PublishBuildArtifacts@1
condition: succeededOrFailed()
Expand Down
10 changes: 7 additions & 3 deletions test/functional/android/helper/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.


import base64
import os
import unittest

Expand Down Expand Up @@ -57,10 +58,13 @@ class BaseTestCase(unittest.TestCase):
def setUp(self):
desired_caps = desired_capabilities.get_desired_capabilities('ApiDemos-debug.apk.zip')
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
if is_ci():
self.driver.start_recording_screen()

def tearDown(self):
if is_ci():
# Take the screenshot to investigate when tests failed only on CI
img_path = os.path.join(os.getcwd(), self._testMethodName + '.png')
self.driver.get_screenshot_as_file(img_path)
payload = self.driver.stop_recording_screen()
video_path = os.path.join(os.getcwd(), self._testMethodName + '.mp4')
with open(video_path, "wb") as fd:
fd.write(base64.b64decode(payload))
self.driver.quit()
10 changes: 10 additions & 0 deletions test/functional/ios/helper/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
# limitations under the License.


import base64
import os
import unittest

from appium import webdriver
from test.functional.test_helper import is_ci

from . import desired_capabilities

Expand All @@ -25,6 +28,13 @@ class BaseTestCase(unittest.TestCase):
def setUp(self):
desired_caps = desired_capabilities.get_desired_capabilities('UICatalog.app.zip')
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
if is_ci():
self.driver.start_recording_screen()

def tearDown(self):
if is_ci():
payload = self.driver.stop_recording_screen()
video_path = os.path.join(os.getcwd(), self._testMethodName + '.mp4')
with open(video_path, "wb") as fd:
fd.write(base64.b64decode(payload))
self.driver.quit()