代码之家  ›  专栏  ›  技术社区  ›  olyv

用xcuitest打开通用链接(深链接)

  •  0
  • olyv  · 技术社区  · 6 年前

    我想为本机iOS应用程序创建几个测试。更准确地说,我想测试深层链接。但我不知道如何触发与xcuitest的深层链接,我真的不知道如何 launch() launcArguments ( https://developer.apple.com/documentation/xctest/xcuiapplication 可以帮助我。有没有人有机会与Xcuitest建立深入的联系?

    2 回复  |  直到 6 年前
        1
  •  0
  •   Jinesh    6 年前
    1. let safari = XCUIApplication(bundleIdentifier: "com.apple.mobilesafari")

        2
  •  0
  •   Mladen    6 年前

    func testOpeningLinks() {
        let app = XCUIApplication()
        app.links["Some link text"].tap()
        // This is the place where your original app should be opened...
    
        // Find the XCUIApplication object:
        let originalApp = XCUIApplication(bundleIdentifier: "original.app.bundle.identifier")
        // You should be able to find some views from original app from here, eg. a button:
        let button = originalApp.buttons.element
    }