Skip to content

Commit

Permalink
Screen record the test
Browse files Browse the repository at this point in the history
  • Loading branch information
juan-serrano-soria committed May 15, 2024
1 parent da8e525 commit 86a7a12
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,10 @@ jobs:
with:
name: screenshots
path: '*.png'

- name: Upload screen recording
uses: actions/upload-artifact@v2
if: always()
with:
name: screen_recording
path: 'screen_recording.mp4'
7 changes: 7 additions & 0 deletions src/tests/test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import unittest
import time
import base64
from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
Expand All @@ -21,8 +22,14 @@
class TestAppium(unittest.TestCase):
def setUp(self) -> None:
self.driver = webdriver.Remote(appium_server_url, options=UiAutomator2Options().load_capabilities(capabilities))
self.driver.start_recording_screen()

def tearDown(self) -> None:
# Stop the screen recording and save the video file
video_data = self.driver.stop_recording_screen()
with open("screen_recording.mp4", "wb") as out_file:
out_file.write(base64.b64decode(video_data))

if self.driver:
self.driver.quit()

Expand Down

0 comments on commit 86a7a12

Please sign in to comment.