Skip to content

Commit af5f36e

Browse files
committed
fix: video container wait capabilities fully before extracting details
Signed-off-by: Viet Nguyen Duc <[email protected]>
1 parent a545d08 commit af5f36e

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ test_video_standalone: standalone_chrome standalone_chromium standalone_firefox
639639
DOCKER_COMPOSE_FILE=docker-compose-v3-test-standalone.yml TEST_DELAY_AFTER_TEST=2 HUB_CHECKS_INTERVAL=45 make test_video
640640

641641
test_video_dynamic_name:
642-
VIDEO_FILE_NAME=auto TEST_DELAY_AFTER_TEST=2 HUB_CHECKS_INTERVAL=45 \
642+
VIDEO_FILE_NAME=auto TEST_DELAY_AFTER_TEST=2 HUB_CHECKS_INTERVAL=45 TEST_ADD_CAPS_RECORD_VIDEO=false \
643643
make test_video
644644

645645
# This should run on its own CI job. There is no need to combine it with the other tests.
@@ -674,6 +674,7 @@ test_video: video hub chrome firefox edge chromium
674674
echo BASIC_AUTH_USERNAME=$(or $(BASIC_AUTH_USERNAME), "admin") >> .env ; \
675675
echo BASIC_AUTH_PASSWORD=$(or $(BASIC_AUTH_PASSWORD), "admin") >> .env ; \
676676
echo SUB_PATH=$(or $(SUB_PATH), "/selenium") >> .env ; \
677+
echo TEST_ADD_CAPS_RECORD_VIDEO=$(or $(TEST_ADD_CAPS_RECORD_VIDEO), "true") >> .env ; \
677678
if [ $$node = "NodeChrome" ] ; then \
678679
echo BROWSER=chrome >> .env ; \
679680
echo VIDEO_FILE_NAME=$${VIDEO_FILE_NAME:-"chrome_video.mp4"} >> .env ; \

Video/video_graphQLQuery.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ if [ -n "${GRAPHQL_ENDPOINT}" ]; then
3232
# Check if the response contains "capabilities"
3333
if [[ "$endpoint_checks" = "404" ]] || [[ $current_check -eq $retry_time ]]; then
3434
break
35-
elif [[ "$endpoint_checks" = "200" ]] && [[ $(jq -e '.data.session.capabilities' /tmp/graphQL_${SESSION_ID}.json >/dev/null) -eq 0 ]]; then
35+
elif [[ "$endpoint_checks" = "200" ]] && [[ $(jq -e '.data.session.capabilities | fromjson | ."'browserName'"' /tmp/graphQL_${SESSION_ID}.json >/dev/null) -eq 0 ]]; then
3636
break
3737
fi
3838
done

tests/SeleniumTests/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
TEST_ANDROID_PLATFORM_API = os.environ.get('ANDROID_PLATFORM_API')
2727
TEST_PLATFORMS = os.environ.get('TEST_PLATFORMS', 'linux/amd64')
2828
TEST_FIREFOX_INSTALL_LANG_PACKAGE = os.environ.get('TEST_FIREFOX_INSTALL_LANG_PACKAGE', 'false').lower() == 'true'
29+
TEST_ADD_CAPS_RECORD_VIDEO = os.environ.get('TEST_ADD_CAPS_RECORD_VIDEO', 'true').lower() == 'true'
2930

3031
if SELENIUM_GRID_USERNAME and SELENIUM_GRID_PASSWORD:
3132
SELENIUM_GRID_HOST = f"{SELENIUM_GRID_USERNAME}:{SELENIUM_GRID_PASSWORD}@{SELENIUM_GRID_HOST}"
@@ -129,7 +130,8 @@ def setUp(self):
129130
options = ChromeOptions()
130131
options.enable_downloads = SELENIUM_ENABLE_MANAGED_DOWNLOADS
131132
options.add_argument('disable-features=DownloadBubble,DownloadBubbleV2')
132-
options.set_capability('se:recordVideo', True)
133+
if TEST_ADD_CAPS_RECORD_VIDEO:
134+
options.set_capability('se:recordVideo', True)
133135
options.set_capability('se:name', f"{self._testMethodName} ({self.__class__.__name__})")
134136
options.set_capability('se:screenResolution', '1920x1080')
135137
if SELENIUM_GRID_TEST_HEADLESS:
@@ -165,7 +167,8 @@ def setUp(self):
165167
options = EdgeOptions()
166168
options.enable_downloads = SELENIUM_ENABLE_MANAGED_DOWNLOADS
167169
options.add_argument('disable-features=DownloadBubble,DownloadBubbleV2')
168-
options.set_capability('se:recordVideo', True)
170+
if TEST_ADD_CAPS_RECORD_VIDEO:
171+
options.set_capability('se:recordVideo', True)
169172
options.set_capability('se:name', f"{self._testMethodName} ({self.__class__.__name__})")
170173
options.set_capability('se:screenResolution', '1920x1080')
171174
if SELENIUM_GRID_TEST_HEADLESS:
@@ -193,7 +196,8 @@ def setUp(self):
193196
options = FirefoxOptions()
194197
options.profile = profile
195198
options.enable_downloads = SELENIUM_ENABLE_MANAGED_DOWNLOADS
196-
options.set_capability('se:recordVideo', True)
199+
if TEST_ADD_CAPS_RECORD_VIDEO:
200+
options.set_capability('se:recordVideo', True)
197201
options.set_capability('se:name', f"{self._testMethodName} ({self.__class__.__name__})")
198202
options.set_capability('se:screenResolution', '1920x1080')
199203
if SELENIUM_GRID_TEST_HEADLESS:

tests/docker-compose-v3-test-video.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,5 @@ services:
8181
- SELENIUM_ENABLE_MANAGED_DOWNLOADS=${SELENIUM_ENABLE_MANAGED_DOWNLOADS}
8282
- TEST_FIREFOX_INSTALL_LANG_PACKAGE=${TEST_FIREFOX_INSTALL_LANG_PACKAGE}
8383
- HUB_CHECKS_INTERVAL=${HUB_CHECKS_INTERVAL}
84+
- TEST_ADD_CAPS_RECORD_VIDEO=${TEST_ADD_CAPS_RECORD_VIDEO}
8485
command: ["/bin/bash", "-c", "./bootstrap.sh ${NODE}"]

0 commit comments

Comments
 (0)