Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.15.z] Cleanup video recording #13771

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
4 changes: 3 additions & 1 deletion conf/ui.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ UI:
WEBDRIVER: chrome
# Binary location for selected wedriver (not needed if using saucelabs)
WEBDRIVER_BINARY: /usr/bin/chromedriver

RECORD_VIDEO: false
GRID_URL: http://infra-grid.example.com:4444
# Web_Kaifuku Settings (checkout https://github.com/RonnyPfannschmidt/webdriver_kaifuku)
WEBKAIFUKU:
webdriver: chrome/remote
webdriver_options:
command_executor: http://localhost:4444/wd/hub
desired_capabilities:
se:recordVideo: '@jinja {{ this.ui.record_video }}'
browserName: chrome
chromeOptions:
args:
Expand Down
17 changes: 9 additions & 8 deletions pytest_plugins/video_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@


def _clean_video(session_id, test):
logger.info(f"cleaning up video files for session: {session_id} and test: {test}")
if settings.ui.record_video:
logger.info(f"cleaning up video files for session: {session_id} and test: {test}")

if settings.ui.grid_url and session_id:
grid = urlparse(url=settings.ui.grid_url)
infra_grid = Host(hostname=grid.hostname)
infra_grid.execute(command=f'rm -rf /var/www/html/videos/{session_id}')
logger.info(f"video cleanup for session {session_id} is complete")
else:
logger.warning("missing grid_url or session_id. unable to clean video files.")
if settings.ui.grid_url and session_id:
grid = urlparse(url=settings.ui.grid_url)
infra_grid = Host(hostname=grid.hostname)
infra_grid.execute(command=f'rm -rf /var/www/html/videos/{session_id}')
logger.info(f"video cleanup for session {session_id} is complete")
else:
logger.warning("missing grid_url or session_id. unable to clean video files.")


def pytest_addoption(parser):
Expand Down
6 changes: 3 additions & 3 deletions robottelo/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1856,10 +1856,10 @@ def get_caller():
except Exception:
raise
finally:
video_url = settings.ui.grid_url.replace(
':4444', f'/videos/{ui_session.ui_session_id}/video.mp4'
)
if self.record_property is not None and settings.ui.record_video:
video_url = settings.ui.grid_url.replace(
':4444', f'/videos/{ui_session.ui_session_id}/video.mp4'
)
self.record_property('video_url', video_url)
self.record_property('session_id', ui_session.ui_session_id)

Expand Down