func takeNewPhoto()

in FriendlyPixUITests/FriendlyPixUITests.swift [125:146]


  func takeNewPhoto() {
    win.buttons["Open camera"].forceTapElement()
    let takePhotoButton = win.buttons["Take photo"]
    if !tryToTap(takePhotoButton, forTimeInterval: 3) {
      win.tap()
      takePhotoButton.tap()
    }
    let doneButton = win.buttons["Done"]
    if !tryToTap(doneButton, forTimeInterval: 3) {
      // The multiple permissions dialogs can prevent the take photo from happening.
      takePhotoButton.tap()
      if !tryToTap(doneButton, forTimeInterval: 3) {
        // No camera
        win.buttons["Cancel"].tap()
        return
      }
    }
    let captionField = win.textFields.element
    XCTAssert(tryToTap(captionField, forTimeInterval: 3))
    captionField.typeText("my friendly pic")
    win.buttons["UPLOAD THIS PIC"].tap()
  }