@@ -29,8 +29,19 @@ final class AttachmentCameraControllerTests: XCTestCase {
29
29
let app = XCUIApplication ( )
30
30
let cameraModeController = app. otherElements [ " CameraMode " ]
31
31
let cameraModeLabel = app. staticTexts [ " Camera Capture Mode " ]
32
+ let device = UIDevice . current. userInterfaceIdiom
33
+ let orientation = app. staticTexts [ " Device Orientation " ]
34
+
32
35
app. launch ( )
33
36
37
+ let attachmentCameraControllerTestsButton = app. buttons [ " AttachmentCameraController Tests " ]
38
+
39
+ XCTAssertTrue (
40
+ attachmentCameraControllerTestsButton. exists,
41
+ " The AttachmentCameraController Tests button wasn't found. "
42
+ )
43
+ attachmentCameraControllerTestsButton. tap ( )
44
+
34
45
addUIInterruptionMonitor ( withDescription: " Camera access alert " ) { ( alert) -> Bool in
35
46
alert. buttons [ " Allow " ] . tap ( )
36
47
return true
@@ -40,22 +51,27 @@ final class AttachmentCameraControllerTests: XCTestCase {
40
51
return true
41
52
}
42
53
43
- let attachmentCameraControllerTestsButton = app. buttons [ " AttachmentCameraController Tests " ]
44
-
45
- XCTAssertTrue (
46
- attachmentCameraControllerTestsButton. exists,
47
- " The AttachmentCameraController Tests button wasn't found. "
48
- )
49
- attachmentCameraControllerTestsButton. tap ( )
50
-
51
54
XCTAssertTrue (
52
55
cameraModeController. waitForExistence ( timeout: 5 )
53
56
)
54
- cameraModeController. swipeDown ( )
57
+
58
+ if device == . pad || ( device == . phone && orientation. label == " Landscape Right " ) {
59
+ cameraModeController. swipeDown ( )
60
+ } else if orientation. label == " Landscape Left " {
61
+ cameraModeController. swipeUp ( )
62
+ } else /* iPhone - portrait */ {
63
+ cameraModeController. swipeRight ( )
64
+ }
55
65
56
66
XCTAssertEqual ( cameraModeLabel. label, " Video " )
57
67
58
- cameraModeController. swipeUp ( )
68
+ if device == . pad || ( device == . phone && orientation. label == " Landscape Right " ) {
69
+ cameraModeController. swipeUp ( )
70
+ } else if orientation. label == " Landscape Left " {
71
+ cameraModeController. swipeDown ( )
72
+ } else /* iPhone - portrait */ {
73
+ cameraModeController. swipeLeft ( )
74
+ }
59
75
60
76
XCTAssertEqual ( cameraModeLabel. label, " Photo " )
61
77
}
0 commit comments