symbiont 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +14 -0
- data/HISTORY.md +6 -0
- data/README.md +1 -1
- data/app/Gemfile +4 -0
- data/app/app.rb +167 -0
- data/app/config/database.rb +9 -0
- data/app/models/plan.rb +10 -0
- data/app/models/product.rb +10 -0
- data/app/models/study.rb +11 -0
- data/app/models/user.rb +13 -0
- data/app/public/css/style.css +138 -0
- data/app/views/create_plan.erb +21 -0
- data/app/views/create_product.erb +15 -0
- data/app/views/create_study.erb +24 -0
- data/app/views/create_user.erb +60 -0
- data/app/views/db_plans.erb +31 -0
- data/app/views/db_products.erb +29 -0
- data/app/views/db_studies.erb +33 -0
- data/app/views/db_users.erb +23 -0
- data/app/views/entity_list.erb +10 -0
- data/app/views/index.erb +7 -0
- data/app/views/layout.erb +39 -0
- data/app/views/login_page.erb +17 -0
- data/app/views/success_1.erb +2 -0
- data/app/views/success_2.erb +2 -0
- data/app/views/test_database.erb +13 -0
- data/app/views/test_events.erb +44 -0
- data/app/views/test_page.erb +164 -0
- data/lib/symbiont.rb +3 -0
- data/lib/symbiont/enclosers.rb +17 -0
- data/lib/symbiont/evaluators.rb +17 -0
- data/lib/symbiont/platform_watir/platform_object.rb +22 -2
- data/lib/symbiont/version.rb +1 -1
- data/lib/symbiont/web_objects/_common.rb +36 -1
- data/lib/symbiont/web_objects/table.rb +9 -0
- data/lib/symbiont/web_objects/table_row.rb +9 -0
- data/spec/symbiont/enclosers_spec.rb +5 -0
- data/spec/symbiont/evaluators_spec.rb +24 -0
- data/spec/symbiont/web_object_spec.rb +60 -2
- data/spec/symbiont/web_objects/table_row_spec.rb +9 -0
- data/spec/symbiont/web_objects/table_spec.rb +8 -0
- data/specs/button.feature +2 -0
- data/specs/definitions/pages.rb +17 -0
- data/specs/evaluators.feature +5 -0
- data/specs/events.feature +19 -0
- data/specs/link.feature +2 -0
- data/specs/support/test_steps/action_steps_buttons.rb +2 -0
- data/specs/support/test_steps/action_steps_evaluators.rb +3 -0
- data/specs/support/test_steps/action_steps_events.rb +40 -0
- data/specs/support/test_steps/action_steps_links.rb +2 -0
- data/specs/support/test_steps/action_steps_navigate.rb +4 -0
- data/specs/support/test_steps/action_steps_webobjects.rb +25 -0
- data/specs/web_object.feature +11 -0
- data/symbiont.gemspec +3 -3
- metadata +47 -13
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/HISTORY.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
1
|
Change Log and History
|
2
2
|
======================
|
3
3
|
|
4
|
+
Version 0.1.1 / 2012-05-30
|
5
|
+
--------------------------
|
6
|
+
|
7
|
+
This release provides a series of "wait state" methods in order to check for certain conditions, such as an object being visible. The library is now able to get the attribute and style information from web objects. A start has been made on the idea of browser-level actions and page-level actions. These are lumped together under a module called Evaluators. The sample test application being used for Symbiont acceptance tests is now included as part of the application.
|
8
|
+
|
9
|
+
|
4
10
|
Version 0.1.0 / 2012-05-16
|
5
11
|
--------------------------
|
6
12
|
|
data/README.md
CHANGED
data/app/Gemfile
ADDED
data/app/app.rb
ADDED
@@ -0,0 +1,167 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'rubygems' if RUBY_VERSION < '1.9'
|
3
|
+
|
4
|
+
require 'sinatra/base'
|
5
|
+
require 'sinatra/reloader'
|
6
|
+
require 'sinatra/flash'
|
7
|
+
|
8
|
+
require_relative 'config/database'
|
9
|
+
|
10
|
+
module Symbiont
|
11
|
+
class TestApp < Sinatra::Base
|
12
|
+
register Sinatra::Reloader
|
13
|
+
register Sinatra::Flash
|
14
|
+
|
15
|
+
set :sessions, true
|
16
|
+
set :app_file, __FILE__
|
17
|
+
set :public_folder, "public"
|
18
|
+
set :static, true
|
19
|
+
|
20
|
+
get '/' do
|
21
|
+
@title = "Landing Page"
|
22
|
+
erb :index
|
23
|
+
end
|
24
|
+
|
25
|
+
get '/test_page' do
|
26
|
+
@title = "Simple Object Page"
|
27
|
+
erb :test_page
|
28
|
+
end
|
29
|
+
|
30
|
+
get '/success_1' do
|
31
|
+
@title = "Success 1"
|
32
|
+
erb :success_1
|
33
|
+
end
|
34
|
+
|
35
|
+
get '/success_2' do
|
36
|
+
@title = "Success 2"
|
37
|
+
erb :success_2
|
38
|
+
end
|
39
|
+
|
40
|
+
get '/test_events' do
|
41
|
+
@title = "Simple Events Page"
|
42
|
+
erb :test_events
|
43
|
+
end
|
44
|
+
|
45
|
+
get '/test_database' do
|
46
|
+
@title = "Sample Database Application"
|
47
|
+
erb :test_database
|
48
|
+
end
|
49
|
+
|
50
|
+
get '/login_page' do
|
51
|
+
@title = "Login Page"
|
52
|
+
erb :login_page, layout: false
|
53
|
+
end
|
54
|
+
|
55
|
+
get '/entity_list' do
|
56
|
+
@title = "Entity List"
|
57
|
+
erb :entity_list
|
58
|
+
end
|
59
|
+
|
60
|
+
get '/db_products' do
|
61
|
+
@title = "Products"
|
62
|
+
@products = Product.all order: :id.desc
|
63
|
+
erb :db_products
|
64
|
+
end
|
65
|
+
|
66
|
+
get '/db_studies' do
|
67
|
+
@title = "Studies"
|
68
|
+
@studies = Study.all order: :id.desc
|
69
|
+
erb :db_studies
|
70
|
+
end
|
71
|
+
|
72
|
+
get '/db_plans' do
|
73
|
+
@title = "Plans"
|
74
|
+
@plans = Plan.all order: :id.desc
|
75
|
+
erb :db_plans
|
76
|
+
end
|
77
|
+
|
78
|
+
get '/db_users' do
|
79
|
+
@title = "Users"
|
80
|
+
@users = User.all order: :id.desc
|
81
|
+
erb :db_users
|
82
|
+
end
|
83
|
+
|
84
|
+
get '/create_product' do
|
85
|
+
@title = "Create Product"
|
86
|
+
erb :create_product
|
87
|
+
end
|
88
|
+
|
89
|
+
get '/create_study' do
|
90
|
+
@title = "Create Study"
|
91
|
+
erb :create_study
|
92
|
+
end
|
93
|
+
|
94
|
+
get '/create_plan' do
|
95
|
+
@title = "Create Plan"
|
96
|
+
erb :create_plan
|
97
|
+
end
|
98
|
+
|
99
|
+
get '/create_user' do
|
100
|
+
@title = "Create User"
|
101
|
+
erb :create_user
|
102
|
+
end
|
103
|
+
|
104
|
+
post '/create_product' do
|
105
|
+
product = Product.new
|
106
|
+
product.product_id = params[:productId]
|
107
|
+
product.name = params[:productName]
|
108
|
+
product.description = params[:productDescription]
|
109
|
+
product.created_at = Time.now
|
110
|
+
product.updated_at = Time.now
|
111
|
+
if product.save
|
112
|
+
flash[:notice] = "Product saved successfully."
|
113
|
+
else
|
114
|
+
flash[:error] = "Unable to save product."
|
115
|
+
end
|
116
|
+
redirect '/db_products'
|
117
|
+
end
|
118
|
+
|
119
|
+
post '/create_study' do
|
120
|
+
study = Study.new
|
121
|
+
study.study_name = params[:studyName]
|
122
|
+
study.protocol = params[:studyProtocol]
|
123
|
+
study.product = params[:studyProduct]
|
124
|
+
study.phase = params[:studyPhase]
|
125
|
+
if study.save
|
126
|
+
flash[:notice] = "Study saved successfully."
|
127
|
+
else
|
128
|
+
flash[:error] = "Unable to save study."
|
129
|
+
end
|
130
|
+
redirect '/db_studies'
|
131
|
+
end
|
132
|
+
|
133
|
+
post '/create_plan' do
|
134
|
+
plan = Plan.new
|
135
|
+
plan.plan_name = params[:planName]
|
136
|
+
plan.study = params[:planStudy]
|
137
|
+
plan.plan_description = params[:planDescription]
|
138
|
+
if plan.save
|
139
|
+
flash[:notice] = "Plan saved successfully."
|
140
|
+
else
|
141
|
+
flash[:error] = "Unable to save plan."
|
142
|
+
end
|
143
|
+
redirect '/db_plans'
|
144
|
+
end
|
145
|
+
|
146
|
+
post '/create_user' do
|
147
|
+
user = User.new
|
148
|
+
user.loginname = params[:loginName]
|
149
|
+
user.firstname = params[:firstName]
|
150
|
+
user.lastname = params[:lastName]
|
151
|
+
user.level = params[:level]
|
152
|
+
user.role = params[:role]
|
153
|
+
user.password = params[:password]
|
154
|
+
user.created_at = Time.now
|
155
|
+
user.updated_at = Time.now
|
156
|
+
if user.save
|
157
|
+
flash[:notice] = "User saved successfully."
|
158
|
+
else
|
159
|
+
flash[:error] = "Unable to save user."
|
160
|
+
end
|
161
|
+
redirect '/db_users'
|
162
|
+
end
|
163
|
+
|
164
|
+
end # class: TestApp
|
165
|
+
end # module: Symbiont
|
166
|
+
|
167
|
+
Symbiont::TestApp.run!
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'data_mapper'
|
2
|
+
|
3
|
+
require_relative '../models/product'
|
4
|
+
require_relative '../models/study'
|
5
|
+
require_relative '../models/plan'
|
6
|
+
require_relative '../models/user'
|
7
|
+
|
8
|
+
DataMapper::setup(:default, "sqlite3://#{Dir.pwd}/app.db")
|
9
|
+
DataMapper.finalize.auto_upgrade!
|
data/app/models/plan.rb
ADDED
data/app/models/study.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
class Study
|
2
|
+
include DataMapper::Resource
|
3
|
+
|
4
|
+
property :id, Serial
|
5
|
+
property :study_name, String
|
6
|
+
property :protocol, String
|
7
|
+
property :product, String
|
8
|
+
property :phase, String
|
9
|
+
property :created_at, DateTime, default: DateTime.now
|
10
|
+
property :updated_at, DateTime
|
11
|
+
end
|
data/app/models/user.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
class User
|
2
|
+
include DataMapper::Resource
|
3
|
+
|
4
|
+
property :id, Serial
|
5
|
+
property :loginname, String
|
6
|
+
property :firstname, String
|
7
|
+
property :lastname, String
|
8
|
+
property :level, String
|
9
|
+
property :role, String
|
10
|
+
property :password, String
|
11
|
+
property :created_at, DateTime, default: DateTime.now
|
12
|
+
property :updated_at, DateTime
|
13
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
header {
|
2
|
+
text-align: center;
|
3
|
+
background: #ccc;
|
4
|
+
border: 1px solid;
|
5
|
+
}
|
6
|
+
|
7
|
+
header h1 {
|
8
|
+
font: 42px normal Georgia, "Times New Roman", Times, serif;
|
9
|
+
}
|
10
|
+
|
11
|
+
header h1 a {
|
12
|
+
color: #0B610B;
|
13
|
+
text-decoration: none;
|
14
|
+
}
|
15
|
+
|
16
|
+
header h2 {
|
17
|
+
color: #38610B;
|
18
|
+
font-style: italic;
|
19
|
+
}
|
20
|
+
|
21
|
+
footer {
|
22
|
+
clear: both;
|
23
|
+
text-align: center;
|
24
|
+
}
|
25
|
+
|
26
|
+
.indent {
|
27
|
+
margin: 10px 0 40px 25px;
|
28
|
+
}
|
29
|
+
|
30
|
+
.group {
|
31
|
+
padding: 10px;
|
32
|
+
margin: 10px 0 40px 25px;
|
33
|
+
border: 1px solid;
|
34
|
+
background-color: #E6E6E6;
|
35
|
+
}
|
36
|
+
|
37
|
+
#navigate {
|
38
|
+
float: right;
|
39
|
+
margin-right: 50px;
|
40
|
+
}
|
41
|
+
|
42
|
+
input:focus {
|
43
|
+
border:5px solid yellow;
|
44
|
+
}
|
45
|
+
|
46
|
+
.notice {
|
47
|
+
color: green;
|
48
|
+
}
|
49
|
+
|
50
|
+
.error {
|
51
|
+
color: red;
|
52
|
+
}
|
53
|
+
|
54
|
+
table.entity {
|
55
|
+
margin: 20px;
|
56
|
+
color: #666;
|
57
|
+
font-size: 12px;
|
58
|
+
font-family: Arial, Helvetica, sans-serif;
|
59
|
+
background: #eaebec;
|
60
|
+
border: #ccc 1px solid;
|
61
|
+
border-radius: 3px;
|
62
|
+
box-shadow: 0 1px 2px #d1d1d1;
|
63
|
+
text-shadow: 1px 1px 0px #fff;
|
64
|
+
-moz-border-radius: 3px;
|
65
|
+
-moz-box-shadow: 0 1px 2px #d1d1d1;
|
66
|
+
-webkit-border-radius: 3px;
|
67
|
+
-webkit-box-shadow: 0 1px 2px #d1d1d1;
|
68
|
+
}
|
69
|
+
|
70
|
+
table.entity caption {
|
71
|
+
font-size: 16px;
|
72
|
+
}
|
73
|
+
|
74
|
+
table.entity th {
|
75
|
+
padding: 21px 25px 22px 25px;
|
76
|
+
border-bottom: 1px solid #e0e0e0;
|
77
|
+
border-top: 1px solid #fafafa;
|
78
|
+
background: #ededed;
|
79
|
+
background: -webkit-gradient(linear, left top, left bottom, from(#ededed), to(#ebebeb));
|
80
|
+
background: -moz-linear-gradient(top, #ededed, #ebebeb);
|
81
|
+
}
|
82
|
+
|
83
|
+
table.entity th:first-child {
|
84
|
+
padding-left: 20px;
|
85
|
+
text-align: left;
|
86
|
+
}
|
87
|
+
|
88
|
+
table.entity tr {
|
89
|
+
padding-left: 20px;
|
90
|
+
text-align: center;
|
91
|
+
}
|
92
|
+
|
93
|
+
table.entity tr:first-child th:first-child {
|
94
|
+
-moz-border-radius-topleft: 3px;
|
95
|
+
-webkit-border-top-left-radius: 3px;
|
96
|
+
border-top-left-radius: 3px;
|
97
|
+
}
|
98
|
+
|
99
|
+
table.entity tr:first-child th:last-child {
|
100
|
+
-moz-border-radius-topright: 3px;
|
101
|
+
-webkit-border-top-right-radius: 3px;
|
102
|
+
border-top-right-radius: 3px;
|
103
|
+
}
|
104
|
+
|
105
|
+
table.entity tr:last-child td { border-bottom: 0 }
|
106
|
+
|
107
|
+
table.entity tr:last-child td:first-child {
|
108
|
+
-moz-border-radius-bottomleft: 3px;
|
109
|
+
-webkit-border-bottom-left-radius: 3px;
|
110
|
+
border-bottom-left-radius: 3px;
|
111
|
+
}
|
112
|
+
|
113
|
+
table.entity tr:last-child td:last-child {
|
114
|
+
-moz-border-radius-bottomright: 3px;
|
115
|
+
-webkit-border-bottom-right-radius: 3px;
|
116
|
+
border-bottom-right-radius: 3px;
|
117
|
+
}
|
118
|
+
|
119
|
+
table.entity tr:hover td {
|
120
|
+
background: #f2f2f2;
|
121
|
+
background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0));
|
122
|
+
background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0);
|
123
|
+
}
|
124
|
+
|
125
|
+
table.entity tr td {
|
126
|
+
padding: 18px;
|
127
|
+
border-bottom: 1px solid #e0e0e0; border-left: 1px solid #e0e0e0; border-top: 1px solid #ffffff;
|
128
|
+
background: #fafafa;
|
129
|
+
background: -webkit-gradient(linear, left top, left bottom, from(#fbfbfb), to(#fafafa));
|
130
|
+
background: -moz-linear-gradient(top, #fbfbfb, #fafafa);
|
131
|
+
}
|
132
|
+
|
133
|
+
table.entity tr td:first-child {
|
134
|
+
padding-left: 20px;
|
135
|
+
border-left: 0;
|
136
|
+
text-align: left;
|
137
|
+
}
|
138
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<section id="create_plan">
|
2
|
+
<p><span id="navigate"><a href="entity_list">Back to List</a> | <a href="test_database">Logout</a></span></p>
|
3
|
+
<form id="planFormID" class="planFormClass" name="planFormName" method="post" action="/create_plan">
|
4
|
+
<p><label id="lbl_planName" class="Fld" for="planName">Plan Name:</label><br />
|
5
|
+
<input id="planName" name="planName" class="Fld" size="40" type="text"/></p>
|
6
|
+
|
7
|
+
<p><label id="lbl_planStudy" class="Fld" for="planStudy">Study:</label><br />
|
8
|
+
<select id="planStudy" name="planStudy">
|
9
|
+
<option value="blank"></option>
|
10
|
+
<% @studies = Study.all %>
|
11
|
+
<% @studies.each do |study| %>
|
12
|
+
<option value="<%= study.study_name %>"><%= study.study_name %></option>
|
13
|
+
<% end %>
|
14
|
+
</select>
|
15
|
+
|
16
|
+
<p><label id="lbl_planDescription" class="Fld" for="planDescription">Description:</label><br />
|
17
|
+
<input id="planDescription" name="planDescription" class="Fld" size="40" type="text"/></p>
|
18
|
+
|
19
|
+
<p><input id="btnSubmit" name="btnSubmit" class="btn" type="submit" value="Create Plan"></p>
|
20
|
+
</form>
|
21
|
+
</section>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<section id="create_product">
|
2
|
+
<span id="navigate"><a href="entity_list">Back to List</a> | <a href="test_database">Logout</a></span></p>
|
3
|
+
<form id="productFormID" class="productFormClass" name="productFormName" method="post" action="/create_product">
|
4
|
+
<p><label id="lbl_productId" class="Fld" for="productId">Product ID:</label><br />
|
5
|
+
<input id="productId" name="productId" class="Fld" size="40" type="text"/></p>
|
6
|
+
|
7
|
+
<p><label id="lbl_productName" class="Fld" for="productName">Name:</label><br />
|
8
|
+
<input id="productName" name="productName" class="Fld" size="40" type="text"/></p>
|
9
|
+
|
10
|
+
<p><label id="lbl_productDescription" class="Fld" for="productDescription">Description:</label><br />
|
11
|
+
<input id="productDescription" name="productDescription" class="Fld" size="40" type="text"/></p>
|
12
|
+
|
13
|
+
<p><input id="btnSubmit" name="btnSubmit" class="btn" type="submit" value="Create Product"></p>
|
14
|
+
</form>
|
15
|
+
</section>
|