Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save marufsiddiqui/40d124e38f8f47e92139 to your computer and use it in GitHub Desktop.
Save marufsiddiqui/40d124e38f8f47e92139 to your computer and use it in GitHub Desktop.
browser.get "/phones" # navigate to /phones URL
input.clear() # clear text input field
expect(browser.getTitle()).toMatch 'My Google Photo Gallery'
expect(browser.getCurrentUrl()).toMatch "/phones$"
expect(element.all(by_.repeater("phone in phones")).count()).toBe 8
expect(element.all(by_.repeater("phone in phones").column("phone.name")).first().getText()).toBe "Motorola XOOM"
# Find by...
# --------------
# ... element with {{scopeVar}} syntax.
element(by_.binding("person.name")).getText().then (name) ->
expect(name).toBe "Foo"
return
# ... element with ng-bind="scopeVar" syntax.
expect(element(by_.binding("person.email")).getText()).toBe "foo@bar.com"
# ... by model
input = element(by_.model("person.name"))
input.sendKeys "123"
expect(input.getAttribute("value")).toBe "Foo123"
expect(element(by_.binding("person.email")).getText()).toBe "foo@bar.com"
# ... by repeater
expect(element.all(by_.repeater("phone in phones")).count()).toBe 8
# Select option in dropdown list
# -----------------------------
<select ng-model="orderProp">
<option value="name">Alphabetical</option>
<option value="age">Newest</option>
</select>
element(By.model('orderProp')).$('[value="age"]').click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment