Skip to content

Commit f526f01

Browse files
committed
Logs UI tests
1 parent dd69301 commit f526f01

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed

MidiControl/Views/MidiEventsLogView.swift

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ struct MidiEventsLogView: View {
1414
List(midiEventsLogModel.logs) {
1515
Text($0.description)
1616
}
17+
.accessibilityLabel("Midi Logs List")
1718
}
1819
}
1920

MidiControlUITests/MidiControlUITests.swift

+70
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ final class MidiControlUITests: XCTestCase {
3636

3737
let midiSetupApp = XCUIApplication(bundleIdentifier: "com.apple.audio.AudioMIDISetup")
3838

39+
let vmpkApp = XCUIApplication(bundleIdentifier: "net.sourceforge.vmpk")
40+
3941
override func setUpWithError() throws {
4042
// Put setup code here. This method is called before the invocation of each test method in the class.
4143

@@ -107,6 +109,74 @@ final class MidiControlUITests: XCTestCase {
107109
midiSetupApp.terminate()
108110
}
109111

112+
func testLogsAreAdded() throws {
113+
let viewLogsButton = app.buttons["View Midi Messages Logs"]
114+
XCTAssertTrue(viewLogsButton.exists)
115+
viewLogsButton.click();
116+
117+
vmpkApp.terminate()
118+
vmpkApp.launch()
119+
120+
let inputCheckbox = app.checkBoxes["VMPK Output (MIDI-1UP)"]
121+
XCTAssertTrue(inputCheckbox.waitForExistence(timeout: 5))
122+
// Click if not checked
123+
if !(inputCheckbox.value as! Bool) {
124+
inputCheckbox.click()
125+
}
126+
else
127+
{
128+
inputCheckbox.doubleClick()
129+
}
130+
sleep(1)
131+
132+
let controlCheckBox = vmpkApp.checkBoxes.firstMatch
133+
XCTAssertTrue(controlCheckBox.exists)
134+
controlCheckBox.click()
135+
controlCheckBox.click()
136+
controlCheckBox.click()
137+
138+
let logsList = app.tables["Midi Logs List"]
139+
XCTAssertTrue(logsList.exists)
140+
141+
XCTAssertTrue(logsList.tableRows.count == 3)
142+
143+
vmpkApp.terminate()
144+
}
145+
146+
func testLogIsAddedWithCorrectText() throws {
147+
let viewLogsButton = app.buttons["View Midi Messages Logs"]
148+
XCTAssertTrue(viewLogsButton.exists)
149+
viewLogsButton.click();
150+
151+
vmpkApp.terminate()
152+
vmpkApp.launch()
153+
154+
let inputCheckbox = app.checkBoxes["VMPK Output (MIDI-1UP)"]
155+
XCTAssertTrue(inputCheckbox.waitForExistence(timeout: 5))
156+
// Click if not checked
157+
if !(inputCheckbox.value as! Bool) {
158+
inputCheckbox.click()
159+
}
160+
else
161+
{
162+
inputCheckbox.doubleClick()
163+
}
164+
sleep(1)
165+
166+
let controlCheckBox = vmpkApp.checkBoxes.firstMatch
167+
XCTAssertTrue(controlCheckBox.exists)
168+
controlCheckBox.click()
169+
170+
let logsList = app.tables["Midi Logs List"]
171+
XCTAssertTrue(logsList.exists)
172+
173+
let text = logsList.tableRows.firstMatch.staticTexts.firstMatch.value as! String
174+
print(text)
175+
XCTAssertTrue(text.contains("Control Change"))
176+
177+
vmpkApp.terminate()
178+
}
179+
110180
func testLaunchPerformance() throws {
111181
if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) {
112182
// This measures how long it takes to launch your application.

0 commit comments

Comments
 (0)