-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJavaZoneUITests.swift
71 lines (51 loc) · 1.52 KB
/
JavaZoneUITests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import XCTest
final class JavaZoneUITests: XCTestCase {
override func setUpWithError() throws {
continueAfterFailure = false
if UIDevice.current.userInterfaceIdiom == .pad {
XCUIDevice.shared.orientation = .landscapeLeft
}
}
override func tearDownWithError() throws {
}
func pause() {
sleep(2)
}
func tapElement(element: XCUIElement) {
element.tap()
pause()
}
func tapRow(app: XCUIApplication, idx: Int) {
app
.collectionViews
.buttons
.element(boundBy: idx)
.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
.tap()
pause()
}
@MainActor
func testScreenshots() throws {
let app = XCUIApplication()
setupSnapshot(app)
app.launch()
pause()
let tabBar = app.tabBars["Tab Bar"]
tapElement(element: tabBar.buttons["Sessions"])
if UIDevice.current.userInterfaceIdiom == .pad {
tapRow(app: app, idx: 0)
}
snapshot("1_SessionList")
if UIDevice.current.userInterfaceIdiom != .pad {
tapRow(app: app, idx: 0)
snapshot("2_Session")
}
tapElement(element: tabBar.buttons["My Schedule"])
if UIDevice.current.userInterfaceIdiom == .pad {
tapRow(app: app, idx: 1)
}
snapshot("3_Favourites")
tapElement(element: tabBar.buttons["Partners"])
snapshot("4_Partners")
}
}