Class: Rubidium::TestCase

Inherits:
Object
  • Object
show all
Defined in:
lib/rubidium/test_case.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ TestCase

Returns a new instance of TestCase.



7
8
9
10
11
12
13
14
15
# File 'lib/rubidium/test_case.rb', line 7

def initialize(path)
  @path     = path
  x         = Nokogiri::HTML(File.read(path))
  @title    = x.xpath('//title').first.text 
  @base_url = x.xpath('//link').attr('href').value
  @selenese = x.xpath('//tbody/tr').map do |tr| 
    tr.search('td').map(&:text).reject { |txt| txt == "" }
  end
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



3
4
5
# File 'lib/rubidium/test_case.rb', line 3

def base_url
  @base_url
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/rubidium/test_case.rb', line 3

def path
  @path
end

#seleneseObject (readonly) Also known as: table

Returns the value of attribute selenese.



3
4
5
# File 'lib/rubidium/test_case.rb', line 3

def selenese
  @selenese
end

#titleObject (readonly) Also known as: name

Returns the value of attribute title.



3
4
5
# File 'lib/rubidium/test_case.rb', line 3

def title
  @title
end

Instance Method Details

#commandsObject



21
22
23
# File 'lib/rubidium/test_case.rb', line 21

def commands
  Translator.translate(selenese)
end

#rubyObject



17
18
19
# File 'lib/rubidium/test_case.rb', line 17

def ruby
  Translator.translate(selenese)
end