-
Notifications
You must be signed in to change notification settings - Fork 3
/
sample.js
152 lines (128 loc) · 3.06 KB
/
sample.js
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/* SAMPLE FILE TO RUN SOME TEST CASES (modify to your project's HTML element names)
action: 2 choices, "value" inputs text into a form, "onClick" clicks on a button on your HTML
If you put "value" for action, specify which element on the HTML you want to target with "element"
Next, specify what you want the text to be in "text"
For example, if your test is inputting 'hello' into 'class="username"', then you would put:
action: 'value',
text: 'hello',
element: '.username'
If you put "onClick" for action, specify which element you want to click on.
For example, if your test is clicking on 'id="loginbtn"', then you would put:
action: 'onClick',
element: '#loginbtn'
-salazar.path sets the path to take screenshots of
-salazar.run sends the narrative object to the algorithm
*/
var salazar = require('./index.js');
salazar.path('http://localhost:8000');
salazar.run({
progression: "Incorrect Login",
description: "Puts in username",
result: 'res',
step: 1,
element: ".username",
text: 'wrongusername',
action: 'value',
png: "fl1",
})
salazar.run({
progression: "Incorrect Login",
description: "Puts in password",
result: 'res',
step: 2,
element: ".password",
text: 'dkfjk',
action: 'value',
png: "fl2",
})
salazar.run({
progression: "Incorrect Login",
description: "Press login button",
result: 'res',
step: 3,
element: "#loginbtn",
text: '',
action: 'onClick',
png: "fl3",
})
salazar.run({
progression: "User Registration",
description: "Click new user",
result: 'res',
step: 1,
element: "#newuser",
text: '',
action: 'onClick',
png: "gb1",
})
salazar.run({
progression: "User Registration",
description: "Puts in name",
result: 'res',
step: 2,
element: ".name",
text: 'dan',
action: 'value',
png: "gb2",
})
salazar.run({
progression: "User Registration",
description: "Puts in username",
result: 'res',
step: 2,
element: ".username",
text: 'dan',
action: 'value',
png: "gb3",
})
salazar.run({
progression: "User Registration",
description: "Puts in password",
result: 'res',
step: 2,
element: ".password",
text: 'pass123',
action: 'value',
png: "gb4",
})
salazar.run({
progression: "User Registration",
description: "Clicks on register",
result: 'res',
step: 2,
element: "#registerbtn",
text: '',
action: 'onClick',
png: "gb5",
})
salazar.run({
progression: "Correct Login",
description: "Type in username",
result: 'res',
step: 1,
element: ".username",
text: 'hello',
action: 'value',
png: "cl1",
})
salazar.run({
progression: "Correct Login",
description: "Type in password",
result: 'res',
step: 2,
element: ".password",
text: 'hello',
action: 'value',
png: "cl2",
})
salazar.run({
progression: "Correct Login",
description: "Clicks on button",
result: 'res',
step: 3,
element: "#loginbtn",
text: '',
action: 'onClick',
png: "cl3",
end: 'true'
})