-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsample-findr.taste
73 lines (54 loc) · 1.66 KB
/
sample-findr.taste
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
Taste Examples on google.com, written in plain Findr style
*/
import com.google.common.base.Predicate
import org.openqa.selenium.By
import org.openqa.selenium.Keys
import org.openqa.selenium.WebElement
import static com.pojosontheweb.taste.Taste.*
suite('Google Tests Findr') {
add test('text search') {
webDriver.get 'http://www.google.com'
findr()
.elem(By.id('lst-ib'))
.sendKeys('pojos on the web')
findr()
.elem(By.cssSelector('button.lsb'))
.where(attrEquals('value', 'Search'))
.click()
findr()
.elem(By.id('search'))
.elemList(By.cssSelector('h3.r'))
.at(0)
.elem(By.tagName('a'))
.where(textContains('POJOs on the Web'))
.eval()
}
add test('images search') {
webDriver.get 'http://www.google.com'
findr()
.elemList(By.tagName('a'))
.where(textEquals('Images'))
.at(0)
.click()
findr()
.elem(By.id('lst-ib'))
.sendKeys('pojos on the web', Keys.ENTER)
findr()
.elemList(By.cssSelector('a.rg_l'))
.where({ WebElement e ->
e.getAttribute('href').contains 'www.pojosontheweb.com'
} as Predicate)
.at(0)
.click()
findr()
.elemList(By.cssSelector('a.irc_vpl.irc_but'))
.where(textEquals('Visit page'))
.at(0)
.click()
findr()
.elem(By.cssSelector('div.jumbotron h1'))
.where(textEquals('POJOs on the Web!'))
.eval()
}
}