我面临的问题是我想通过启动参数将登录用户重定向到主屏幕,但功能不起作用这是我的功能
func testL_SettingScreen() {
app.launchArguments.append("HomeScreen")
app.launch()
app.staticTexts["No Alerts detected around you."].exists
app.buttons["MenuBtn"].tap()
}
并且我在app delegate中的didfinishlaunchingwithoptions中调用了启动参数
if CommandLine.arguments.contains("HomeScreen"), let user = HelperClass.decode() {
user.cellVerified = "1"
HelperClass.encode(savedPerson: user)
}
你能用launchEnvironment
吗?
就像是:
func testL_SettingScreen() {
app.launchEnvironment = ["HomeScreen": "YES"]
app.launch()
app.staticTexts["No Alerts detected around you."].exists
app.buttons["MenuBtn"].tap()
}
然后在你的didFinishLaunchingWithOptions
:
let environment = ProcessInfo.processInfo.environment
let value = environment["HomeScreen"] != nil
if value, let user = HelperClass.decode() {
user.cellVerified = "1"
HelperClass.encode(savedPerson: user)
}