您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

43 行
1.5 KiB

  1. // Copyright 2013 The Flutter Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. import XCTest
  5. class URLLauncherUITests: XCTestCase {
  6. var app: XCUIApplication!
  7. override func setUp() {
  8. continueAfterFailure = false
  9. app = XCUIApplication()
  10. app.launch()
  11. }
  12. func testLaunch() {
  13. let app = self.app!
  14. let buttonNames: [String] = [
  15. "Launch in app", "Launch in app(JavaScript ON)", "Launch in app(DOM storage ON)",
  16. "Launch a universal link in a native app, fallback to Safari.(Youtube)",
  17. ]
  18. for buttonName in buttonNames {
  19. let button = app.buttons[buttonName]
  20. XCTAssertTrue(button.waitForExistence(timeout: 30.0))
  21. XCTAssertEqual(app.webViews.count, 0)
  22. button.tap()
  23. let webView = app.webViews.firstMatch
  24. XCTAssertTrue(webView.waitForExistence(timeout: 30.0))
  25. XCTAssertTrue(app.buttons["ForwardButton"].waitForExistence(timeout: 30.0))
  26. XCTAssertTrue(app.buttons["Share"].exists)
  27. XCTAssertTrue(app.buttons["OpenInSafariButton"].exists)
  28. let doneButton = app.buttons["Done"]
  29. XCTAssertTrue(doneButton.waitForExistence(timeout: 30.0))
  30. // This should just be doneButton.tap, but for some reason that stopped working in Xcode 15;
  31. // tapping via coordinate works, however.
  32. doneButton.coordinate(withNormalizedOffset: CGVector()).withOffset(CGVector(dx: 10, dy: 10))
  33. .tap()
  34. }
  35. }
  36. }