cypress-on-rails 1.5.1 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/CHANGELOG.md +10 -1
- data/README.md +22 -21
- data/lib/cypress_on_rails/version.rb +1 -1
- data/lib/generators/cypress_on_rails/templates/spec/cypress.json +1 -1
- data/lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/clean.rb +1 -1
- data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cypress_api.spec.js +1 -1
- data/spec/integrations/cypress.json +1 -1
- data/spec/integrations/rails_3_2/test.sh +1 -1
- data/spec/integrations/rails_4_2/Gemfile +2 -1
- data/spec/integrations/rails_4_2/test.sh +1 -1
- data/spec/integrations/rails_5_2/Gemfile +1 -0
- data/spec/integrations/rails_5_2/test.sh +1 -1
- 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: c704c33fe50fb989eaf131934d0210c112005e96
|
4
|
+
data.tar.gz: b53f4ce2fea91a67744f0432a736dd1021fb3c7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f5bff901ec22f23d785eb19597b07fce18ecd87bea209464ce4bc9de4f6ce2238bd5f760f02d98443aa540e32147be1b06cc2dbc33e105d31364c8cfb4c7d91
|
7
|
+
data.tar.gz: 01c2e5fb7d24cac595e56e1ed24e4b0ed0643715dd4f51b11056806f456867bd2d72dd1cf15c5e583f1d3543ca131eda5783faa15fb9f6be0060134fdb15ae65
|
data/.travis.yml
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
3
|
- 2.3
|
4
|
+
- 2.4
|
4
5
|
- 2.5
|
5
6
|
- 2.6
|
7
|
+
# - 2.7
|
6
8
|
|
7
9
|
#addons:
|
8
10
|
# artifacts:
|
@@ -27,6 +29,8 @@ before_install:
|
|
27
29
|
|
28
30
|
script:
|
29
31
|
- bundle exec rake
|
32
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
33
|
+
- gem install bundler -v '< 2'
|
30
34
|
- ./spec/integrations/rails_5_2/test.sh
|
31
35
|
- ./spec/integrations/rails_4_2/test.sh
|
32
36
|
- ./spec/integrations/rails_3_2/test.sh
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [1.6.0]
|
2
|
+
[Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.5.1...v1.6.0
|
3
|
+
|
4
|
+
### Changed
|
5
|
+
* Change default port to 5017 [PR 49](https://github.com/shakacode/cypress-on-rails/pull/49) by [vfonic](https://github/vfonic)
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
* fix file location warning message in clean.rb [PR 54](https://github.com/shakacode/cypress-on-rails/pull/54) by [ootoovak](https://github.com/ootoovak)
|
9
|
+
|
1
10
|
## [1.5.1]
|
2
11
|
[Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.5.0...v1.5.1
|
3
12
|
|
@@ -32,7 +41,7 @@
|
|
32
41
|
* Update Travis CI badge in README [PR 31](https://github.com/shakacode/cypress-on-rails/pull/31)
|
33
42
|
* Fix CI by Installing cypress dependencies on Travis CI [PR 31](https://github.com/shakacode/cypress-on-rails/pull/31)
|
34
43
|
|
35
|
-
## [1.4.0]
|
44
|
+
## [1.4.0]
|
36
45
|
[Compare]: https://github.com/shakacode/cypress-on-rails/compare/v1.3.0...v1.4.0
|
37
46
|
|
38
47
|
* Accept an options argument for scenarios. [PR 18](https://github.com/shakacode/cypress-on-rails/pull/18) by [ericraio](https://github.com/ericraio).
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ This project is sponsored by the software consulting firm [ShakaCode](https://ww
|
|
8
8
|
|
9
9
|
----
|
10
10
|
|
11
|
-
Gem for using [cypress.io](http://github.com/cypress-io/) in Rails and ruby rack applications
|
11
|
+
Gem for using [cypress.io](http://github.com/cypress-io/) in Rails and ruby rack applications
|
12
12
|
with the goal of controlling State as mentioned in [Cypress Best Practices](https://docs.cypress.io/guides/references/best-practices.html#Organizing-Tests-Logging-In-Controlling-State)
|
13
13
|
|
14
14
|
It allows to run code in the application context when executing cypress tests.
|
@@ -24,21 +24,21 @@ Has examples of setting up state with:
|
|
24
24
|
* scenarios
|
25
25
|
* custom commands
|
26
26
|
|
27
|
-
This gem is based off https://github.com/konvenit/cypress-on-rails
|
28
|
-
|
29
27
|
Video of getting started with this gem https://grant-ps.blog/2018/08/10/getting-started-with-cypress-io-and-ruby-on-rails/
|
30
28
|
|
31
29
|
## Getting started
|
32
30
|
|
33
31
|
Add this to your Gemfile:
|
34
|
-
|
32
|
+
|
33
|
+
```ruby
|
35
34
|
group :test, :development do
|
36
35
|
gem 'cypress-on-rails', '~> 1.0'
|
37
36
|
end
|
38
37
|
```
|
39
38
|
|
40
39
|
Generate the boilerplate code using:
|
41
|
-
|
40
|
+
|
41
|
+
```shell
|
42
42
|
bin/rails g cypress_on_rails:install
|
43
43
|
|
44
44
|
# if you have/want a different cypress folder (default is spec/cypress)
|
@@ -51,17 +51,18 @@ bin/rails g cypress_on_rails:install --install_cypress_with=npm
|
|
51
51
|
bin/rails g cypress_on_rails:update
|
52
52
|
```
|
53
53
|
|
54
|
-
The generator adds the following files/directory
|
54
|
+
The generator modifies/adds the following files/directory in your application:
|
55
|
+
* `config/environments/test.rb`
|
55
56
|
* `config/initializers/cypress_on_rails` used to configure CypressDev
|
56
57
|
* `spec/cypress/integrations/` contains your cypress tests
|
57
58
|
* `spec/cypress/support/on-rails.js` contains CypressDev support code
|
58
59
|
* `spec/cypress/app_commands/scenarios/` contains your CypressDev scenario definitions
|
59
60
|
* `spec/cypress/cypress_helper.rb` contains helper code for CypressDev app commands
|
60
61
|
|
61
|
-
if you are not using database_cleaner look at `spec/cypress/app_commands/
|
62
|
+
if you are not using database_cleaner look at `spec/cypress/app_commands/clean.rb`.
|
62
63
|
if you are not using factory_bot look at `spec/cypress/app_commands/factory_bot.rb`.
|
63
64
|
|
64
|
-
Now you can create scenarios and commands that are
|
65
|
+
Now you can create scenarios and commands that are plain ruby files that get loaded through middleware, the ruby sky is your limit.
|
65
66
|
|
66
67
|
### WARNING
|
67
68
|
*WARNING!!:* cypress-on-rails can execute arbitrary ruby code
|
@@ -71,10 +72,10 @@ Please use with extra caution if starting your local server on 0.0.0.0 or runnin
|
|
71
72
|
|
72
73
|
Start the rails server in test mode and start cypress
|
73
74
|
|
74
|
-
```
|
75
|
+
```shell
|
75
76
|
# start rails
|
76
77
|
RAILS_ENV=test bin/rake db:create db:schema:load
|
77
|
-
bin/rails server -e test -p
|
78
|
+
bin/rails server -e test -p 5017
|
78
79
|
|
79
80
|
# in separate window start cypress
|
80
81
|
yarn cypress open --project ./spec
|
@@ -88,10 +89,10 @@ You can run your [factory_bot](https://github.com/thoughtbot/factory_bot) direct
|
|
88
89
|
require 'cypress_on_rails/smart_factory_wrapper'
|
89
90
|
|
90
91
|
CypressOnRails::SmartFactoryWrapper.configure(
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
)
|
92
|
+
always_reload: !Rails.configuration.cache_classes,
|
93
|
+
factory: FactoryBot,
|
94
|
+
files: Dir['./spec/factories/**/*.rb']
|
95
|
+
)
|
95
96
|
```
|
96
97
|
|
97
98
|
```js
|
@@ -108,9 +109,9 @@ describe('My First Test', function() {
|
|
108
109
|
cy.visit('/')
|
109
110
|
|
110
111
|
cy.contains("Hello World")
|
111
|
-
|
112
|
+
|
112
113
|
// Accessing result
|
113
|
-
cy.appFactories([['create', 'invoice', { paid: false }]]).then((records) => {
|
114
|
+
cy.appFactories([['create', 'invoice', { paid: false }]]).then((records) => {
|
114
115
|
cy.visit(`/invoices/${records[0].id}`);
|
115
116
|
});
|
116
117
|
})
|
@@ -155,7 +156,7 @@ You define a scenario in the `spec/cypress/app_commands/scenarios` directory:
|
|
155
156
|
Profile.create name: "Cypress Hill"
|
156
157
|
|
157
158
|
# or if you have factory_bot enabled in your cypress_helper
|
158
|
-
CypressOnRails::SmartFactoryWrapper.create(:profile, name: "Cypress Hill")
|
159
|
+
CypressOnRails::SmartFactoryWrapper.create(:profile, name: "Cypress Hill")
|
159
160
|
```
|
160
161
|
|
161
162
|
Then reference the scenario in your test:
|
@@ -177,8 +178,8 @@ describe('My First Test', function() {
|
|
177
178
|
|
178
179
|
create a ruby file in `spec/cypress/app_commands` directory:
|
179
180
|
```ruby
|
180
|
-
# spec/cypress/app_commands/load_seed.rb
|
181
|
-
load "#{Rails.root}/db/seeds.rb"
|
181
|
+
# spec/cypress/app_commands/load_seed.rb
|
182
|
+
load "#{Rails.root}/db/seeds.rb"
|
182
183
|
```
|
183
184
|
|
184
185
|
Then reference the command in your test with `cy.app('load_seed')`:
|
@@ -186,7 +187,7 @@ Then reference the command in your test with `cy.app('load_seed')`:
|
|
186
187
|
// spec/cypress/integrations/simple_spec.js
|
187
188
|
describe('My First Test', function() {
|
188
189
|
beforeEach(() => { cy.app('load_seed') })
|
189
|
-
|
190
|
+
|
190
191
|
it('visit root', function() {
|
191
192
|
cy.visit('/')
|
192
193
|
|
@@ -209,7 +210,7 @@ CypressOnRails.configure do |c|
|
|
209
210
|
end
|
210
211
|
use CypressOnRails::Middleware
|
211
212
|
|
212
|
-
run MyApp
|
213
|
+
run MyApp
|
213
214
|
```
|
214
215
|
|
215
216
|
add the following file to cypress
|
@@ -3,7 +3,7 @@ if defined?(DatabaseCleaner)
|
|
3
3
|
DatabaseCleaner.strategy = :truncation
|
4
4
|
DatabaseCleaner.clean
|
5
5
|
else
|
6
|
-
logger.warn "add database_cleaner or update
|
6
|
+
logger.warn "add database_cleaner or update cypress/app_commands/clean.rb"
|
7
7
|
Post.delete_all if defined?(Post)
|
8
8
|
end
|
9
9
|
|
data/lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cypress_api.spec.js
CHANGED
@@ -112,7 +112,7 @@ context('Cypress.config()', () => {
|
|
112
112
|
let myConfig = Cypress.config()
|
113
113
|
|
114
114
|
expect(myConfig).to.have.property('animationDistanceThreshold', 5)
|
115
|
-
expect(myConfig).to.have.property('baseUrl', 'http://localhost:
|
115
|
+
expect(myConfig).to.have.property('baseUrl', 'http://localhost:5017')
|
116
116
|
expect(myConfig).to.have.property('defaultCommandTimeout', 10000)
|
117
117
|
expect(myConfig).to.have.property('requestTimeout', 5000)
|
118
118
|
expect(myConfig).to.have.property('responseTimeout', 30000)
|
@@ -21,7 +21,7 @@ echo '-- start rails server'
|
|
21
21
|
# make sure the server is not running
|
22
22
|
(kill -9 `cat tmp/pids/server.pid` || true )
|
23
23
|
|
24
|
-
bundle exec ./bin/rails server -p
|
24
|
+
bundle exec ./bin/rails server -p 5017 -e test &
|
25
25
|
sleep 2 # give rails a chance to start up correctly
|
26
26
|
|
27
27
|
echo '-- cypress run'
|
@@ -21,7 +21,7 @@ echo '-- start rails server'
|
|
21
21
|
# make sure the server is not running
|
22
22
|
(kill -9 `cat tmp/pids/server.pid` || true )
|
23
23
|
|
24
|
-
bundle exec ./bin/rails server -p
|
24
|
+
bundle exec ./bin/rails server -p 5017 -e test &
|
25
25
|
sleep 2 # give rails a chance to start up correctly
|
26
26
|
|
27
27
|
echo '-- cypress run'
|
@@ -3,6 +3,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
3
3
|
|
4
4
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
5
5
|
gem 'rails', '~> 5.2.0'
|
6
|
+
gem 'sprockets', '~> 3.7.2'
|
6
7
|
gem 'sqlite3', '~> 1.3.6'
|
7
8
|
|
8
9
|
# Reduces boot times through caching; required in config/boot.rb
|
@@ -23,7 +23,7 @@ echo '-- start rails server'
|
|
23
23
|
# make sure the server is not running
|
24
24
|
(kill -9 `cat tmp/pids/server.pid` || true )
|
25
25
|
|
26
|
-
bundle exec ./bin/rails server -p
|
26
|
+
bundle exec ./bin/rails server -p 5017 -e test &
|
27
27
|
sleep 2 # give rails a chance to start up correctly
|
28
28
|
|
29
29
|
echo '-- cypress run'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cypress-on-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- miceportal team
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|