Class: Templates

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

Instance Method Summary collapse

Constructor Details

#initialize(script_file_name = "", script_content = "", test_suite_content = "") ⇒ Templates

Returns a new instance of Templates.



921
922
923
924
925
# File 'lib/RubySelenium.rb', line 921

def initialize(script_file_name = "", script_content = "", test_suite_content = "")
    @script_file_name = script_file_name
    @script_content = script_content
    @test_suite_content = test_suite_content
end

Instance Method Details

#selenium_test_runnerObject



974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
# File 'lib/RubySelenium.rb', line 974

def selenium_test_runner
    html = <<-EOF
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type" />

<title>Selenium Functional Test Runner</title>
<script language="JavaScript" type="text/javascript" src="../../../html-xpath/html-xpath-patched.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../selenium-browserbot.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../selenium-api.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../selenium-commandhandlers.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../selenium-executionloop.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../selenium-fitrunner.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../selenium-logging.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../htmlutils.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../selenium-domviewer.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../xpath.js"></script>
<script language="JavaScript" type="text/javascript" src="../../../user-extensions.js"></script>
<link rel="stylesheet" type="text/css" href="../../../selenium.css" />
</head>

<body onload="start();">

<table class="layout">
<form action="" name="controlPanel">

<!-- Suite, Test, Control Panel -->

<tr class="selenium">
<td width="25%" height="30%" rowspan="2"><iframe name="testSuiteFrame" id="testSuiteFrame" src="seleniumTestSuite.html"></iframe></td>
<td width="50%" height="30%" rowspan="2"><iframe name="testFrame" id="testFrame"></iframe></td>
<th width="25%" height="1" class="header">
<h1><a href="http://selenium.thoughtworks.com" title="The Selenium Project">Selenium</a> TestRunner</h1>
</th>
</tr>

<tr class="selenium">
<td width="25%" height="30%" id="controlPanel">

<table id="controls">
<tr>
<td>
<b>Run:</b>
<button type="button" id="runTest" onclick="runSingleTest();"><em>Selected</em> Test</button>
<button type="button" id="runSuite" onclick="startTestSuite();"><strong>All</strong> Tests</button>
</td>
</tr>
<tr>
<td>
<b>Mode:</b>
<label><input id="modeRun" type="radio" name="runMode" value="0" checked="checked"/>Run</label>
<label><input id="modeWalk" type="radio" name="runMode" value="500" />Walk</label>
<label><input id="modeStep" type="radio" name="runMode" value="-1" />Step</label>
</td>
</tr>
<tr>
<td>
<button type="button" id="domViewer1" onclick="newRoot=getIframeDocument(getElementById('myiframe'));window.open('../../domviewer.html');return false;">View DOM</button>
<button type="button" id="continueTest" disabled="disabled">Next/Continue</button>
</td>
</tr>
</table>

<table id="stats" align="center">
<tr>
<td colspan="2" align="right">Elapsed:</td>
<td id="elapsedTime" colspan="2">00.00</td>
</tr>
<tr>
<th colspan="2">Tests</th>
<th colspan="2">Commands</th>
</tr>
<tr>
<td class="count" id="testRuns">0</td>
<td>run</td>
<td class="count" id="commandPasses">0</td>
<td>passed</td>
</tr>
<tr>
<td class="count" id="testFailures">0</td>
<td>failed</td>
<td class="count" id="commandFailures">0</td>
<td>failed</td>
</tr>
<tr>
<td colspan="2"></td>
<td class="count" id="commandErrors">0</td>
<td>incomplete</td>
</tr>
</table>
</td>
</tr>

<!-- AUT -->
<tr>
<td colspan="3" height="70%"><iframe name="myiframe" id="myiframe" src="../../../TestRunner-splash.html"></iframe></td>
</tr>
</form>
</table>

<div id="logging-console">
<h1>Javascript Log Console (<a id="closeLog" href="javascript:LOG.hide()">Close</a> <a href="javascript:LOG.clear();LOG.hide();">Clear</a>)</h1>
<ul id="log-list"/>
</div>
<script language="javascript">
LOG = new Logger(LEVEL_WARN);
LOG.hide();
</script>
</body>
</html>
EOF
end

#selenium_test_scriptObject



927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
# File 'lib/RubySelenium.rb', line 927

def selenium_test_script
html = <<-EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>#{@script_file_name}</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<tbody>
<tr>
<td rowspan="1" colspan="3">#{@script_file_name}<br>
</td>
</tr>
#{@script_content}
</tbody>
</table>
</body>
</html><table>
<tr>
<td><b>Selenium Id</b></td>
<td id="SeleniumKey"></td>
</tr>
</table>
EOF
end

#selenium_test_suiteObject



955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
# File 'lib/RubySelenium.rb', line 955

def selenium_test_suite
    html = <<-EOF
<html>
<head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Portal Framework Functional Testing</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<tbody>
<tr><td><b>seleniumTestSuite</b></td></tr>
#{@test_suite_content}
</tbody>
</table>
</body>
</html>
EOF
end