selwet 0.0.2 → 0.0.4

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/selwet.rb +148 -149
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8720c4cffa2e62abbecc43b2aad890a34334826
4
- data.tar.gz: 639eef52da75979f0fac7bf3c24e3f77fb71a97f
3
+ metadata.gz: fc3ec7997b98a5c664f7d89b93934c83a6b1974a
4
+ data.tar.gz: 270efcc87c357852ede662c652e14eb32636c8bf
5
5
  SHA512:
6
- metadata.gz: f8f473682e8fb6b9ae03b177fd4354dd6def56182f9e05f813f5dfa8d029bb6d604c0bfca9626db28d6022b1c0a853b8532a9fc49e8270374f4c11ab7b1f710d
7
- data.tar.gz: 87689728ceca18daf17b58b5d85aa838f1a750a7ced743ccc9b9c183340f2a803ae46a1f32ebf0a538fddbb564aea36b889dec6ee9f4b2add45514833038559f
6
+ metadata.gz: 660fa083b776931dc94d5b84d57a0e86bb42ddca187de4e7b0abf730cf5bf6d9388d7aed8bbc75a21e61b78895f1227d9689fa194859504bc90e6f8b23a9ea0f
7
+ data.tar.gz: 85f054d4e39d3510368114b62b52bc7245d80b803e8776ca6625319d3ef9077f8d7240a96f12d4f9e887278dfa6769370ab86e5014dad9c4a409f63b4ac1c7c3
data/lib/selwet.rb CHANGED
@@ -15,14 +15,14 @@ module SelWeT
15
15
  #
16
16
  # class SelWeT::Unit
17
17
  #
18
- # setBrowsers [:firefox, :chrome]
19
- # setSeleniumServerUrl 'http://127.0.0.1:4444/wd/hub'
18
+ # set_browsers [:firefox, :chrome]
19
+ # set_selenium_server_url 'http://127.0.0.1:4444/wd/hub'
20
20
  #
21
21
  # context "Example" do
22
22
  # should "About Us" do
23
- # Unit.followTheLink "http://inventos.ru/"
23
+ # Unit.go_to "http://inventos.ru/"
24
24
  # Unit.click '#menu-item-3795 a'
25
- # status, error = Unit.checkLocation 'http://inventos.ru/about/#top'
25
+ # status, error = Unit.check_location 'http://inventos.ru/about/#top'
26
26
  # assert_equal true, status, error
27
27
  # end
28
28
  # end
@@ -70,7 +70,7 @@ class Unit < Test::Unit::TestCase
70
70
  exit 1
71
71
  end
72
72
  if @@start_url
73
- followTheLink @@start_url
73
+ go_to @@start_url
74
74
  end
75
75
  end
76
76
  #Закрывает все используемые браузеры после выполнения всех тестов.
@@ -90,30 +90,30 @@ class Unit < Test::Unit::TestCase
90
90
  #@param url [String] URL запущенного Selenium Server
91
91
  #@example
92
92
  # class SelWeT::Unit
93
- # setBrowsers [:firefox, :chrome]
94
- # setSeleniumServerUrl "http://localhost:4444/wd/hub"
93
+ # set_browsers [:firefox, :chrome]
94
+ # set_selenium_server_url "http://localhost:4444/wd/hub"
95
95
  # ...
96
- def setSeleniumServerUrl url
96
+ def set_selenium_server_url url
97
97
  @@url_selenium = url
98
98
  end
99
99
  #Устанавливает стартовую страницу при запуске браузеров. Использовать только перед блоками тестов.
100
100
  #@param url [String] URL тестируемого сайта
101
101
  #@example
102
102
  # class SelWeT::Unit
103
- # setBrowsers [:firefox, :chrome]
104
- # setSeleniumServerUrl "http://localhost:4444/wd/hub"
105
- # openLink "http://inventos.ru/"
103
+ # set_browsers [:firefox, :chrome]
104
+ # set_selenium_server_url "http://localhost:4444/wd/hub"
105
+ # open_link "http://inventos.ru/"
106
106
  # ...
107
- def openLink url
107
+ def open_link url
108
108
  @@start_url = url
109
109
  end
110
110
  #Устанавливает используемые для тестирования браузеры. Необходимо использовать перед блоками тестов.
111
111
  #@param params [Array] массив, содержащий одно или несколько из следующий значений: :firefox, :chrome, :ie, :safari. Для :chrome и :ie Selenium Server следует запускать с соответствующими драйверами.
112
112
  #@example
113
113
  # class SelWeT::Unit
114
- # setBrowsers [:firefox, :chrome]
114
+ # set_browsers [:firefox, :chrome]
115
115
  # ...
116
- def setBrowsers params
116
+ def set_browsers params
117
117
  @@browsers = params
118
118
  end
119
119
  #Переход по ссылке. Используется только в блоках should или setup
@@ -121,18 +121,18 @@ class Unit < Test::Unit::TestCase
121
121
  #@example
122
122
  # class SelWeT::Unit
123
123
  #
124
- # setBrowsers [:firefox, :chrome]
125
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
124
+ # set_browsers [:firefox, :chrome]
125
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
126
126
  # @@somePage = 'http://inventos.ru/produkty/#top'
127
127
  #
128
128
  # context "Example" do
129
129
  #
130
130
  # setup do
131
- # Unit.followTheLink @@somePage
131
+ # Unit.go_to @@somePage
132
132
  # end
133
133
  # ...
134
134
  #@see refresh
135
- def followTheLink url
135
+ def go_to url
136
136
  threads = []
137
137
  @@driver.each do |name, driver|
138
138
  threads << Thread.new do
@@ -141,7 +141,7 @@ class Unit < Test::Unit::TestCase
141
141
  end
142
142
  threads.each(&:join)
143
143
  end
144
- #Переключиться на iframe. Используется только в блоках should или setup. Для дальнейшего взаимодействия с основной страницей необходимо выполнить {switchToPage}.
144
+ #Переключиться на iframe. Используется только в блоках should или setup. Для дальнейшего взаимодействия с основной страницей необходимо выполнить {to_page}.
145
145
  #@param selector [String] css селектор на нужный iframe.
146
146
  #@example
147
147
  # class SelWeT::Unit
@@ -151,14 +151,14 @@ class Unit < Test::Unit::TestCase
151
151
  # context "Example" do
152
152
  #
153
153
  # should 'Show popup' do
154
- # Unit.switchToFrame 'iframe#frame1'
154
+ # Unit.to_frame 'iframe#frame1'
155
155
  # ...
156
- #@see switchToPage
157
- def switchToFrame selector
156
+ #@see to_page
157
+ def to_frame selector
158
158
  threads = []
159
- status, message, tags = getTag selector
159
+ status, message, tags = get_tag selector
160
160
  unless status
161
- return false, "switchToFrame: "+message
161
+ return false, "to_frame: "+message
162
162
  end
163
163
  bad_values = []
164
164
  tags.each do |name, tag|
@@ -167,7 +167,7 @@ class Unit < Test::Unit::TestCase
167
167
  end
168
168
  end
169
169
  if bad_values.size != 0
170
- return false, "switchToFrame: #{bad_values.join(", ")} - It is not 'iframe'! "
170
+ return false, "to_frame: #{bad_values.join(", ")} - It is not 'iframe'! "
171
171
  end
172
172
  @@driver.each do |name, driver|
173
173
  threads << Thread.new do
@@ -189,9 +189,9 @@ class Unit < Test::Unit::TestCase
189
189
  #
190
190
  # should 'Do something' do
191
191
  # ...
192
- # Unit.clearCache
192
+ # Unit.clear_cache
193
193
  # ...
194
- def clearCache
194
+ def clear_cache
195
195
  threads = []
196
196
  @@driver.each do |name, driver|
197
197
  threads << Thread.new do
@@ -210,10 +210,10 @@ class Unit < Test::Unit::TestCase
210
210
  #
211
211
  # should 'Show popup' do
212
212
  # ...
213
- # Unit.switchToPage
213
+ # Unit.to_page
214
214
  # ...
215
- #@see switchToFrame
216
- def switchToPage
215
+ #@see to_frame
216
+ def to_page
217
217
  threads = []
218
218
  @@driver.each do |name, driver|
219
219
  threads << Thread.new do
@@ -233,9 +233,9 @@ class Unit < Test::Unit::TestCase
233
233
  # context "Example" do
234
234
  #
235
235
  # should "TODO something" do
236
- # Unit.selectItemsFromTheSelect 'select[name="some_name"]', ['value 1', 'value2']
236
+ # Unit.set_select_items 'select[name="some_name"]', ['value 1', 'value2']
237
237
  # ...
238
- def selectItemsFromTheSelect selector, items = nil
238
+ def set_select_items selector, items = nil
239
239
  threads = []
240
240
  status = true
241
241
  errors = []
@@ -252,7 +252,7 @@ class Unit < Test::Unit::TestCase
252
252
  if thread_status
253
253
  unless element.tag_name == 'select'
254
254
  status = false
255
- errors << "#{name} - selectItemsFromTheSelect using only for select!"
255
+ errors << "#{name} - set_select_items using only for select!"
256
256
  else
257
257
  option = Selenium::WebDriver::Support::Select.new(element)
258
258
  if option.multiple?
@@ -267,7 +267,7 @@ class Unit < Test::Unit::TestCase
267
267
  end
268
268
  if items.size > 0
269
269
  status = false
270
- errors << "selectItemsFromTheSelect: Some passed option values were not found (#{name}): "+items.join(' ')
270
+ errors << "set_select_items: Some passed option values were not found (#{name}): "+items.join(' ')
271
271
  end
272
272
  end
273
273
  else
@@ -277,11 +277,11 @@ class Unit < Test::Unit::TestCase
277
277
  option.select_by(:text, items[0])
278
278
  rescue
279
279
  status = false
280
- errors << "selectItemsFromTheSelect: Option '#{items}' does not exist!"
280
+ errors << "set_select_items: Option '#{items}' does not exist!"
281
281
  end
282
282
  else
283
283
  status = false
284
- errors << "selectItemsFromTheSelect: '#{selector}' is not multiple! You must pass a single value."
284
+ errors << "set_select_items: '#{selector}' is not multiple! You must pass a single value."
285
285
  end
286
286
  end
287
287
  end
@@ -305,34 +305,33 @@ class Unit < Test::Unit::TestCase
305
305
  #
306
306
  # should "TODO something" do
307
307
  # ...
308
- # Unit.click 'input[type="submit"]'
308
+ # status, error = Unit.click 'input[type="submit"]'
309
309
  # ...
310
- #@see clickOkOnTheAlert
311
- #@see clickCancelOnTheAlert
310
+ #@see alert_ok
311
+ #@see alert_cancel
312
312
  def click selector, browserName = nil
313
313
  threads = []
314
314
  status = true
315
315
  @@driver.each do |name, driver|
316
316
  if browserName.nil? or name == browserName.to_s
317
- threads << Thread.new do
318
- begin
319
- element = driver.find_element(:css => selector)
320
- wait = Selenium::WebDriver::Wait.new(:timeout => 15)
321
- wait.until { driver.find_element(:css => selector).displayed? }
322
- driver.action.move_to(element).perform
323
- element.click
324
- rescue Exception => e
325
- status = false
326
- puts 'click: '+name+' : Bad selector : '+selector
317
+ threads << Thread.new do
318
+ begin
319
+ element = driver.find_element(:css => selector)
320
+ wait = Selenium::WebDriver::Wait.new(:timeout => 15)
321
+ wait.until { driver.find_element(:css => selector).displayed? }
322
+ driver.action.move_to(element).perform
323
+ element.click
324
+ rescue Exception => e
325
+ status = false
326
+ end
327
327
  end
328
328
  end
329
329
  end
330
- end
331
330
  threads.each(&:join)
332
331
  if status
333
- return status
332
+ return [true, ""]
334
333
  else
335
- return [status, "click: Bad selector : #{selector}"]
334
+ return [false, "click: Bad selector : #{selector}"]
336
335
  end
337
336
  end
338
337
  #Кликает на кнопку 'Ok' в окне алерта. Используется только в блоках should или setup.
@@ -346,11 +345,11 @@ class Unit < Test::Unit::TestCase
346
345
  #
347
346
  # should "TODO something" do
348
347
  # ...
349
- # Unit.clickOkOnTheAlert
348
+ # Unit.alert_ok
350
349
  # ...
351
350
  #@see click
352
- #@see clickCancelOnTheAlert
353
- def clickOkOnTheAlert
351
+ #@see alert_cancel
352
+ def alert_ok
354
353
  status = true
355
354
  error = nil
356
355
  threads = []
@@ -360,7 +359,7 @@ class Unit < Test::Unit::TestCase
360
359
  driver.switch_to.alert.accept
361
360
  rescue
362
361
  status = false
363
- error = 'clickOkOnTheAlert: No alert!'
362
+ error = 'alert_ok: No alert!'
364
363
  end
365
364
  end
366
365
  end
@@ -372,19 +371,19 @@ class Unit < Test::Unit::TestCase
372
371
  #@example
373
372
  # class SelWeT::Unit
374
373
  #
375
- # setBrowsers [:firefox, :chrome]
376
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
374
+ # set_browsers [:firefox, :chrome]
375
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
377
376
  # @@somePage = 'http://inventos.ru/produkty/#top'
378
377
  #
379
378
  # context "Example" do
380
379
  #
381
380
  # should "TODO something" do
382
381
  # ...
383
- # Unit.clickOkOnTheAlert
382
+ # Unit.alert_cancel
384
383
  # ...
385
384
  #@see click
386
- #@see clickOkOnTheAlert
387
- def clickCancelOnTheAlert
385
+ #@see alert_ok
386
+ def alert_cancel
388
387
  status = true
389
388
  error = nil
390
389
  threads = []
@@ -393,7 +392,7 @@ class Unit < Test::Unit::TestCase
393
392
  begin
394
393
  driver.switch_to.alert.dismiss
395
394
  rescue
396
- puts 'clickOkOnTheAlert: No alert!'
395
+ puts 'alert_ok: No alert!'
397
396
  end
398
397
  end
399
398
  end
@@ -407,8 +406,8 @@ class Unit < Test::Unit::TestCase
407
406
  #@example
408
407
  # class SelWeT::Unit
409
408
  #
410
- # setBrowsers [:firefox, :chrome]
411
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
409
+ # set_browsers [:firefox, :chrome]
410
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
412
411
  # @@somePage = 'http://inventos.ru/produkty/#top'
413
412
  #
414
413
  # context "Example" do
@@ -418,7 +417,7 @@ class Unit < Test::Unit::TestCase
418
417
  # status, error, data = Unit.checkElement 'a.toolbar', true
419
418
  # ...
420
419
  #@see checkElements
421
- def checkElement selector, link = nil
420
+ def check_element selector, link = nil
422
421
  result = [true, "", []]
423
422
  threads = []
424
423
  data = {}
@@ -474,30 +473,30 @@ class Unit < Test::Unit::TestCase
474
473
  result[2] = data
475
474
  return result
476
475
  end
477
- #Проверяет наличие элементов. Используется только в блоках should или setup. Возвращает первым аргументом статус выполнения операции (Boolean), вторым - сообщение об ошибке, если она возникнет (String), третьим - текст, содержащийся в элементах ([Hash, Hash, ...]). Хеши имеют ту же структуру, что и в {checkElement}.
476
+ #Проверяет наличие элементов. Используется только в блоках should или setup. Возвращает первым аргументом статус выполнения операции (Boolean), вторым - сообщение об ошибке, если она возникнет (String), третьим - текст, содержащийся в элементах ([Hash, Hash, ...]). Хеши имеют ту же структуру, что и в {check_element}.
478
477
  # @param selectors [Array] массив css селекторов элементов.
479
478
  # @param link [Boolean] параметр, позволяющий получить значение поля href. Работает только для ссылок.
480
479
  #@return [[Boolean, String, [Hash, Hash,...]]]
481
480
  #@example
482
481
  # class SelWeT::Unit
483
482
  #
484
- # setBrowsers [:firefox]
485
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
483
+ # set_browsers [:firefox]
484
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
486
485
  # @@somePage = 'http://inventos.ru/produkty/#top'
487
486
  #
488
487
  # context "Example" do
489
488
  #
490
489
  # should "TODO something" do
491
- # status, error, data = Unit.checkElements ['input#email','input#password','a']
490
+ # status, error, data = Unit.check_elements ['input#email','input#password','a']
492
491
  # #Получим количество ссылок
493
492
  # a_num = data[2]["firefox"].size
494
493
  # ...
495
- #@see checkElement
496
- def checkElements selectors, link = nil
494
+ #@see check_element
495
+ def check_elements selectors, link = nil
497
496
  result = [true, "", []]
498
497
  return [false, "Argument 'selectors' must be Array!", []] unless selectors.class == Array
499
498
  selectors.each do |selector|
500
- status, message, data = checkElement(selector, link)
499
+ status, message, data = check_element(selector, link)
501
500
  unless status
502
501
  result[1] = (result[1].empty? ? message+"\n" : result[1]+message+"\n")
503
502
  end
@@ -520,7 +519,7 @@ class Unit < Test::Unit::TestCase
520
519
  # should "TODO something" do
521
520
  # Unit.refresh
522
521
  # ...
523
- #@see followTheLink
522
+ #@see go_to
524
523
  def refresh
525
524
  threads = []
526
525
  @@driver.each_value do |driver|
@@ -541,15 +540,15 @@ class Unit < Test::Unit::TestCase
541
540
  # context "Example" do
542
541
  #
543
542
  # should 'TODO something' do
544
- # Unit.followTheLink @@somePage
543
+ # Unit.go_to @@somePage
545
544
  # ...
546
- # status, message, tags = Unit.getTag '#some_id'
545
+ # status, message, tags = Unit.get_tag '#some_id'
547
546
  # ...
548
- def getTag selector
547
+ def get_tag selector
549
548
  threads = []
550
549
  tags = {}
551
- status, message = checkElement selector
552
- return [false, "getTag: "+message] unless status
550
+ status, message = check_element selector
551
+ return [false, "get_tag: "+message] unless status
553
552
  @@driver.each do |name, driver|
554
553
  threads << Thread.new do
555
554
  tags[name] = driver.find_element(:css => selector).tag_name
@@ -571,23 +570,23 @@ class Unit < Test::Unit::TestCase
571
570
  # context "Example" do
572
571
  #
573
572
  # should 'TODO something' do
574
- # Unit.followTheLink @@somePage
573
+ # Unit.go_to @@somePage
575
574
  # ...
576
- # status, error = Unit.fillTheField 'input#some_id', 'some text' #заполнить текстовое поле
577
- # status, error = Unit.fillTheField 'input#[type={"file"}]', 'C:\\path\to\file' #выбрать файл для загрузки
575
+ # status, error = Unit.fill 'input#some_id', 'some text' #заполнить текстовое поле
576
+ # status, error = Unit.fill 'input#[type={"file"}]', 'C:\\path\to\file' #выбрать файл для загрузки
578
577
  # ...
579
- #@see followTheLink
580
- #@see postForm
581
- def fillTheField selector, value, postfix = nil
578
+ #@see go_to
579
+ #@see post_form
580
+ def fill selector, value, postfix = nil
582
581
  result = [true, ""]
583
582
  threads = []
584
- status, message, data = checkElement selector
583
+ status, message, data = check_element selector
585
584
  unless status
586
585
  return [false, message]
587
586
  end
588
587
  data.each_value do |i|
589
588
  if i.size>1
590
- return [false, "fillTheField: Element with selector #{selector} not uniq!"]
589
+ return [false, "fill: Element with selector #{selector} not uniq!"]
591
590
  end
592
591
  end
593
592
  @@driver.each do |name, driver|
@@ -616,15 +615,15 @@ class Unit < Test::Unit::TestCase
616
615
  # context "Example" do
617
616
  #
618
617
  # should 'TODO something' do
619
- # Unit.followTheLink @@somePage
618
+ # Unit.go_to @@somePage
620
619
  # ...
621
- # status, check = Unit.getStatus 'input[type="checkbox"]'
620
+ # status, check = Unit.get_status 'input[type="checkbox"]'
622
621
  # ...
623
- def getStatus selector
622
+ def get_status selector
624
623
  threads = []
625
- status, message, data = checkfElement selector
626
- return [false, 'getStatus: Element not uniq!'] if data.values[0].size>1
627
- return [false, "getStatus: "+message, tag] unless status
624
+ status, message, data = check_element selector
625
+ return [false, 'get_status: Element not uniq!'] if data.values[0].size>1
626
+ return [false, "get_status: "+message, tag] unless status
628
627
  status = true
629
628
  @@driver.each do |name, driver|
630
629
  threads << Thread.new do
@@ -657,31 +656,31 @@ class Unit < Test::Unit::TestCase
657
656
  # context "Example" do
658
657
  #
659
658
  # should "Successfull authorization" do
660
- # status, error = Unit.postForm ".form", {'#email' => 'admin@example.ru', '#password' => 'admin', '.checkbox' => :click, '.submit'=>:submit}
659
+ # status, error = Unit.post_form ".form", {'#email' => 'admin@example.ru', '#password' => 'admin', '.checkbox' => :click, '.submit'=>:submit}
661
660
  # ...
662
661
  #@see click
663
- #@see fillTheField
664
- def postForm selector, fields = nil
662
+ #@see fill
663
+ def post_form selector, fields = nil
665
664
  result = [true, ""]
666
665
  fields = {} if fields.nil?
667
- status, message, data = checkElement selector
666
+ status, message, data = check_element selector
668
667
  unless status
669
668
  return [false, message]
670
669
  end
671
670
  data.each do |key, value|
672
671
  if value.size>1
673
- return [false, "postForm: (#{key}) Found more than one form with selector '#{selector}'"]
672
+ return [false, "post_form: (#{key}) Found more than one form with selector '#{selector}'"]
674
673
  end
675
674
  end
676
675
  check_elements = ''
677
676
  fields.keys.each do |key|
678
- status, message, data = checkElement key
677
+ status, message, data = check_element key
679
678
  unless status
680
679
  check_elements = (check_elements.empty? ? message+' : '+key+"\n" : check_elements+message+' : '+key+"\n")
681
680
  end
682
681
  data.each do |browser, value|
683
682
  if value.size>1
684
- check_elements = (check_elements.empty? ? "postForm:(#{browser}) Element of form not uniq : "+key+"\n" : check_elements+"postForm:(#{browser}) Element of form not uniq : "+key+"\n")
683
+ check_elements = (check_elements.empty? ? "post_form:(#{browser}) Element of form not uniq : "+key+"\n" : check_elements+"post_form:(#{browser}) Element of form not uniq : "+key+"\n")
685
684
  end
686
685
  end
687
686
  end
@@ -700,7 +699,7 @@ class Unit < Test::Unit::TestCase
700
699
  end
701
700
  end
702
701
  end
703
- return [false, 'postForm: Bad args was passed: '+bad_args.to_s] unless bad_args.empty?
702
+ return [false, 'post_form: Bad args was passed: '+bad_args.to_s] unless bad_args.empty?
704
703
  fields.each do |key, value|
705
704
  if value == :click
706
705
  click key
@@ -709,7 +708,7 @@ class Unit < Test::Unit::TestCase
709
708
  submit_button = key
710
709
  end
711
710
  if value.class == Array
712
- status, error = selectItemsFromTheSelect(key, value)
711
+ status, error = set_select_items(key, value)
713
712
  return [false, error] unless status
714
713
  end
715
714
  end
@@ -741,7 +740,7 @@ class Unit < Test::Unit::TestCase
741
740
  end
742
741
  end
743
742
  threads.each(&:join)
744
- return [false, 'postForm: For "select" you must pass array with selected values!'] if errors
743
+ return [false, 'post_form: For "select" you must pass array with selected values!'] if errors
745
744
  click submit_button unless !submit_button
746
745
  return result
747
746
  end
@@ -751,20 +750,20 @@ class Unit < Test::Unit::TestCase
751
750
  #@example
752
751
  # class SelWeT::Unit
753
752
  #
754
- # setBrowsers [:firefox, :chrome]
755
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
753
+ # set_browsers [:firefox, :chrome]
754
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
756
755
  # @@somePage = 'http://www.example.com'
757
756
  #
758
757
  # context "Example" do
759
758
  #
760
759
  # should 'Correct link' do
761
- # Unit.followTheLink @@somePage
760
+ # Unit.go_to @@somePage
762
761
  # ...
763
- # status, error = Unit.checkLocation 'http://www.example.com/other_page'
762
+ # status, error = Unit.check_location 'http://www.example.com/other_page'
764
763
  # ...
765
- #@see followTheLink
766
- #@see getLocation
767
- def checkLocation url
764
+ #@see go_to
765
+ #@see get_location
766
+ def check_location url
768
767
  result = [true, ""]
769
768
  threads = []
770
769
  @@driver.each do |name, driver|
@@ -791,20 +790,20 @@ class Unit < Test::Unit::TestCase
791
790
  #@example
792
791
  # class SelWeT::Unit
793
792
  #
794
- # setBrowsers [:firefox, :chrome]
795
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
793
+ # set_browsers [:firefox, :chrome]
794
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
796
795
  # @@somePage = 'http://www.example.com'
797
796
  #
798
797
  # context "Example" do
799
798
  #
800
799
  # should 'Correct link' do
801
- # Unit.followTheLink @@somePage
800
+ # Unit.go_to @@somePage
802
801
  # ...
803
- # location = Unit.getLocation
802
+ # location = Unit.get_location
804
803
  # ...
805
- #@see checkLocation
806
- #@see followTheLink
807
- def getLocation
804
+ #@see check_location
805
+ #@see go_to
806
+ def get_location
808
807
  result = {}
809
808
  threads = []
810
809
  @@driver.each do |name, driver|
@@ -824,14 +823,14 @@ class Unit < Test::Unit::TestCase
824
823
  #@example
825
824
  # class SelWeT::Unit
826
825
  #
827
- # setBrowsers [:firefox, :chrome]
828
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
826
+ # set_browsers [:firefox, :chrome]
827
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
829
828
  # @@somePage = 'http://www.example.com'
830
829
  #
831
830
  # context "Example" do
832
831
  #
833
832
  # should 'Make screenshot' do
834
- # Unit.followTheLink @@somePage
833
+ # Unit.go_to @@somePage
835
834
  # ...
836
835
  # Unit.screenshot 'TestScreenshot'
837
836
  # ...
@@ -850,23 +849,23 @@ class Unit < Test::Unit::TestCase
850
849
  #@example
851
850
  # class SelWeT::Unit
852
851
  #
853
- # setBrowsers [:firefox, :chrome]
854
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
852
+ # set_browsers [:firefox, :chrome]
853
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
855
854
  # @@somePage = 'http://www.example.com'
856
855
  #
857
856
  # context "Example" do
858
857
  #
859
858
  # should 'TODO somethin' do
860
- # Unit.followTheLink @@somePage
859
+ # Unit.go_to @@somePage
861
860
  # ...
862
- # Unit.openInNewWindow 'a.someclass'
861
+ # Unit.in_new_window 'a.someclass'
863
862
  # ...
864
863
  #@see switchToWindow
865
- #@see closeWindow
866
- def openInNewWindow selector
864
+ #@see close_window
865
+ def in_new_window selector
867
866
  threads = []
868
867
  not_opened = false
869
- status, message = checkElement selector
868
+ status, message = check_element selector
870
869
  unless status
871
870
  return [false, message]
872
871
  end
@@ -900,21 +899,21 @@ class Unit < Test::Unit::TestCase
900
899
  #@example
901
900
  # class SelWeT::Unit
902
901
  #
903
- # setBrowsers [:firefox, :chrome]
904
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
902
+ # set_browsers [:firefox, :chrome]
903
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
905
904
  # @@somePage = 'http://www.example.com'
906
905
  #
907
906
  # context "Example" do
908
907
  #
909
908
  # should 'TODO something' do
910
- # Unit.openInNewTab 'a.someclass'
909
+ # Unit.in_new_window 'a.someclass'
911
910
  # ...
912
- # Unit.switchToWindow 0
913
- # Unit.closeWindow 1
911
+ # Unit.switch_to_window 0
912
+ # Unit.close_window 1
914
913
  # ...
915
- #@see openInNewWindow
916
- #@see closeWindow
917
- def switchToWindow num
914
+ #@see in_new_window
915
+ #@see close_window
916
+ def switch_to_window num
918
917
  threads = []
919
918
  status = true
920
919
  @@driver.each do |name, driver|
@@ -935,18 +934,18 @@ class Unit < Test::Unit::TestCase
935
934
  #@example
936
935
  # class SelWeT::Unit
937
936
  #
938
- # setBrowsers [:firefox, :chrome]
939
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
937
+ # set_browsers [:firefox, :chrome]
938
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
940
939
  # @@somePage = 'http://www.example.com'
941
940
  #
942
941
  # context "Example" do
943
942
  #
944
943
  # should 'TODO somethin' do
945
- # Unit.closeWindow 2
944
+ # Unit.close_window 2
946
945
  # ...
947
- #@see openInNewTab
948
- #@see switchToWindow
949
- def closeWindow num
946
+ #@see in_new_window
947
+ #@see switch_to_window
948
+ def close_window num
950
949
  threads = []
951
950
  status = true
952
951
  @@driver.each do |name, driver|
@@ -977,18 +976,18 @@ class Unit < Test::Unit::TestCase
977
976
  #@example
978
977
  # class SelWeT::Unit
979
978
  #
980
- # setBrowsers [:firefox, :chrome]
981
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
979
+ # set_browsers [:firefox, :chrome]
980
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
982
981
  # @@somePage = 'http://www.example.com'
983
982
  #
984
983
  # context "Example" do
985
984
  #
986
985
  # should 'TODO somethin' do
987
- # Unit.hoverOverElement "div.menu"
986
+ # Unit.hover_over_element "div.menu"
988
987
  # Unit.click "a.some_url"
989
988
  # ...
990
- def hoverOverElement selector
991
- status, message = checkElement selector
989
+ def hover_over_element selector
990
+ status, message = check_element selector
992
991
  unless status
993
992
  return [false, message]
994
993
  end
@@ -1007,17 +1006,17 @@ class Unit < Test::Unit::TestCase
1007
1006
  #@example
1008
1007
  # class SelWeT::Unit
1009
1008
  #
1010
- # setBrowsers [:firefox, :chrome]
1011
- # setSeleniumServerUrl 'http://localhost:4444/wd/hub'
1009
+ # set_browsers [:firefox, :chrome]
1010
+ # set_selenium_server_url 'http://localhost:4444/wd/hub'
1012
1011
  # @@somePage = 'http://www.example.com'
1013
1012
  #
1014
1013
  # context "Example" do
1015
1014
  #
1016
1015
  # should 'TODO somethin' do
1017
1016
  # ...
1018
- # titles = Unit.getTitle
1017
+ # titles = Unit.window_title
1019
1018
  # ...
1020
- def getTitle
1019
+ def window_title
1021
1020
  threads = []
1022
1021
  status = true
1023
1022
  @@driver.each do |name, driver|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selwet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Motin Artem
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-29 00:00:00.000000000 Z
11
+ date: 2015-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -85,7 +85,7 @@ extensions: []
85
85
  extra_rdoc_files: []
86
86
  files:
87
87
  - lib/selwet.rb
88
- homepage:
88
+ homepage: https://github.com/inventos/selwet.git
89
89
  licenses:
90
90
  - MIT
91
91
  metadata: {}
@@ -105,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  version: '0'
106
106
  requirements: []
107
107
  rubyforge_project:
108
- rubygems_version: 2.2.2
108
+ rubygems_version: 2.4.5
109
109
  signing_key:
110
110
  specification_version: 4
111
111
  summary: Selenium Web Test