selenium-core-runner 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -1,3 +1,21 @@
1
- = SeleniumWebRunner
1
+ = selenium-core-runner
2
2
 
3
- This project rocks and uses MIT-LICENSE.
3
+ *Selenium Core runner for rails3
4
+
5
+ Put test suites and cases created on Selenium IDE into test/selenium.
6
+ Access to /selenium-core-runner
7
+
8
+ Assumed structure in test/selenium.
9
+
10
+ test
11
+ selenium/
12
+ test_suite_name (test suite)
13
+ test_suite_name/
14
+ test_case1.html
15
+ test_case2.html
16
+ .
17
+ .
18
+ .
19
+
20
+
21
+ This project rocks and uses MIT-LICENSE.
@@ -1,15 +1,32 @@
1
1
  module SeleniumCoreRunner
2
2
  class SuitesController < ApplicationController
3
- def index
3
+ private
4
+ def suites_dir
5
+ Rails.root.to_s+"/test/selenium"
6
+ end
7
+ public
8
+ def list
9
+ @suites = []
10
+ Dir::entries(suites_dir).each {|v|
11
+ unless FileTest::directory?(suites_dir+"/"+v)
12
+ @suites.push v
13
+ end
14
+ }
15
+ end
16
+
17
+ def runner
18
+ @suite = params[:suite]||"default"
19
+ end
20
+
21
+ def prompt
22
+ @suite = params[:suite]||"default"
23
+ render :layout=>false
4
24
  end
5
25
 
6
26
  def show
7
27
  path = params[:suite]
8
- if params[:case].blank?
9
- path = params[:suite]+".html"
10
- else
11
- path = params[:suite]+"/"+params[:case]
12
- end
28
+ path += "."+params[:format] unless params[:format].blank?
29
+ path += "/"+params[:case] unless params[:case].blank?
13
30
  open(Rails.root.to_s+"/test/selenium/#{path}") {|f|
14
31
  render :text=>f.read , :layout=>false
15
32
  }
@@ -0,0 +1,3 @@
1
+ <%@suites.each{|suite|%>
2
+ <%=link_to suite, selenium_core_runner_path(:suite=>suite) %>
3
+ <%}%>
@@ -0,0 +1,145 @@
1
+ <html>
2
+ <!--
3
+ Copyright 2004 ThoughtWorks, Inc
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+
18
+ <head>
19
+ <meta content="text/html; charset=ISO-8859-1"
20
+ http-equiv="content-type">
21
+ <title>Select a Test Suite</title>
22
+ <script language="JavaScript" type="text/javascript" src="scripts/selenium-browserdetect.js"></script>
23
+ <script language="JavaScript" type="text/javascript" src="scripts/xmlextras.js"></script>
24
+ <script>
25
+
26
+ function load() {
27
+ if (browserVersion.isHTA) {
28
+ document.getElementById("save-div").style.display = "inline";
29
+ }
30
+ if (/thisIsSeleniumServer/.test(window.location.search)) {
31
+ document.getElementById("slowResources-div").style.display = "inline";
32
+ if (browserVersion.isHTA || browserVersion.isChrome) {
33
+ document.getElementById("test").value = "http://localhost:4444/selenium-server/tests/TestSuite.html";
34
+ }
35
+ }
36
+ }
37
+
38
+ function autoCheck() {
39
+ var auto = document.getElementById("auto");
40
+ var autoDiv = document.getElementById("auto-div");
41
+ if (auto.checked) {
42
+ autoDiv.style.display = "inline";
43
+ } else {
44
+ autoDiv.style.display = "none";
45
+ }
46
+ }
47
+
48
+ function slowCheck() {
49
+ var slowResourcesCheckbox = document.getElementById("slowResources");
50
+ var slowResources = slowResourcesCheckbox.checked ? true : false;
51
+ var xhr = XmlHttp.create();
52
+ var driverUrl = "http://localhost:4444/selenium-server/driver/?cmd=slowResources&1=" + slowResources;
53
+ xhr.open("GET", driverUrl, true);
54
+ xhr.send(null);
55
+ }
56
+
57
+ function saveCheck() {
58
+ var results = document.getElementById("results");
59
+ var check = document.getElementById("save").checked;
60
+ if (check) {
61
+ results.firstChild.nodeValue = "Results file ";
62
+ document.getElementById("resultsUrl").value = "results.html";
63
+ } else {
64
+ results.firstChild.nodeValue = "Results URL ";
65
+ document.getElementById("resultsUrl").value = "../postResults";
66
+ }
67
+ }
68
+
69
+ function go() {
70
+ if (!browserVersion.isHTA && !browserVersion.isChrome) return true;
71
+ var inputs = document.getElementsByTagName("input");
72
+ var queryString = "";
73
+ for (var i = 0; i < inputs.length; i++) {
74
+ var elem = inputs[i];
75
+ var name = elem.name;
76
+ var value = elem.value;
77
+ if (elem.type == "checkbox") {
78
+ value = elem.checked;
79
+ }
80
+ queryString += escape(name) + "=" + escape(value);
81
+ if (i < (inputs.length - 1)) {
82
+ queryString += "&";
83
+ }
84
+ }
85
+
86
+ window.parent.selenium = null;
87
+ window.parent.htmlTestRunner.controlPanel.queryString = queryString;
88
+ window.parent.htmlTestRunner.loadSuiteFrame();
89
+ return false;
90
+ }
91
+ </script>
92
+ </head>
93
+
94
+ <body onload="load()" style="font-size: x-small">
95
+ <form id="prompt" target="_top" method="GET" onsubmit="return go();" action="./runner">
96
+
97
+ <p>
98
+ Test Suite:
99
+ <input id="test" name="test" size="30" value="<%=@suite%>"/>
100
+ </p>
101
+
102
+ <p align="center"><input type="submit" value="Go"/></p>
103
+
104
+ <fieldset>
105
+ <legend>Options</legend>
106
+
107
+ <p>
108
+ <input id="multiWindow" type="checkbox" name="multiWindow" onclick="autoCheck();"/> <label
109
+ for="multiWindow">AUT in separate window</label>
110
+
111
+ <p>
112
+
113
+ <div id="slowResources-div" style="display: none">
114
+ <p>
115
+ <input id="slowResources" type="checkbox" name="slowResources" onclick="slowCheck();" /> <label for="slowResources">Slow down web server</label>
116
+ </p>
117
+ </div>
118
+
119
+ <p>
120
+ <input id="auto" type="checkbox" name="auto" onclick="autoCheck();"/> <label for="auto">Run
121
+ automatically</label>
122
+ </p>
123
+
124
+ <div id="auto-div" style="display: none">
125
+ <p>
126
+ <input id="close" type="checkbox" name="close"/> <label for="close">Close afterwards </label>
127
+ </p>
128
+
129
+ <div id="save-div" style="display: none">
130
+ <br/><label for="save">Save to file </label><input id="save" type="checkbox" name="save"
131
+ onclick="saveCheck();"/>
132
+ </div>
133
+
134
+ <p id="results">
135
+ Results URL:
136
+ <input id="resultsUrl" name="resultsUrl" value="../postResults"/>
137
+ </p>
138
+
139
+ </div>
140
+ </fieldset>
141
+
142
+
143
+ </form>
144
+ </body>
145
+ </html>
@@ -67,7 +67,7 @@ to work-around a bug in IE on Win2K whereby the HTA application doesn't function
67
67
 
68
68
  <tr class="selenium">
69
69
  <td width="25%" height="30%">
70
- <iframe name="testSuiteFrame" id="testSuiteFrame" src="./TestPrompt.html" application="yes"></iframe>
70
+ <iframe name="testSuiteFrame" id="testSuiteFrame" src="<%=selenium_core_runner_prompt_path(:suite=>@suite)%>" application="yes"></iframe>
71
71
  </td>
72
72
  <td width="50%" height="30%">
73
73
  <iframe name="testFrame" id="testFrame" application="yes" src="Blank.html"></iframe>
data/config/routes.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  Rails.application.routes.draw do |map|
2
- match 'selenium-core-runner', :to => redirect("/selenium-core-runner/index")
3
- match 'selenium-core-runner/index' => 'selenium_core_runner/suites#index', :as => :selenium_core_runner
2
+ match 'selenium-core-runner', :to => redirect("/selenium-core-runner/list")
3
+ match 'selenium-core-runner/list' => 'selenium_core_runner/suites#list', :as => :selenium_core_runner_suites
4
+ match 'selenium-core-runner/prompt' => 'selenium_core_runner/suites#prompt', :as => :selenium_core_runner_prompt
5
+ match 'selenium-core-runner/runner' => 'selenium_core_runner/suites#runner', :as => :selenium_core_runner
4
6
  match 'selenium-core-runner/:suite' => 'selenium_core_runner/suites#show', :as => 'selenium_core_runner_suite'
5
7
  match 'selenium-core-runner/:suite/:case' => 'selenium_core_runner/suites#show', :as => 'selenium_core_runner_suite'
6
8
  end
@@ -92,7 +92,7 @@ Copyright 2004 ThoughtWorks, Inc
92
92
  </head>
93
93
 
94
94
  <body onload="load()" style="font-size: x-small">
95
- <form id="prompt" target="_top" method="GET" onsubmit="return go();" action="./index">
95
+ <form id="prompt" target="_top" method="GET" onsubmit="return go();" action="./runner">
96
96
 
97
97
  <p>
98
98
  Test Suite:
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: selenium-core-runner
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors: []
8
8
 
@@ -23,7 +23,9 @@ extra_rdoc_files: []
23
23
 
24
24
  files:
25
25
  - app/controllers/selenium_core_runner/suites_controller.rb
26
- - app/views/selenium_core_runner/suites/index.html.erb
26
+ - app/views/selenium_core_runner/suites/list.html.erb
27
+ - app/views/selenium_core_runner/suites/prompt.html.erb
28
+ - app/views/selenium_core_runner/suites/runner.html.erb
27
29
  - app/views/selenium_core_runner/suites/show.html.erb
28
30
  - lib/selenium-core-runner/engine.rb
29
31
  - lib/selenium-core-runner.rb