Last active
October 12, 2017 19:33
-
-
Save boek/435e9927c29c4e5c380ef87559e222dd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func test08PasteAndGo() { | |
let app = XCUIApplication() | |
// Inject a string into clipboard | |
let clipboardString = "Hello world" | |
UIPasteboard.general.string = clipboardString | |
// Enter 'mozilla' on the search field | |
let searchOrEnterAddressTextField = app.textFields["URLBar.urlText"] | |
searchOrEnterAddressTextField.typeText("mozilla.org\n") | |
// Check the correct site is reached | |
waitForValueContains(element: searchOrEnterAddressTextField, value: "https://www.mozilla.org/") | |
// Tap URL field, check for paste & go menu | |
searchOrEnterAddressTextField.tap() | |
searchOrEnterAddressTextField.press(forDuration: 1.5) | |
expectation(for: NSPredicate(format: "count > 0"), evaluatedWith: app.menuItems, handler: nil) | |
waitForExpectations(timeout: 10, handler: nil) | |
app.menuItems.element(boundBy: 3).tap() | |
snapshot("08PasteAndGo") | |
} |
5y
commented
Oct 11, 2017
func test08PasteAndGo() {
let app = XCUIApplication()
let urlBarTextfield = app.textFields["URLBar.urlText"]
urlBarTextfield.typeText("mozilla.org\n")
urlBarTextfield.tap()
expectation(for: NSPredicate(format: "count > 0"), evaluatedWith: app.menuItems, handler: nil)
let coord = urlBarTextfield.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
coord.doubleTap()
app.menuItems.element(boundBy: 4).tap()
let coord2 = urlBarTextfield.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 1))
coord2.doubleTap()
// app.textFields["URLBar.urlText"].tap()
snapshot("08PasteAndGo")
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment