-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from vcamapp/fix/uitest
Fix UI tests
- Loading branch information
Showing
9 changed files
with
118 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// | ||
// XCUIApplication+.swift | ||
// VCamUIPreviewUITests | ||
// | ||
// Created by Tatsuya Tanaka on 2023/10/22. | ||
// | ||
|
||
import XCTest | ||
import VCamData | ||
import VCamDefaults | ||
|
||
extension XCUIApplication { | ||
struct Configuration { | ||
static let `default` = Configuration() | ||
var previousVersion: String? = "999.9.9" // skip migration | ||
} | ||
|
||
static func make(with configuration: Configuration = .default) -> XCUIApplication { | ||
let app = XCUIApplication() | ||
app.launchArguments += ["UITesting"] | ||
if let value = configuration.previousVersion { | ||
app.setUserDefaults(value: value, for: .previousVersion) | ||
} | ||
return app | ||
} | ||
|
||
func setUserDefaults<T: UserDefaultsValue>(value: String, for key: UserDefaults.Key<T>) { | ||
launchArguments += ["-\(key.rawValue)", value] | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
app/xcode/App/VCamUIPreviewUITests/XCUIElementQuery+.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// XCUIElementQuery+.swift | ||
// VCamUIPreviewUITests | ||
// | ||
// Created by Tatsuya Tanaka on 2023/10/22. | ||
// | ||
|
||
import XCTest | ||
|
||
extension XCUIElementQuery { | ||
func contains(label: String) -> XCUIElement { | ||
containing(.init(format: "label CONTAINS '\(label)'")).element | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters