@@ -72,10 +72,14 @@ import com.google.jetpackcamera.ui.components.capture.BTN_QUICK_SETTINGS_HDR_OPT
7272import com.google.jetpackcamera.ui.components.capture.CAPTURE_BUTTON
7373import com.google.jetpackcamera.ui.components.capture.CAPTURE_MODE_TOGGLE_BUTTON
7474import com.google.jetpackcamera.ui.components.capture.ELAPSED_TIME_TAG
75+ import com.google.jetpackcamera.ui.components.capture.FLIP_CAMERA_BUTTON
7576import com.google.jetpackcamera.ui.components.capture.QUICK_SETTINGS_BOTTOM_SHEET
7677import com.google.jetpackcamera.ui.components.capture.R as CaptureR
78+ import com.google.jetpackcamera.ui.components.capture.ROW_QUICK_SETTINGS_ASPECT_RATIO
79+ import com.google.jetpackcamera.ui.components.capture.ROW_QUICK_SETTINGS_CAPTURE_MODE
7780import com.google.jetpackcamera.ui.components.capture.SETTINGS_BUTTON
7881import com.google.jetpackcamera.ui.components.capture.SNACKBAR_NODE_TAG
82+ import com.google.jetpackcamera.ui.uistateadapter.capture.R
7983import org.junit.AssumptionViolatedException
8084
8185/* *
@@ -269,7 +273,7 @@ fun ComposeTestRule.pressAndDragToLockVideoRecording(
269273 checkWhileWaiting : () -> Unit = {
270274 // If the video capture fails, there is no point to continue waiting. Assert.
271275 onNodeWithText(
272- com.google.jetpackcamera.ui.uistateadapter.capture. R .string.toast_video_capture_failure
276+ R .string.toast_video_capture_failure
273277 ).assertIsNotDisplayed()
274278 }
275279) {
@@ -304,7 +308,7 @@ fun ComposeTestRule.longClickForVideoRecordingCheckingElapsedTime(
304308 checkWhileWaiting : () -> Unit = {
305309 // If the video capture fails, there is no point to continue waiting. Assert.
306310 onNodeWithText(
307- com.google.jetpackcamera.ui.uistateadapter.capture. R .string.toast_video_capture_failure
311+ R .string.toast_video_capture_failure
308312 ).assertIsNotDisplayed()
309313 }
310314) {
@@ -447,7 +451,7 @@ fun ComposeTestRule.isHdrEnabled(): Boolean {
447451
448452fun ComposeTestRule.getCurrentLensFacing (): LensFacing {
449453 onNodeWithTag(
450- com.google.jetpackcamera.ui.components.capture. FLIP_CAMERA_BUTTON
454+ FLIP_CAMERA_BUTTON
451455 ).fetchSemanticsNode(
452456 " Flip camera button is not visible on main screen."
453457 ).let { node ->
@@ -486,22 +490,30 @@ fun ComposeTestRule.getCurrentFlashMode(): FlashMode = visitQuickSettings {
486490
487491fun ComposeTestRule.getCurrentCaptureMode (): CaptureMode = visitQuickSettings {
488492 val standardRowExists = onAllNodesWithTag(
489- com.google.jetpackcamera.ui.components.capture. ROW_QUICK_SETTINGS_CAPTURE_MODE
493+ ROW_QUICK_SETTINGS_CAPTURE_MODE
490494 ).fetchSemanticsNodes().isNotEmpty()
491495
492496 if (standardRowExists) {
493497 return @visitQuickSettings CaptureMode .STANDARD
494498 }
495499
496500 val aspectRatioRowExists = onAllNodesWithTag(
497- com.google.jetpackcamera.ui.components.capture. ROW_QUICK_SETTINGS_ASPECT_RATIO
501+ ROW_QUICK_SETTINGS_ASPECT_RATIO
498502 ).fetchSemanticsNodes().isNotEmpty()
499503
500504 if (aspectRatioRowExists) {
501505 return @visitQuickSettings CaptureMode .IMAGE_ONLY
502506 }
503507
504- return @visitQuickSettings CaptureMode .VIDEO_ONLY
508+ val videoSettingsTitleExists = onAllNodes(
509+ hasText(getResString(CaptureR .string.quick_settings_title_video_settings))
510+ ).fetchSemanticsNodes().isNotEmpty()
511+
512+ if (videoSettingsTitleExists) {
513+ return @visitQuickSettings CaptureMode .VIDEO_ONLY
514+ }
515+
516+ throw AssertionError (" Unable to determine capture mode from quick settings" )
505517}
506518
507519// ////////////////////////////
0 commit comments