Skip to content

Commit 668a34d

Browse files
committed
Trying out poltergeist for JS tests.
* Fix additional tests (38 failing now, from 39)
1 parent 4ff0d7f commit 668a34d

File tree

7 files changed

+44
-18
lines changed

7 files changed

+44
-18
lines changed

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ group :test, :development do
3131
end
3232

3333
group :test do
34+
gem 'poltergeist'
3435
gem 'm', '~> 1.2'
3536

3637
gem 'factory_girl_rails', '3.3.0'
3738
gem "mocha", :require=>false
3839
gem "sqlite3-ruby", :require => "sqlite3"
3940

4041
# Cucumber and dependencies
41-
gem 'capybara', '~>1.1'
42+
gem 'capybara'
4243
gem 'database_cleaner'
4344
gem 'cucumber-rails', require: false
4445
gem 'cucumber'

Gemfile.lock

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ GEM
6161
rack-test (>= 0.5.4)
6262
selenium-webdriver (~> 2.0)
6363
xpath (~> 0.1.4)
64-
childprocess (0.3.6)
65-
ffi (~> 1.0, >= 1.0.6)
64+
childprocess (0.3.9)
65+
ffi (~> 1.0, >= 1.0.11)
6666
ckeditor_rails (4.0.1.1)
6767
railties (>= 3.0)
6868
climate_control (0.0.3)
@@ -90,10 +90,13 @@ GEM
9090
factory_girl_rails (3.3.0)
9191
factory_girl (~> 3.3.0)
9292
railties (>= 3.0.0)
93-
ffi (1.2.0)
93+
faye-websocket (0.4.7)
94+
eventmachine (>= 0.12.0)
95+
ffi (1.8.1)
9496
gherkin (2.11.5)
9597
json (>= 1.4.6)
9698
hike (1.2.1)
99+
http_parser.rb (0.5.3)
97100
i18n (0.6.1)
98101
journey (1.0.4)
99102
jquery-rails (2.3.0)
@@ -102,8 +105,6 @@ GEM
102105
json (1.7.7)
103106
launchy (2.1.2)
104107
addressable (~> 2.3)
105-
libwebsocket (0.1.6.1)
106-
websocket
107108
m (1.2.1)
108109
method_source (>= 0.6.7)
109110
rake (>= 0.9.2.2, < 1.0.0)
@@ -113,22 +114,28 @@ GEM
113114
treetop (~> 1.4.8)
114115
metaclass (0.0.1)
115116
method_source (0.8.1)
116-
mime-types (1.21)
117+
mime-types (1.23)
117118
minitest (4.3.2)
118119
minitest-rails (0.3)
119120
minitest (~> 4.0)
120121
rails (~> 3.0)
121122
mocha (0.13.0)
122123
metaclass (~> 0.0.1)
123-
multi_json (1.6.1)
124+
multi_json (1.7.6)
124125
mysql2 (0.3.11)
125-
nokogiri (1.5.5)
126+
nokogiri (1.5.9)
126127
paperclip (3.0.4)
127128
activemodel (>= 3.0.0)
128129
activerecord (>= 3.0.0)
129130
activesupport (>= 3.0.0)
130131
cocaine (>= 0.0.2)
131132
mime-types
133+
poltergeist (1.0.3)
134+
capybara (~> 1.1)
135+
childprocess (~> 0.3)
136+
faye-websocket (~> 0.4.4)
137+
http_parser.rb (~> 0.5.3)
138+
multi_json (~> 1.0)
132139
polyglot (0.3.3)
133140
rack (1.4.5)
134141
rack-cache (1.2)
@@ -164,11 +171,11 @@ GEM
164171
railties (~> 3.2.0)
165172
sass (>= 3.1.10)
166173
tilt (~> 1.3)
167-
selenium-webdriver (2.26.0)
174+
selenium-webdriver (2.33.0)
168175
childprocess (>= 0.2.5)
169-
libwebsocket (~> 0.1.3)
170176
multi_json (~> 1.0)
171177
rubyzip
178+
websocket (~> 1.0.4)
172179
sprockets (2.2.2)
173180
hike (~> 1.2)
174181
multi_json (~> 1.0)
@@ -194,7 +201,7 @@ GEM
194201
execjs (>= 0.3.0)
195202
multi_json (~> 1.0, >= 1.0.2)
196203
underscore-rails (1.4.4)
197-
websocket (1.0.4)
204+
websocket (1.0.7)
198205
xpath (0.1.4)
199206
nokogiri (~> 1.3)
200207
yard (0.8.3)
@@ -207,7 +214,7 @@ DEPENDENCIES
207214
bluecloth
208215
bootstrap-sass
209216
browsercms!
210-
capybara (~> 1.1)
217+
capybara
211218
cucumber
212219
cucumber-rails
213220
database_cleaner
@@ -218,6 +225,7 @@ DEPENDENCIES
218225
minitest-rails
219226
mocha
220227
mysql2
228+
poltergeist
221229
rake (~> 0.9.5)
222230
ruby-prof
223231
sass-rails

app/views/layouts/cms/page_editor.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
</head>
1616
<body>
1717
<%= render 'layouts/cms/thin_toolbar' %>
18-
<iframe src="<%= edit_content_path(current_page) %>" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"></iframe>
18+
<iframe name="page_content" src="<%= edit_content_path(current_page) %>" frameborder="0" marginheight="0" marginwidth="0" width="100%" height="100%" scrolling="auto"></iframe>
1919
</body>
2020
</html>

features/content_blocks/manage_custom_blocks.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Feature: Manage Content Blocks
23
In BrowserCMS projects developers should be able to generate and manage content blocks via the UI.
34
This blocks will be generated as Rails resources, with a controller and views.
@@ -26,10 +27,9 @@ Feature: Manage Content Blocks
2627
When I request /cms/products/new
2728
Then I should see "Add New Product"
2829
When I fill in "Name" with "iPhone"
29-
And I fill in "Price" with "400"
30+
And I fill in "product_slug" with "/iphone"
3031
And I click on "Save"
31-
Then I should see "iPhone"
32-
Then I should see "400"
32+
Then a new product should be created
3333

3434
Scenario: Delete a block
3535
Given the following products exist:

features/step_definitions/content_pages_steps.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,4 +208,12 @@
208208

209209
Then /^I should end up on that page$/ do
210210
should_see_a_page_titled(most_recently_created_page.title)
211+
end
212+
213+
Then /^the page frame should contain the following:$/ do |table|
214+
within_frame 'page_content' do
215+
table.rows.each do |row|
216+
assert page.has_content? row[0]
217+
end
218+
end
211219
end

features/step_definitions/more_custom_block_steps.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@
4848

4949
Then /^I should be able to click on a link to see a product$/ do
5050
assert page.has_content?("A Widget")
51+
end
52+
Then /^a new product should be created$/ do
53+
assert_equal 1, Product.count
5154
end

features/support/env.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111

1212
require 'aruba/cucumber'
1313

14+
require 'capybara/poltergeist'
15+
16+
require 'capybara/dsl'
17+
#Capybara.javascript_driver = :poltergeist
18+
#Capybara.default_driver = :poltergeist
19+
1420
Before do
1521
# Configure where Aruba generates files.
1622
# You can't generate rails projects within rails projects', so it needs to be parallel to the browsercms project
@@ -19,7 +25,7 @@
1925
@dirs = [@aruba_dir]
2026

2127
# Generating projects takes a while, so give Aruba more time before it cuts things off.
22-
@aruba_timeout_seconds = 30
28+
@aruba_timeout_seconds = 15
2329

2430
# Must explicitly clean up the working directory before each project (might be solved in later version of Aruba)
2531
FileUtils.rm_rf(@aruba_dir)

0 commit comments

Comments
 (0)