qfunction 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile +1 -1
- data/lib/function/HTMLElement.rb +17 -23
- data/lib/function/assertions.rb +18 -14
- data/lib/function/sfunction.rb +15 -7
- data/lib/qfunction.rb +1 -0
- data/lib/qstart.rb +1 -1
- metadata +3 -3
data/Rakefile
CHANGED
data/lib/function/HTMLElement.rb
CHANGED
@@ -141,6 +141,11 @@ module Qh
|
|
141
141
|
$ff.form(:id,text).submit
|
142
142
|
end
|
143
143
|
|
144
|
+
def submitFormname(text)
|
145
|
+
waitExists($ff.form(:name,text))
|
146
|
+
$ff.form(:name,text).submit
|
147
|
+
end
|
148
|
+
|
144
149
|
def getFormid(text)
|
145
150
|
waitExists($ff.form(:id,text))
|
146
151
|
return $ff.form(:id,text)
|
@@ -202,11 +207,10 @@ module Qh
|
|
202
207
|
if i>=$timeout then
|
203
208
|
assert( $ff.frame(:"#{typeF}",fr).text_field(:"#{typeT}",text).exists? )
|
204
209
|
end
|
205
|
-
puts i
|
206
210
|
end
|
207
211
|
end
|
208
212
|
|
209
|
-
def
|
213
|
+
def waitFFilefield(fr,text,typeF,typeT = "id") #0.0.8
|
210
214
|
i = 0
|
211
215
|
frame = getFrameid("#{fr}")
|
212
216
|
while !$ff.frame(:"#{typeF}",fr).file_field(:"#{typeT}",text).exists? do
|
@@ -474,41 +478,25 @@ module Qh
|
|
474
478
|
end
|
475
479
|
end
|
476
480
|
|
477
|
-
#Attach
|
481
|
+
#Attach 0.0.8
|
478
482
|
def getAttachurl(url)
|
479
|
-
i = 0
|
480
483
|
begin
|
481
484
|
ff1 = $ff.attach(:url,url)
|
482
485
|
rescue Exception => e
|
483
486
|
sleep(1)
|
484
|
-
|
485
|
-
if i <= $timeout then retry
|
486
|
-
else
|
487
|
-
puts e.exception
|
488
|
-
#~ puts e.backtrace
|
489
|
-
end
|
490
|
-
end
|
491
|
-
if i <= $timeout then
|
492
|
-
return ff1
|
487
|
+
retry
|
493
488
|
end
|
489
|
+
return ff1
|
494
490
|
end
|
495
491
|
|
496
492
|
def getAttachtitle(title)
|
497
|
-
i = 0
|
498
493
|
begin
|
499
494
|
ff1 = $ff.attach(:title,title)
|
500
495
|
rescue Exception => e
|
501
496
|
sleep(1)
|
502
|
-
|
503
|
-
if i <= 20 then retry
|
504
|
-
else
|
505
|
-
puts e.exception
|
506
|
-
#~ puts e.backtrace
|
507
|
-
end
|
508
|
-
end
|
509
|
-
if i <= 20 then
|
510
|
-
return ff1
|
497
|
+
retry
|
511
498
|
end
|
499
|
+
return ff1
|
512
500
|
end
|
513
501
|
|
514
502
|
#Javascript event:<br>
|
@@ -524,4 +512,10 @@ module Qh
|
|
524
512
|
def wait_ut(text)
|
525
513
|
Watir::Waiter.wait_until($timeout) { text }
|
526
514
|
end
|
515
|
+
|
516
|
+
#Remove all Cookies on Browser
|
517
|
+
def removeAllCookies #0.0.8
|
518
|
+
jssh_command = "Components.classes[\"@mozilla.org/cookiemanager;1\"].getService(Components.interfaces.nsICookieManager).removeAll();"
|
519
|
+
$jssh_socket.send("#{jssh_command}\n", 0)
|
520
|
+
end
|
527
521
|
end
|
data/lib/function/assertions.rb
CHANGED
@@ -32,7 +32,7 @@ end
|
|
32
32
|
#type = 3:url<br>
|
33
33
|
#type = 4:value<br>
|
34
34
|
#type = 5:maxlength<br>
|
35
|
-
def assertEqual(value1,value2,type=1)
|
35
|
+
def assertEqual(value1,value2,type=1) #0.0.8
|
36
36
|
i = 0
|
37
37
|
if type == 1 then
|
38
38
|
begin
|
@@ -51,7 +51,8 @@ def assertEqual(value1,value2,type=1)
|
|
51
51
|
sleep(1)
|
52
52
|
i += 1
|
53
53
|
if i <= $timeout+1 then retry
|
54
|
-
end
|
54
|
+
end
|
55
|
+
assert_equal(value1, value2.title)
|
55
56
|
end
|
56
57
|
elsif type == 3 then
|
57
58
|
begin
|
@@ -60,7 +61,8 @@ def assertEqual(value1,value2,type=1)
|
|
60
61
|
sleep(1)
|
61
62
|
i += 1
|
62
63
|
if i <= $timeout+1 then retry
|
63
|
-
end
|
64
|
+
end
|
65
|
+
assert_equal(value1, value2.url)
|
64
66
|
end
|
65
67
|
elsif type == 4 then
|
66
68
|
begin
|
@@ -69,7 +71,8 @@ def assertEqual(value1,value2,type=1)
|
|
69
71
|
sleep(1)
|
70
72
|
i += 1
|
71
73
|
if i <= $timeout+1 then retry
|
72
|
-
end
|
74
|
+
end
|
75
|
+
assert_equal(value1, value2.value)
|
73
76
|
end
|
74
77
|
elsif type == 5 then
|
75
78
|
begin
|
@@ -78,10 +81,11 @@ def assertEqual(value1,value2,type=1)
|
|
78
81
|
sleep(1)
|
79
82
|
i += 1
|
80
83
|
if i <= $timeout+1 then retry
|
81
|
-
end
|
84
|
+
end
|
85
|
+
assert_equal(value1, value2.maxlength)
|
82
86
|
end
|
83
87
|
end
|
84
|
-
|
88
|
+
|
85
89
|
end
|
86
90
|
|
87
91
|
#Assert Equal False,<br>
|
@@ -130,7 +134,7 @@ def assertfalseEqual(value1,value2,type=1)
|
|
130
134
|
i += 1
|
131
135
|
end
|
132
136
|
end
|
133
|
-
|
137
|
+
|
134
138
|
end
|
135
139
|
|
136
140
|
#Wait Element show
|
@@ -145,12 +149,12 @@ def waitExists(text,type = 1)
|
|
145
149
|
break;
|
146
150
|
end
|
147
151
|
end
|
148
|
-
|
152
|
+
|
149
153
|
else
|
150
154
|
begin
|
151
155
|
assert( text.click )
|
152
156
|
rescue
|
153
|
-
|
157
|
+
|
154
158
|
sleep(1)
|
155
159
|
i += 1
|
156
160
|
retry if i <= $timeout
|
@@ -186,7 +190,7 @@ def falseExistsid(text,tags=1)
|
|
186
190
|
assert(!$ff.link(:id,text).exists?)
|
187
191
|
end
|
188
192
|
end
|
189
|
-
|
193
|
+
|
190
194
|
elsif tags == 2 then
|
191
195
|
i = 0
|
192
196
|
while $ff.button(:id,text).exists? do
|
@@ -229,7 +233,7 @@ def falseExiststext(text,tags=1)
|
|
229
233
|
assert(!$ff.link(:text,text).exists?)
|
230
234
|
end
|
231
235
|
end
|
232
|
-
|
236
|
+
|
233
237
|
end
|
234
238
|
end
|
235
239
|
|
@@ -245,7 +249,7 @@ def falseExistsclass(text,tags=1)
|
|
245
249
|
break;
|
246
250
|
end
|
247
251
|
end
|
248
|
-
|
252
|
+
|
249
253
|
end
|
250
254
|
end
|
251
255
|
|
@@ -261,7 +265,7 @@ def falseExistshref(text,tags=1)
|
|
261
265
|
assert(!$ff.link(:href,text).exists?)
|
262
266
|
end
|
263
267
|
end
|
264
|
-
|
268
|
+
|
265
269
|
end
|
266
270
|
end
|
267
271
|
|
@@ -276,7 +280,7 @@ def falseExistsindex(browser,text,tags=1)
|
|
276
280
|
assert(!browser.link(:index,text).exists?)
|
277
281
|
end
|
278
282
|
end
|
279
|
-
|
283
|
+
|
280
284
|
end
|
281
285
|
end
|
282
286
|
|
data/lib/function/sfunction.rb
CHANGED
@@ -89,16 +89,16 @@ module Qs
|
|
89
89
|
return x
|
90
90
|
end
|
91
91
|
|
92
|
-
def cutEndline(text) #0.0.
|
92
|
+
def cutEndline(text) #0.0.8
|
93
93
|
if RUBY_VERSION <= '1.8.6' then
|
94
|
-
if text[text.length - 1] < 32
|
95
|
-
return text[0,text.length -
|
96
|
-
else return text[0,text.length
|
94
|
+
if text[text.length - 1] < 32 then
|
95
|
+
return text[0,text.length - 1]
|
96
|
+
else return text[0,text.length]
|
97
97
|
end
|
98
98
|
else
|
99
|
-
if text[text.length - 1] < ' '
|
100
|
-
return text[0,text.length -
|
101
|
-
else return text[0,text.length
|
99
|
+
if text[text.length - 1] < ' ' then
|
100
|
+
return text[0,text.length - 1]
|
101
|
+
else return text[0,text.length]
|
102
102
|
end
|
103
103
|
end
|
104
104
|
end
|
@@ -138,4 +138,12 @@ module Qs
|
|
138
138
|
else return File.dirname(file).gsub('/', '\\')
|
139
139
|
end
|
140
140
|
end
|
141
|
+
|
142
|
+
def send_Mail_on_Gmail(nickname,pass,to,subject,content)
|
143
|
+
g = GmailSender.new(nickname, pass)
|
144
|
+
g.send(:to => to,
|
145
|
+
:subject => subject,
|
146
|
+
:content => content,
|
147
|
+
:content_type => 'text/html')
|
148
|
+
end
|
141
149
|
end
|
data/lib/qfunction.rb
CHANGED
data/lib/qstart.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 8
|
9
|
+
version: 0.0.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- QuangMV, Cyworld VietNam, 5th Floor, 447 Lac Long Quan Street, Tay Ho Dist, Ha Noi, VietNam
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-29 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|