protractor-rails 0.0.2 → 0.0.3.pre.alpha
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 +71 -3
- data/lib/protractor/rails/version.rb +1 -1
- data/lib/tasks/protractor.rake +12 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6f03720412a3f8fc6787ca747cb3fe28b025217
|
4
|
+
data.tar.gz: 1c26cf1698d96e2e4fdd3bce8d8ebd739b63ae04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71f1d12ed657772737cc6f7a02e148bed79f0a8a4227b95031754d5ca504bc84220fbf49ab72d1c29abe2bdba32c56ae2e4548a444739116226fd6ee8fc9fc34
|
7
|
+
data.tar.gz: 3d432682563e6de3d6db220e6522e2875e8cf4a690d15b9d8e59d53f4758c87e681d743d4e2abd6dc4ab9022ab150727d7ab8ecf41090638821a5919b02bc472
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Protractor::Rails
|
2
2
|
|
3
|
-
This gem helps you
|
4
|
-
|
5
|
-
NB: This gem is in pre-release so don't use it yet.
|
3
|
+
This gem helps you seemlessly setup, run and maintain a angularjs e2e test suite using protractor in a rails application.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -25,6 +23,76 @@ NB: This uses `sudo` so you will need to enter your password
|
|
25
23
|
|
26
24
|
## Usage
|
27
25
|
|
26
|
+
### Initialization
|
27
|
+
|
28
|
+
You can initialize your app with protractor rails by running
|
29
|
+
|
30
|
+
$ rake protractor:init
|
31
|
+
|
32
|
+
### Dummy test in local environment
|
33
|
+
|
34
|
+
This will generate and template configuration and a dummy example test. Once you have run this you can test that
|
35
|
+
everything has been set up correctly in your local environment by running the following command:
|
36
|
+
|
37
|
+
$ rake protractor:spec
|
38
|
+
|
39
|
+
This will run a local rails test server, the webdriver selenium server and run protractor against the example_spec.js
|
40
|
+
If everything starts up and runs cleanly you should see the test summary of 1 test 1 pass and 0 failures.
|
41
|
+
|
42
|
+
### Running your tests
|
43
|
+
|
44
|
+
When the `rake protractor:init` script is run it will create a file `spec/javascripts/protractor.conf.js`. This file is where you
|
45
|
+
can configure the tests that should be run. [See Protractor Documentation for more details]:https://github.com/angular/protractor/blob/master/docs/getting-started.md.
|
46
|
+
|
47
|
+
In this file you can provide patterns for matching your protractor specs. **NB: It is recommended that you use a subdirectory such as spec/javascripts/protractor_specs for easy matching and organization**
|
48
|
+
|
49
|
+
**Example**
|
50
|
+
|
51
|
+
If I have a directory set up for protractor specs in `spec/javascripts/protractor_specs/`, my configuration file would look something like the below
|
52
|
+
|
53
|
+
```
|
54
|
+
// An example configuration file.
|
55
|
+
exports.config = {
|
56
|
+
// The address of a running selenium server.
|
57
|
+
seleniumAddress: 'http://localhost:4444/wd/hub',
|
58
|
+
|
59
|
+
// Capabilities to be passed to the webdriver instance.
|
60
|
+
capabilities: {
|
61
|
+
'browserName': 'chrome'
|
62
|
+
},
|
63
|
+
|
64
|
+
// Spec patterns are relative to the current working directly when protractor is called
|
65
|
+
specs: ['protractor_specs/**/*.js '],
|
66
|
+
|
67
|
+
baseUrl: 'http://localhost:4000',
|
68
|
+
|
69
|
+
// Options to be passed to Jasmine-node.
|
70
|
+
jasmineNodeOpts: {
|
71
|
+
showColors: true,
|
72
|
+
defaultTimeoutInterval: 30000
|
73
|
+
},
|
74
|
+
};
|
75
|
+
|
76
|
+
```
|
77
|
+
|
78
|
+
Once you have setup your tests as above, running `rake protractor:spec will pic up new tests and run them for you`
|
79
|
+
|
80
|
+
### Setup and teardown
|
81
|
+
|
82
|
+
There is a task to reset your database to remove items you have created during your tests. This will also seed your database with any fixtures you might have prepared
|
83
|
+
|
84
|
+
$ rake protractor:cleanup
|
85
|
+
|
86
|
+
This will reset your test database and load in seeds in db/seeds.rb into your test database only.
|
87
|
+
|
88
|
+
There is also a convenience function for running cleanup after you have run your tests ready for the next test run.
|
89
|
+
|
90
|
+
$ rake protractor:spec_and_cleanup
|
91
|
+
|
92
|
+
## Notes about integration tests
|
93
|
+
|
94
|
+
Integration tests are **MUCH** faster than testing things yourself but they are MUCH slower than running unit tests or
|
95
|
+
rspec tests. Keep your integration tests to a minimum and test as much as possible with your normal rails test suite.
|
28
96
|
|
29
97
|
|
30
98
|
## Contributing
|
data/lib/tasks/protractor.rake
CHANGED
@@ -77,7 +77,18 @@ namespace :protractor do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
task :cleanup do
|
80
|
-
puts "rake db:test:prepare to cleanup for the next test session".green
|
80
|
+
puts "rake db:test:prepare to cleanup for the next test session".green
|
81
81
|
system 'rake db:test:prepare --trace'
|
82
|
+
puts "Seeding the test database....".green
|
83
|
+
system "rake db:test:seed --trace"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
namespace :db do
|
88
|
+
namespace :test do
|
89
|
+
desc "seed only the test database (Task provided by protractor-rails)"
|
90
|
+
task :seed do
|
91
|
+
system "rake db:seed RAILS_ENV=test"
|
92
|
+
end
|
82
93
|
end
|
83
94
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.3.pre.alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyrone Wilson
|
@@ -106,9 +106,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
106
|
version: '0'
|
107
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - "
|
109
|
+
- - ">"
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
111
|
+
version: 1.3.1
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
114
|
rubygems_version: 2.2.2
|