Class: Test

Inherits:
Object
  • Object
show all
Defined in:
lib/template/test-ruby.rb

Instance Method Summary collapse

Constructor Details

#initialize(testCase, driver) ⇒ Test

Returns a new instance of Test.



4
5
6
7
# File 'lib/template/test-ruby.rb', line 4

def initialize(testCase,driver)
  @testCase =  testCase
  @driver =  driver
end

Instance Method Details

#runObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/template/test-ruby.rb', line 8

def run
  # Here some example

  inputs = @testCase['testCases']
  inputs.each do |key,input|
    element = @driver.find_element :css => key
    element.send_keys input
  end

  buttonSubmit = @driver.find_element :css => ".uk-button-primary"
  buttonSubmit.click
  #
  wait = Selenium::WebDriver::Wait.new(:timeout => 30)
  wait.until { @driver.find_element :css => ".uk-alert" }
  #
  # puts "Page title is #{@driver.title}"
end