Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created April 23, 2020 19:21
Show Gist options
  • Save azamsharp/3d4217dcd481450760cebcb9c736e48f to your computer and use it in GitHub Desktop.
Save azamsharp/3d4217dcd481450760cebcb9c736e48f to your computer and use it in GitHub Desktop.
Given("I have following tasks") { args, userInfo in
XCUIApplication().launch()
let rows: NSArray = (userInfo?["DataTable"]) as! NSArray
let taskTextField = XCUIApplication().textFields["taskTextField"]
for index in 1...rows.count {
let taskName = (rows[index] as! NSArray)[0] as! String
taskTextField.tap()
taskTextField.typeText(taskName + "\n")
XCUIApplication().buttons["addTaskButton"].tap()
taskTextField.tap()
let deleteString = String(repeating: XCUIKeyboardKey.delete.rawValue, count: taskName.count)
// clear the textfield
taskTextField.typeText(deleteString)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment