Class: HTML_File_Generator

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

Instance Method Summary collapse

Constructor Details

#initialize(ruby_selenium_script) ⇒ HTML_File_Generator

Returns a new instance of HTML_File_Generator.



810
811
812
813
814
815
816
817
# File 'lib/RubySelenium.rb', line 810

def initialize(ruby_selenium_script)
    #command_line_options = GenerateCommand.parse(ARGV)
    @ruby_selenium_script = ruby_selenium_script
    @generate_location = COMMAND_GENERATE_LOCATION
    #@go_path = rubySeleniumConfig['TEST_LOCATION'].value
    #@ie_path = rubySeleniumConfig['IE_LOCATION'].value
    #@ff_path = rubySeleniumConfig['FF_LOCATION'].value
end

Instance Method Details

#create_single_script_fileObject



834
835
836
# File 'lib/RubySelenium.rb', line 834

def create_single_script_file
	File.open(@generate_location + "/" + @ruby_selenium_script.name + ".html", "w"){|f| f.print generate_single_script}
end

#create_test_runner_fileObject



838
839
840
# File 'lib/RubySelenium.rb', line 838

def create_test_runner_file
    File.open("#{@generate_location}/seleniumTestRunner.html", "w"){|f| f.print generate_test_runner}
end

#create_test_suite_fileObject



842
843
844
# File 'lib/RubySelenium.rb', line 842

def create_test_suite_file
    File.open("#{@generate_location}/seleniumTestSuite.html", "w"){|f| f.print generate_test_suite}
end

#generate_single_scriptObject



819
820
821
822
823
# File 'lib/RubySelenium.rb', line 819

def generate_single_script
	script_content = []
	@ruby_selenium_script.commands.each{|html| script_content << html.command}
	Templates.new(@ruby_selenium_script.name, script_content.join("\n")).selenium_test_script
end

#generate_test_runnerObject



825
826
827
# File 'lib/RubySelenium.rb', line 825

def generate_test_runner
    Templates.new("test_runner", "test_runner").selenium_test_runner
end

#generate_test_suiteObject



829
830
831
832
# File 'lib/RubySelenium.rb', line 829

def generate_test_suite
    test_suite_content = "<tr><td><a href=\"#{@ruby_selenium_script.name}.html\">#{@ruby_selenium_script.name}</a></td></tr>"
    Templates.new("test_suite", "test_suite", test_suite_content).selenium_test_suite
end