protractor-rails 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +10 -1
- data/lib/protractor/rails/version.rb +1 -1
- data/lib/tasks/protractor.rake +20 -13
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22ecf4dc88d777f93fe5c056a3570c670c68230e
|
4
|
+
data.tar.gz: 71c8e69dace16a49c5f858be16b3b4ad06125fbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c278b0d392819f5556f54f3ca34bf43200194759202627622a10788056f19d8dd4fbadae476aa1599269091ed5a35f68f356f56cd2aebeaf63807b50890583f5
|
7
|
+
data.tar.gz: 651e8141646f1a5a06c13d44503454d973f65ce9ae2bb6564c6b974b0b4ad0f7d7680fa8317864a278eb0c26cebfa0346230347b0932af9221f1877b5710d3ab
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -113,12 +113,21 @@ There is also a convenience function for running cleanup after you have run your
|
|
113
113
|
|
114
114
|
$ rake protractor:spec_and_cleanup
|
115
115
|
|
116
|
+
### Task Options
|
117
|
+
|
118
|
+
#### rake protractor:spec
|
119
|
+
|
120
|
+
You can control verbosity of logging with the following ENV flags:
|
121
|
+
|
122
|
+
* `rake protractor:spec nolog=y # all quiet`
|
123
|
+
* `rake protractor:spec nolog_selenium=y # no selenium (just drivers)`
|
124
|
+
* `rake protractor:spec nolog_rails=y # no rails`
|
125
|
+
|
116
126
|
## Notes about integration tests
|
117
127
|
|
118
128
|
Integration tests are **MUCH** faster than testing things yourself but they are MUCH slower than running unit tests or
|
119
129
|
rspec tests. Keep your integration tests to a minimum and test as much as possible with your normal rails test suite.
|
120
130
|
|
121
|
-
|
122
131
|
## Contributing
|
123
132
|
|
124
133
|
**Contributions, questions, comments, threats or suggestions are welcome.**
|
data/lib/tasks/protractor.rake
CHANGED
@@ -7,7 +7,7 @@ namespace :protractor do |args|
|
|
7
7
|
webdriver_pid = fork do
|
8
8
|
Rake::Task["protractor:webdriver"].invoke
|
9
9
|
end
|
10
|
-
|
10
|
+
write_log "Waiting for test server and webdriver server to start"
|
11
11
|
sleep 5
|
12
12
|
file = File.expand_path('../../../spec/protractor_example.conf.js', __FILE__)
|
13
13
|
system "protractor #{file}"
|
@@ -17,6 +17,11 @@ namespace :protractor do |args|
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
def write_log(message)
|
21
|
+
return if ENV['nolog'].present?
|
22
|
+
puts message
|
23
|
+
end
|
24
|
+
|
20
25
|
desc "Run specs from config file"
|
21
26
|
task :spec do
|
22
27
|
begin
|
@@ -35,21 +40,23 @@ namespace :protractor do |args|
|
|
35
40
|
end.parse!
|
36
41
|
|
37
42
|
webdriver_pid = fork do
|
43
|
+
[$stdout,$stderr].each { |fh| fh.reopen File.open("/dev/null","w") } if ENV['nolog'].present? || ENV['nolog_selenium'].present?
|
38
44
|
Rake::Task['protractor:webdriver'].invoke
|
39
45
|
end
|
40
46
|
rails_server_pid = fork do
|
47
|
+
[$stdout,$stderr].each { |fh| fh.reopen File.open("/dev/null","w") } if ENV['nolog'].present? || ENV['nolog_rails'].present?
|
41
48
|
Rake::Task['protractor:rails'].invoke
|
42
49
|
end
|
43
|
-
|
44
|
-
|
45
|
-
|
50
|
+
write_log "webdriver PID: #{webdriver_pid}"
|
51
|
+
write_log "Rails Server PID: #{rails_server_pid}".yellow.bold
|
52
|
+
write_log "Waiting for servers to finish starting up...."
|
46
53
|
sleep Protractor.configuration.startup_timeout
|
47
54
|
success = system "protractor #{options} #{Protractor.configuration.config_path}/#{Protractor.configuration.config_file}"
|
48
55
|
Process.kill 'TERM', webdriver_pid
|
49
56
|
Process.kill 'TERM', rails_server_pid
|
50
57
|
Process.wait webdriver_pid
|
51
58
|
Process.wait rails_server_pid
|
52
|
-
|
59
|
+
write_log "Waiting to shut down cleanly.........".yellow.bold
|
53
60
|
sleep 5
|
54
61
|
rescue Exception => e
|
55
62
|
puts e
|
@@ -62,29 +69,29 @@ namespace :protractor do |args|
|
|
62
69
|
task :spec_and_cleanup => [:spec, :cleanup]
|
63
70
|
|
64
71
|
task :kill do
|
65
|
-
|
72
|
+
write_log "killing running protractor processes".green.bold
|
66
73
|
Rake::Task["protractor:kill_rails"].invoke
|
67
74
|
Rake::Task["protractor:kill_webdriver"].invoke
|
68
75
|
Rake::Task["protractor:kill_selenium_processes"].invoke
|
69
76
|
end
|
70
77
|
|
71
78
|
task :kill_selenium_processes do
|
72
|
-
|
79
|
+
write_log "kill left over selenium processes...".yellow
|
73
80
|
system "ps aux | grep -ie 'protractor\/selenium' | awk '{print $2}' | xargs kill -9"
|
74
81
|
end
|
75
82
|
|
76
83
|
task :kill_webdriver do
|
77
|
-
|
84
|
+
write_log "kill webdriver server...".yellow
|
78
85
|
system "ps aux | grep -ie '\-Dwebdriver' | awk '{print $2}' | xargs kill -9"
|
79
86
|
end
|
80
87
|
|
81
88
|
task :kill_rails do
|
82
|
-
|
89
|
+
write_log "kill protractor rails tests server...".yellow
|
83
90
|
system "ps aux | grep -ie 'rails s -e test -P tmp/pids/protractor_test_server.pid --port=#{Protractor.configuration.port}' | awk '{print $2}' | xargs kill -9"
|
84
91
|
end
|
85
92
|
|
86
93
|
task :rails do
|
87
|
-
|
94
|
+
write_log "Starting Rails server on port #{Protractor.configuration.port} pid file in tmp/pids/protractor_test_server.pid".green
|
88
95
|
rails_command = "rails s -e test -P tmp/pids/protractor_test_server.pid --port=#{Protractor.configuration.port}"
|
89
96
|
if ENV['rails_binding'] != nil
|
90
97
|
rails_command << " --binding #{ ENV['rails_binding'] }"
|
@@ -93,14 +100,14 @@ namespace :protractor do |args|
|
|
93
100
|
end
|
94
101
|
|
95
102
|
task :webdriver do
|
96
|
-
|
103
|
+
write_log "Starting selenium server".green
|
97
104
|
system "webdriver-manager start"
|
98
105
|
end
|
99
106
|
|
100
107
|
task :cleanup do
|
101
|
-
|
108
|
+
write_log "rake db:test:prepare to cleanup for the next test session".green
|
102
109
|
system 'rake db:test:prepare --trace'
|
103
|
-
|
110
|
+
write_log "Seeding the test database....".green
|
104
111
|
system "rake db:test:seed --trace"
|
105
112
|
end
|
106
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protractor-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyrone Wilson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|