forked from CodeEditApp/CodeEdit
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTerminalUtilityUITests.swift
More file actions
62 lines (50 loc) · 2.02 KB
/
TerminalUtilityUITests.swift
File metadata and controls
62 lines (50 loc) · 2.02 KB
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
//
// TerminalUtilityUITests.swift
// CodeEditUITests
//
// Created by Khan Winter on 8/8/25.
//
import XCTest
final class TerminalUtilityUITests: XCTestCase {
var app: XCUIApplication!
var window: XCUIElement!
var utilityArea: XCUIElement!
var path: String!
override func setUp() async throws {
// MainActor required for async compatibility which is required to make this method throwing
try await MainActor.run {
(app, path) = try App.launchWithTempDir()
window = Query.getWindow(app)
XCTAssertTrue(window.exists, "Window not found")
window.toolbars.firstMatch.click()
utilityArea = Query.Window.getUtilityArea(window)
XCTAssertTrue(utilityArea.exists, "Utility Area not found")
}
}
func testTerminalsInputData() throws {
let terminal = utilityArea.textViews["Terminal Emulator"]
XCTAssertTrue(terminal.exists)
terminal.click()
terminal.typeText("echo hello world")
terminal.typeKey(.enter, modifierFlags: [])
let value = try XCTUnwrap(terminal.value as? String)
XCTAssertEqual(value.components(separatedBy: "hello world").count - 1, 2)
}
func testTerminalsKeepData() throws {
var terminal = utilityArea.textViews["Terminal Emulator"]
XCTAssertTrue(terminal.exists)
terminal.click()
terminal.typeText("echo hello world")
terminal.typeKey(.enter, modifierFlags: [])
let terminals = utilityArea.descendants(matching: .any).matching(identifier: "terminalsList").element
XCTAssertTrue(terminals.exists)
terminals.click()
let terminalRow = terminals.cells.firstMatch
XCTAssertTrue(terminalRow.exists)
terminalRow.click()
terminal = utilityArea.textViews["Terminal Emulator"]
XCTAssertTrue(terminal.exists)
let finalValue = try XCTUnwrap(terminal.value as? String)
XCTAssertEqual(finalValue.components(separatedBy: "hello world").count - 1, 2)
}
}