Class: BeforeTest

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

Instance Method Summary collapse

Constructor Details

#initialize(testCase, driver) ⇒ BeforeTest

Returns a new instance of BeforeTest.



4
5
6
7
# File 'lib/template/before-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/before-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