-
Notifications
You must be signed in to change notification settings - Fork 63
/
PersonCRUDSpec.groovy
80 lines (69 loc) · 1.16 KB
/
PersonCRUDSpec.groovy
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
74
75
76
77
78
79
80
import geb.spock.GebReportingSpec
import spock.lang.*
import pages.*
@Stepwise
class PersonCRUDSpec extends GebReportingSpec {
def "there are no people"() {
when:
to ListPage
then:
personRows.size() == 0
}
def "add a person"() {
when:
newPersonButton.click()
then:
at CreatePage
}
def "enter the details"() {
when:
$("#visible").click()
firstName = "Luke"
lastName = "Daley"
createButton.click()
then:
at ShowPage
}
def "check the entered details"() {
expect:
firstName == "Luke"
lastName == "Daley"
visible == true
}
def "edit the details"() {
when:
editButton.click()
then:
at EditPage
when:
$("#visible").click()
updateButton.click()
then:
at ShowPage
}
def "check in listing"() {
when:
to ListPage
then:
personRows.size() == 1
def row = personRow(0)
row.firstName == "Luke"
row.lastName == "Daley"
}
def "show person"() {
when:
personRow(0).showLink.click()
then:
at ShowPage
}
def "delete user"() {
given:
def deletedId = id
when:
withConfirm { deleteButton.click() }
then:
at ListPage
message == "Person $deletedId deleted"
personRows.size() == 0
}
}