cypress-on-rails 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/LICENSE +21 -0
- data/README.md +14 -14
- data/Rakefile +1 -1
- data/cypress-on-rails.gemspec +3 -2
- data/lib/cypress-on-rails.rb +5 -1
- data/lib/cypress/smart_factory_wrapper.rb +1 -1
- data/lib/cypress_dev.rb +1 -4
- data/lib/cypress_dev/middleware.rb +2 -65
- data/lib/cypress_dev/smart_factory_wrapper.rb +2 -91
- data/lib/{cypress_dev → cypress_on_rails}/command_executor.rb +3 -3
- data/lib/{cypress_dev → cypress_on_rails}/configuration.rb +1 -1
- data/lib/cypress_on_rails/middleware.rb +65 -0
- data/lib/{cypress_dev → cypress_on_rails}/railtie.rb +4 -4
- data/lib/{cypress_dev → cypress_on_rails}/simple_rails_factory.rb +1 -1
- data/lib/cypress_on_rails/smart_factory_wrapper.rb +91 -0
- data/lib/cypress_on_rails/version.rb +3 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/install_generator.rb +2 -2
- data/lib/generators/{cypress_dev/templates/config/initializers/cypress_dev.rb.erb → cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb} +4 -4
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress.json +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/activerecord_fixtures.rb +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/clean.rb +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/eval.rb +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/factory_bot.rb +1 -1
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/log_fail.rb +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/scenarios/basic.rb +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/cypress_helper.rb +3 -3
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/fixtures/example.json +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/actions.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/aliasing.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/assertions.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/connectors.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/cookies.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/cypress_api.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/files.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/local_storage.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/location.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/misc.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/navigation.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/network_requests.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/querying.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/traversal.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/utilities.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/viewport.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/waiting.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/examples/window.spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/rails_examples/other_spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/rails_examples/using_factory_bot.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/rails_examples/using_fixtures.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/integration/rails_examples/using_scenarios_spec.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/support/commands.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/support/index.js +0 -0
- data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/support/on-rails.js +4 -4
- data/spec/{cypress_dev → cypress_on_rails}/command_executor/cypress_helper.rb +0 -0
- data/spec/{cypress_dev → cypress_on_rails}/command_executor/test_command.rb +0 -0
- data/spec/{cypress_dev → cypress_on_rails}/command_executor/test_command_with_options.rb +0 -0
- data/spec/{cypress_dev → cypress_on_rails}/command_executor_spec.rb +3 -3
- data/spec/cypress_on_rails/configuration_spec.rb +23 -0
- data/spec/{cypress_dev → cypress_on_rails}/middleware_spec.rb +3 -3
- data/spec/{cypress_dev → cypress_on_rails}/railtie_spec.rb +3 -3
- data/spec/{cypress_dev → cypress_on_rails}/simple_rails_factory_spec.rb +3 -3
- data/spec/{cypress_dev → cypress_on_rails}/smart_factory_wrapper_spec.rb +3 -3
- data/spec/integrations/rails_3_2/.gitignore +1 -1
- data/spec/integrations/rails_3_2/test.sh +1 -1
- data/spec/integrations/rails_4_2/.gitignore +1 -1
- data/spec/integrations/rails_4_2/test.sh +1 -1
- data/spec/integrations/rails_5_2/.gitignore +1 -1
- data/spec/integrations/rails_5_2/test.sh +1 -1
- data/spec/spec_helper.rb +2 -2
- metadata +58 -54
- data/lib/cypress_dev/version.rb +0 -3
- data/spec/cypress_dev/configuration_spec.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5f09d5e33b22fb99ee869c2872dbcf2deccbe24ead5fb7ef831ea92f86841cf
|
4
|
+
data.tar.gz: 57ed1bb945c66b17f9363d33f98e126fcfba82004bcc817554be0772a968610b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de223cbc75d2e6390639269d7a809a4dd9b6761aba9d2202b2dd06b2c26c83ffc1c1d6b38d362e6cdecca17f6f823b648cf879fceb388ad7a4d48fac04b5e056
|
7
|
+
data.tar.gz: bc858ab72ca05da05399aa867f4919a7c2cb58dc7070f2272c3a95cd4c500f1649a355223633a66e09925ec3ec2c819c62d434b333eb47cdd80a6b1ad786bcf1
|
data/CHANGELOG.md
CHANGED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 ShakaCode
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# CypressOnRails
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/grantspeelman/cypress-on-rails.svg?branch=master)](https://travis-ci.org/grantspeelman/cypress-on-rails)
|
4
4
|
|
@@ -33,17 +33,17 @@ end
|
|
33
33
|
|
34
34
|
The generate the boilerplate code using:
|
35
35
|
```
|
36
|
-
bin/rails g
|
36
|
+
bin/rails g cypress_on_rails:install
|
37
37
|
|
38
38
|
# if you have/want a different cypress folder (default is spec/cypress)
|
39
|
-
bin/rails g
|
39
|
+
bin/rails g cypress_on_rails:install --cypress_folder=test/cypress
|
40
40
|
|
41
41
|
# if you want to install cypress with npm
|
42
|
-
bin/rails g
|
42
|
+
bin/rails g cypress_on_rails:install --install_cypress_with=npm
|
43
43
|
```
|
44
44
|
|
45
45
|
The generator adds the following files/directory to your application:
|
46
|
-
* `config/initializers/
|
46
|
+
* `config/initializers/cypress_on_rails` used to configure CypressDev
|
47
47
|
* `spec/cypress/integrations/` contains your cypress tests
|
48
48
|
* `spec/cypress/support/on-rails.js` contains CypressDev support code
|
49
49
|
* `spec/cypress/app_commands/scenarios/` contains your CypressDev scenario definitions
|
@@ -76,9 +76,9 @@ You can run your [factory_bot](https://github.com/thoughtbot/factory_bot) direct
|
|
76
76
|
|
77
77
|
```ruby
|
78
78
|
# spec/cypress/app_commands/factory_bot.rb
|
79
|
-
require '
|
79
|
+
require 'cypress_on_rails/smart_factory_wrapper'
|
80
80
|
|
81
|
-
|
81
|
+
CypressOnRails::SmartFactoryWrapper.configure(
|
82
82
|
always_reload: !Rails.configuration.cache_classes,
|
83
83
|
factory: FactoryBot,
|
84
84
|
files: Dir['./spec/factories/**/*.rb']
|
@@ -141,7 +141,7 @@ You define a scenario in the `spec/cypress/app_commands/scenarios` directory:
|
|
141
141
|
Profile.create name: "Cypress Hill"
|
142
142
|
|
143
143
|
# or if you have factory_bot enabled in your cypress_helper
|
144
|
-
|
144
|
+
CypressOnRails::SmartFactoryWrapper.create(:profile, name: "Cypress Hill")
|
145
145
|
```
|
146
146
|
|
147
147
|
Then reference the scenario in your test:
|
@@ -183,17 +183,17 @@ describe('My First Test', function() {
|
|
183
183
|
|
184
184
|
## Usage with other rack applications
|
185
185
|
|
186
|
-
Add
|
186
|
+
Add CypressOnRails to your config.ru
|
187
187
|
|
188
188
|
```ruby
|
189
189
|
# an example config.ru
|
190
190
|
require File.expand_path('my_app', File.dirname(__FILE__))
|
191
191
|
|
192
|
-
require '
|
193
|
-
|
192
|
+
require 'cypress_on_rails/middleware'
|
193
|
+
CypressOnRails.configure do |c|
|
194
194
|
c.cypress_folder = File.expand_path("#{__dir__}/test/cypress")
|
195
195
|
end
|
196
|
-
use
|
196
|
+
use CypressOnRails::Middleware
|
197
197
|
|
198
198
|
run MyApp
|
199
199
|
```
|
@@ -202,7 +202,7 @@ add the following file to cypress
|
|
202
202
|
|
203
203
|
```js
|
204
204
|
// test/cypress/support/on-rails.js
|
205
|
-
//
|
205
|
+
// CypressOnRails: dont remove these command
|
206
206
|
Cypress.Commands.add('appCommands', function (body) {
|
207
207
|
cy.request({
|
208
208
|
method: 'POST',
|
@@ -224,7 +224,7 @@ Cypress.Commands.add('appScenario', function (name) {
|
|
224
224
|
Cypress.Commands.add('appFactories', function (options) {
|
225
225
|
cy.app('factory_bot', options)
|
226
226
|
});
|
227
|
-
//
|
227
|
+
// CypressOnRails: end
|
228
228
|
|
229
229
|
// The next is optional
|
230
230
|
beforeEach(() => {
|
data/Rakefile
CHANGED
data/cypress-on-rails.gemspec
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
3
|
-
require "
|
3
|
+
require "cypress_on_rails/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "cypress-on-rails"
|
7
|
-
s.version =
|
7
|
+
s.version = CypressOnRails::VERSION
|
8
8
|
s.author = ["miceportal team", 'Grant Petersen-Speelman']
|
9
9
|
s.email = ["info@miceportal.de", 'grantspeelman@gmail.com']
|
10
10
|
s.homepage = "http://github.com/grantspeelman/cypress-on-rails"
|
11
11
|
s.summary = "Integrates cypress with rails or rack applications"
|
12
12
|
s.description = "Integrates cypress with rails or rack applications"
|
13
|
+
s.post_install_message = 'The CypressDev constant is being deprecated and will be completely removed and replaced with CypressOnRails.'
|
13
14
|
s.rubyforge_project = s.name
|
14
15
|
s.files = `git ls-files`.split("\n")
|
15
16
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
data/lib/cypress-on-rails.rb
CHANGED
data/lib/cypress_dev.rb
CHANGED
@@ -1,65 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require '
|
3
|
-
require 'cypress_dev/configuration'
|
4
|
-
require 'cypress_dev/command_executor'
|
5
|
-
|
6
|
-
module CypressDev
|
7
|
-
# Middleware to handle cypress commands and eval
|
8
|
-
class Middleware
|
9
|
-
def initialize(app, command_executor = CommandExecutor, file = ::File)
|
10
|
-
@app = app
|
11
|
-
@command_executor = command_executor
|
12
|
-
@file = file
|
13
|
-
end
|
14
|
-
|
15
|
-
def call(env)
|
16
|
-
request = Rack::Request.new(env)
|
17
|
-
if request.path.start_with?('/__cypress__/command')
|
18
|
-
configuration.tagged_logged { handle_command(request) }
|
19
|
-
else
|
20
|
-
@app.call(env)
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def configuration
|
27
|
-
CypressDev.configuration
|
28
|
-
end
|
29
|
-
|
30
|
-
def logger
|
31
|
-
configuration.logger
|
32
|
-
end
|
33
|
-
|
34
|
-
Command = Struct.new(:name, :options, :cypress_folder) do
|
35
|
-
# @return [Array<Cypress::Middleware::Command>]
|
36
|
-
def self.from_body(body, configuration)
|
37
|
-
if body.is_a?(Array)
|
38
|
-
command_params = body
|
39
|
-
else
|
40
|
-
command_params = [body]
|
41
|
-
end
|
42
|
-
command_params.map do |params|
|
43
|
-
new(params.fetch('name'), params['options'], configuration.cypress_folder)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def file_path
|
48
|
-
"#{cypress_folder}/app_commands/#{name}.rb"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def handle_command(req)
|
53
|
-
body = JSON.parse(req.body.read)
|
54
|
-
logger.info "handle_command: #{body}"
|
55
|
-
commands = Command.from_body(body, configuration)
|
56
|
-
missing_command = commands.find {|command| !@file.exists?(command.file_path) }
|
57
|
-
if missing_command.nil?
|
58
|
-
commands.each { |command| @command_executor.load(command.file_path, command.options) }
|
59
|
-
[201, {}, ['success']]
|
60
|
-
else
|
61
|
-
[404, {}, ["could not find command file: #{missing_command.file_path}"]]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
1
|
+
warn "cypress_dev is being deprecated, please require \"cypress_on_rails/middleware\" instead"
|
2
|
+
require 'cypress_on_rails/middleware'
|
@@ -1,91 +1,2 @@
|
|
1
|
-
require
|
2
|
-
require '
|
3
|
-
|
4
|
-
module CypressDev
|
5
|
-
class SmartFactoryWrapper
|
6
|
-
module FactoryCleaner
|
7
|
-
def self.clean(f = FactoryBot)
|
8
|
-
f.factories.clear if f.respond_to?(:factories)
|
9
|
-
f.traits.clear if f.respond_to?(:traits)
|
10
|
-
f.callbacks.clear if f.respond_to?(:callbacks)
|
11
|
-
f.sequences.clear if f.respond_to?(:sequences)
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.instance
|
16
|
-
@instance ||= new(files: [], factory: SimpleRailsFactory)
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.configure(files:, factory:, always_reload: true)
|
20
|
-
@instance = new(files: files, factory: factory, always_reload: always_reload)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.create(*args)
|
24
|
-
instance.create(*args)
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.create_list(*args)
|
28
|
-
instance.create_list(*args)
|
29
|
-
end
|
30
|
-
|
31
|
-
# @return [Array]
|
32
|
-
attr_accessor :factory
|
33
|
-
attr_accessor :always_reload
|
34
|
-
|
35
|
-
def initialize(files:, factory:, always_reload: false,
|
36
|
-
factory_cleaner: FactoryCleaner, kernel: Kernel, file_system: File,
|
37
|
-
dir_system: Dir)
|
38
|
-
self.files = files
|
39
|
-
self.factory = factory
|
40
|
-
self.always_reload = always_reload
|
41
|
-
@kernel = kernel
|
42
|
-
@file_system = file_system
|
43
|
-
@factory_cleaner = factory_cleaner
|
44
|
-
@latest_mtime = nil
|
45
|
-
@dir_system = dir_system
|
46
|
-
end
|
47
|
-
|
48
|
-
def create(*args)
|
49
|
-
load_files
|
50
|
-
factory.create(*args)
|
51
|
-
end
|
52
|
-
|
53
|
-
def create_list(*args)
|
54
|
-
load_files
|
55
|
-
factory.create_list(*args)
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
# @param [String,Array] arg
|
61
|
-
def files=(array)
|
62
|
-
array = [array] if array.is_a?(String)
|
63
|
-
@dir_array = array
|
64
|
-
end
|
65
|
-
|
66
|
-
# @return [Array<String>]
|
67
|
-
def files
|
68
|
-
Dir[*@dir_array]
|
69
|
-
end
|
70
|
-
|
71
|
-
def logger
|
72
|
-
CypressDev.configuration.logger
|
73
|
-
end
|
74
|
-
|
75
|
-
def load_files
|
76
|
-
current_latest_mtime = files.map{|file| @file_system.mtime(file) }.max
|
77
|
-
return unless should_reload?(current_latest_mtime)
|
78
|
-
logger.info 'Loading Factories'
|
79
|
-
@latest_mtime = current_latest_mtime
|
80
|
-
@factory_cleaner.clean(factory)
|
81
|
-
files.each do |file|
|
82
|
-
logger.debug "-- Loading: #{file}"
|
83
|
-
@kernel.load(file)
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
def should_reload?(current_latest_mtime)
|
88
|
-
@always_reload || @latest_mtime.nil? || @latest_mtime < current_latest_mtime
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
1
|
+
warn "cypress_dev is being deprecated, please require \"cypress_on_rails/smart_factory_wrapper\" instead"
|
2
|
+
require 'cypress_on_rails/smart_factory_wrapper'
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'cypress_on_rails/configuration'
|
2
2
|
|
3
|
-
module
|
3
|
+
module CypressOnRails
|
4
4
|
# loads and evals the command files
|
5
5
|
class CommandExecutor
|
6
6
|
def self.load(file,command_options = nil)
|
@@ -27,7 +27,7 @@ module CypressDev
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def self.configuration
|
30
|
-
|
30
|
+
CypressOnRails.configuration
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'rack'
|
3
|
+
require 'cypress_on_rails/configuration'
|
4
|
+
require 'cypress_on_rails/command_executor'
|
5
|
+
|
6
|
+
module CypressOnRails
|
7
|
+
# Middleware to handle cypress commands and eval
|
8
|
+
class Middleware
|
9
|
+
def initialize(app, command_executor = CommandExecutor, file = ::File)
|
10
|
+
@app = app
|
11
|
+
@command_executor = command_executor
|
12
|
+
@file = file
|
13
|
+
end
|
14
|
+
|
15
|
+
def call(env)
|
16
|
+
request = Rack::Request.new(env)
|
17
|
+
if request.path.start_with?('/__cypress__/command')
|
18
|
+
configuration.tagged_logged { handle_command(request) }
|
19
|
+
else
|
20
|
+
@app.call(env)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def configuration
|
27
|
+
CypressOnRails.configuration
|
28
|
+
end
|
29
|
+
|
30
|
+
def logger
|
31
|
+
configuration.logger
|
32
|
+
end
|
33
|
+
|
34
|
+
Command = Struct.new(:name, :options, :cypress_folder) do
|
35
|
+
# @return [Array<Cypress::Middleware::Command>]
|
36
|
+
def self.from_body(body, configuration)
|
37
|
+
if body.is_a?(Array)
|
38
|
+
command_params = body
|
39
|
+
else
|
40
|
+
command_params = [body]
|
41
|
+
end
|
42
|
+
command_params.map do |params|
|
43
|
+
new(params.fetch('name'), params['options'], configuration.cypress_folder)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def file_path
|
48
|
+
"#{cypress_folder}/app_commands/#{name}.rb"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def handle_command(req)
|
53
|
+
body = JSON.parse(req.body.read)
|
54
|
+
logger.info "handle_command: #{body}"
|
55
|
+
commands = Command.from_body(body, configuration)
|
56
|
+
missing_command = commands.find {|command| !@file.exists?(command.file_path) }
|
57
|
+
if missing_command.nil?
|
58
|
+
commands.each { |command| @command_executor.load(command.file_path, command.options) }
|
59
|
+
[201, {}, ['success']]
|
60
|
+
else
|
61
|
+
[404, {}, ["could not find command file: #{missing_command.file_path}"]]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
require 'rails/railtie'
|
2
|
-
require '
|
3
|
-
require '
|
2
|
+
require 'cypress_on_rails/configuration'
|
3
|
+
require 'cypress_on_rails/middleware'
|
4
4
|
|
5
|
-
module
|
5
|
+
module CypressOnRails
|
6
6
|
class Railtie < Rails::Railtie
|
7
7
|
initializer :setup_cypress_middleware do |app|
|
8
|
-
if
|
8
|
+
if CypressOnRails.configuration.use_middleware?
|
9
9
|
app.middleware.use Middleware
|
10
10
|
end
|
11
11
|
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'cypress_on_rails/configuration'
|
2
|
+
require 'cypress_on_rails/simple_rails_factory'
|
3
|
+
|
4
|
+
module CypressOnRails
|
5
|
+
class SmartFactoryWrapper
|
6
|
+
module FactoryCleaner
|
7
|
+
def self.clean(f = FactoryBot)
|
8
|
+
f.factories.clear if f.respond_to?(:factories)
|
9
|
+
f.traits.clear if f.respond_to?(:traits)
|
10
|
+
f.callbacks.clear if f.respond_to?(:callbacks)
|
11
|
+
f.sequences.clear if f.respond_to?(:sequences)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.instance
|
16
|
+
@instance ||= new(files: [], factory: SimpleRailsFactory)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.configure(files:, factory:, always_reload: true)
|
20
|
+
@instance = new(files: files, factory: factory, always_reload: always_reload)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.create(*args)
|
24
|
+
instance.create(*args)
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.create_list(*args)
|
28
|
+
instance.create_list(*args)
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [Array]
|
32
|
+
attr_accessor :factory
|
33
|
+
attr_accessor :always_reload
|
34
|
+
|
35
|
+
def initialize(files:, factory:, always_reload: false,
|
36
|
+
factory_cleaner: FactoryCleaner, kernel: Kernel, file_system: File,
|
37
|
+
dir_system: Dir)
|
38
|
+
self.files = files
|
39
|
+
self.factory = factory
|
40
|
+
self.always_reload = always_reload
|
41
|
+
@kernel = kernel
|
42
|
+
@file_system = file_system
|
43
|
+
@factory_cleaner = factory_cleaner
|
44
|
+
@latest_mtime = nil
|
45
|
+
@dir_system = dir_system
|
46
|
+
end
|
47
|
+
|
48
|
+
def create(*args)
|
49
|
+
load_files
|
50
|
+
factory.create(*args)
|
51
|
+
end
|
52
|
+
|
53
|
+
def create_list(*args)
|
54
|
+
load_files
|
55
|
+
factory.create_list(*args)
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
# @param [String,Array] arg
|
61
|
+
def files=(array)
|
62
|
+
array = [array] if array.is_a?(String)
|
63
|
+
@dir_array = array
|
64
|
+
end
|
65
|
+
|
66
|
+
# @return [Array<String>]
|
67
|
+
def files
|
68
|
+
Dir[*@dir_array]
|
69
|
+
end
|
70
|
+
|
71
|
+
def logger
|
72
|
+
CypressOnRails.configuration.logger
|
73
|
+
end
|
74
|
+
|
75
|
+
def load_files
|
76
|
+
current_latest_mtime = files.map{|file| @file_system.mtime(file) }.max
|
77
|
+
return unless should_reload?(current_latest_mtime)
|
78
|
+
logger.info 'Loading Factories'
|
79
|
+
@latest_mtime = current_latest_mtime
|
80
|
+
@factory_cleaner.clean(factory)
|
81
|
+
files.each do |file|
|
82
|
+
logger.debug "-- Loading: #{file}"
|
83
|
+
@kernel.load(file)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def should_reload?(current_latest_mtime)
|
88
|
+
@always_reload || @latest_mtime.nil? || @latest_mtime < current_latest_mtime
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module
|
1
|
+
module CypressOnRails
|
2
2
|
class InstallGenerator < Rails::Generators::Base
|
3
3
|
class_option :cypress_folder, type: :string, default: 'spec/cypress'
|
4
4
|
class_option :install_cypress_with, type: :string, default: 'yarn'
|
@@ -31,7 +31,7 @@ module CypressDev
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def add_initial_files
|
34
|
-
template "config/initializers/
|
34
|
+
template "config/initializers/cypress_on_rails.rb.erb", "config/initializers/cypress_on_rails.rb"
|
35
35
|
copy_file "spec/cypress/cypress_helper.rb", "#{options.cypress_folder}/cypress_helper.rb"
|
36
36
|
copy_file "spec/cypress/support/on-rails.js", "#{options.cypress_folder}/support/on-rails.js"
|
37
37
|
directory 'spec/cypress/app_commands', "#{options.cypress_folder}/app_commands"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
if defined?(
|
2
|
-
|
1
|
+
if defined?(CypressOnRails)
|
2
|
+
CypressOnRails.configure do |c|
|
3
3
|
c.cypress_folder = File.expand_path("#{__dir__}/../../<%= options.cypress_folder %>")
|
4
|
-
# WARNING!!
|
4
|
+
# WARNING!! CypressOnRails can execute arbitrary ruby code
|
5
5
|
# please use with extra caution if enabling on hosted servers or starting your local server on 0.0.0.0
|
6
6
|
c.use_middleware = Rails.env.test?
|
7
7
|
c.logger = Rails.logger
|
8
8
|
end
|
9
|
-
end
|
9
|
+
end
|
File without changes
|
File without changes
|
data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/clean.rb
RENAMED
File without changes
|
data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/eval.rb
RENAMED
File without changes
|
@@ -2,7 +2,7 @@ Array.wrap(command_options).each do |factory_options|
|
|
2
2
|
factory_method = factory_options.shift
|
3
3
|
begin
|
4
4
|
logger.debug "running #{factory_method}, #{factory_options}"
|
5
|
-
|
5
|
+
CypressOnRails::SmartFactoryWrapper.public_send(factory_method, *factory_options)
|
6
6
|
rescue => e
|
7
7
|
logger.error "#{e.class}: #{e.message}"
|
8
8
|
logger.error e.backtrace.join("\n")
|
data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/app_commands/log_fail.rb
RENAMED
File without changes
|
File without changes
|
data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/cypress_helper.rb
RENAMED
@@ -17,13 +17,13 @@ rescue LoadError => e
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
require '
|
20
|
+
require 'cypress_on_rails/smart_factory_wrapper'
|
21
21
|
|
22
|
-
factory =
|
22
|
+
factory = CypressOnRails::SimpleRailsFactory
|
23
23
|
factory = FactoryBot if defined?(FactoryBot)
|
24
24
|
factory = FactoryGirl if defined?(FactoryGirl)
|
25
25
|
|
26
|
-
|
26
|
+
CypressOnRails::SmartFactoryWrapper.configure(
|
27
27
|
always_reload: !Rails.configuration.cache_classes,
|
28
28
|
factory: factory,
|
29
29
|
files: %w(spec/factories.rb ./spec/factories/**/*.rb)
|
data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/fixtures/example.json
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/support/commands.js
RENAMED
File without changes
|
data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/support/index.js
RENAMED
File without changes
|
data/lib/generators/{cypress_dev → cypress_on_rails}/templates/spec/cypress/support/on-rails.js
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
//
|
1
|
+
// CypressOnRails: dont remove these command
|
2
2
|
Cypress.Commands.add('appCommands', function (body) {
|
3
3
|
cy.log("APP: " + JSON.stringify(body))
|
4
4
|
cy.request({
|
@@ -14,8 +14,8 @@ Cypress.Commands.add('app', function (name, command_options) {
|
|
14
14
|
cy.appCommands({name: name, options: command_options})
|
15
15
|
});
|
16
16
|
|
17
|
-
Cypress.Commands.add('appScenario', function (name) {
|
18
|
-
cy.app('scenarios/' + name)
|
17
|
+
Cypress.Commands.add('appScenario', function (name, options = {}) {
|
18
|
+
cy.app('scenarios/' + name, options)
|
19
19
|
});
|
20
20
|
|
21
21
|
Cypress.Commands.add('appEval', function (code) {
|
@@ -29,7 +29,7 @@ Cypress.Commands.add('appFactories', function (options) {
|
|
29
29
|
Cypress.Commands.add('appFixtures', function (options) {
|
30
30
|
cy.app('activerecord_fixtures', options)
|
31
31
|
});
|
32
|
-
//
|
32
|
+
// CypressOnRails: end
|
33
33
|
|
34
34
|
// The next is optional
|
35
35
|
// beforeEach(() => {
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'cypress_on_rails/command_executor'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe CypressOnRails::CommandExecutor do
|
4
4
|
describe '.load' do
|
5
5
|
let(:folder) { "#{__dir__}/command_executor" }
|
6
6
|
subject { described_class }
|
@@ -10,7 +10,7 @@ RSpec.describe CypressDev::CommandExecutor do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
before do
|
13
|
-
|
13
|
+
CypressOnRails.configuration.cypress_folder = folder
|
14
14
|
DummyTest.values.clear if defined?(DummyTest)
|
15
15
|
end
|
16
16
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'cypress_on_rails/configuration'
|
2
|
+
|
3
|
+
RSpec.describe CypressOnRails::Configuration do
|
4
|
+
it 'has defaults' do
|
5
|
+
CypressOnRails.configure { |config| config.reset }
|
6
|
+
|
7
|
+
expect(CypressOnRails.configuration.cypress_folder).to eq('spec/cypress')
|
8
|
+
expect(CypressOnRails.configuration.use_middleware?).to eq(true)
|
9
|
+
expect(CypressOnRails.configuration.logger).to_not be_nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'can be configured' do
|
13
|
+
my_logger = Logger.new(STDOUT)
|
14
|
+
CypressOnRails.configure do |config|
|
15
|
+
config.cypress_folder = 'my/path'
|
16
|
+
config.use_middleware = false
|
17
|
+
config.logger = my_logger
|
18
|
+
end
|
19
|
+
expect(CypressOnRails.configuration.cypress_folder).to eq('my/path')
|
20
|
+
expect(CypressOnRails.configuration.use_middleware?).to eq(false)
|
21
|
+
expect(CypressOnRails.configuration.logger).to eq(my_logger)
|
22
|
+
end
|
23
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'cypress_on_rails/middleware'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe CypressOnRails::Middleware do
|
4
4
|
let(:app) { ->(env) { [200, {}, ["app did #{env['PATH_INFO']}"]] } }
|
5
|
-
let(:command_executor) { class_double(
|
5
|
+
let(:command_executor) { class_double(CypressOnRails::CommandExecutor) }
|
6
6
|
let(:file) { class_double(File) }
|
7
7
|
subject { described_class.new(app, command_executor, file) }
|
8
8
|
|
@@ -1,11 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'cypress_on_rails/railtie'
|
2
2
|
|
3
3
|
module Rails
|
4
4
|
def self.env
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
8
|
-
RSpec.describe
|
8
|
+
RSpec.describe CypressOnRails::Railtie do
|
9
9
|
let(:rails_env) { double }
|
10
10
|
let(:middleware) { double('Middleware', use: true) }
|
11
11
|
let(:rails_app) { double('RailsApp', middleware: middleware) }
|
@@ -15,7 +15,7 @@ RSpec.describe CypressDev::Railtie do
|
|
15
15
|
end
|
16
16
|
|
17
17
|
it 'runs the middleware in test mode' do
|
18
|
-
|
18
|
+
CypressOnRails::Railtie.initializers.each do |initializer|
|
19
19
|
initializer.run(rails_app)
|
20
20
|
end
|
21
21
|
end
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require '
|
1
|
+
require 'cypress_on_rails/simple_rails_factory'
|
2
2
|
|
3
|
-
RSpec.describe
|
4
|
-
subject {
|
3
|
+
RSpec.describe CypressOnRails::SimpleRailsFactory do
|
4
|
+
subject { CypressOnRails::SimpleRailsFactory }
|
5
5
|
|
6
6
|
class AppRecord
|
7
7
|
def self.create!(*)
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require '
|
1
|
+
require 'cypress_on_rails/smart_factory_wrapper'
|
2
2
|
|
3
|
-
RSpec.describe
|
3
|
+
RSpec.describe CypressOnRails::SmartFactoryWrapper do
|
4
4
|
FileSystemDummy = Struct.new(:file_hash) do
|
5
5
|
def mtime(filename)
|
6
6
|
file_hash.fetch(filename)
|
@@ -11,7 +11,7 @@ RSpec.describe CypressDev::SmartFactoryWrapper do
|
|
11
11
|
let(:mtime_hash) { {'file1.rb' => time_now, 'file2.rb' => time_now } }
|
12
12
|
let(:files) { %w(file1.rb file2.rb) }
|
13
13
|
let(:factory_double) { double('FactoryBot', create: true, create_list: true) }
|
14
|
-
let(:factory_cleaner) { class_double(
|
14
|
+
let(:factory_cleaner) { class_double(CypressOnRails::SmartFactoryWrapper::FactoryCleaner, clean: true) }
|
15
15
|
let(:kernel_double) { class_double(Kernel, load: true) }
|
16
16
|
let(:file_double) { FileSystemDummy.new(mtime_hash) }
|
17
17
|
let(:dir_double) { class_double(Dir) }
|
@@ -14,7 +14,7 @@ bundle --version
|
|
14
14
|
bundle install --quiet --gemfile="$DIR/Gemfile" --retry 2 --path vendor/bundle
|
15
15
|
|
16
16
|
echo '-- cypress install'
|
17
|
-
bundle exec ./bin/rails g
|
17
|
+
bundle exec ./bin/rails g cypress_on_rails:install --cypress_folder=cypress --install_cypress_with=npm --no-install-cypress-examples
|
18
18
|
|
19
19
|
echo '-- start rails server'
|
20
20
|
# make sure the server is not running
|
@@ -14,7 +14,7 @@ bundle --version
|
|
14
14
|
bundle install --quiet --gemfile="$DIR/Gemfile" --retry 2 --path vendor/bundle
|
15
15
|
|
16
16
|
echo '-- cypress install'
|
17
|
-
bundle exec ./bin/rails g
|
17
|
+
bundle exec ./bin/rails g cypress_on_rails:install --no-install-cypress-examples
|
18
18
|
|
19
19
|
echo '-- start rails server'
|
20
20
|
# make sure the server is not running
|
@@ -17,7 +17,7 @@ echo '-- migration'
|
|
17
17
|
bin/rails db:migrate
|
18
18
|
|
19
19
|
echo '-- cypress install'
|
20
|
-
bundle exec ./bin/rails g
|
20
|
+
bundle exec ./bin/rails g cypress_on_rails:install --cypress_folder=test/cypress --no-install-cypress-examples
|
21
21
|
|
22
22
|
echo '-- start rails server'
|
23
23
|
# make sure the server is not running
|
data/spec/spec_helper.rb
CHANGED
@@ -95,8 +95,8 @@ RSpec.configure do |config|
|
|
95
95
|
Kernel.srand config.seed
|
96
96
|
|
97
97
|
config.before(:each) do
|
98
|
-
require '
|
99
|
-
|
98
|
+
require 'cypress_on_rails/configuration'
|
99
|
+
CypressOnRails.configure do |config|
|
100
100
|
config.reset
|
101
101
|
config.logger = Logger.new('spec/test.log')
|
102
102
|
end
|
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.4.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: 2019-
|
12
|
+
date: 2019-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
@@ -80,65 +80,68 @@ files:
|
|
80
80
|
- ".travis.yml"
|
81
81
|
- CHANGELOG.md
|
82
82
|
- Gemfile
|
83
|
+
- LICENSE
|
83
84
|
- README.md
|
84
85
|
- Rakefile
|
85
86
|
- cypress-on-rails.gemspec
|
86
87
|
- lib/cypress-on-rails.rb
|
87
88
|
- lib/cypress/smart_factory_wrapper.rb
|
88
89
|
- lib/cypress_dev.rb
|
89
|
-
- lib/cypress_dev/command_executor.rb
|
90
|
-
- lib/cypress_dev/configuration.rb
|
91
90
|
- lib/cypress_dev/middleware.rb
|
92
|
-
- lib/cypress_dev/railtie.rb
|
93
|
-
- lib/cypress_dev/simple_rails_factory.rb
|
94
91
|
- lib/cypress_dev/smart_factory_wrapper.rb
|
95
|
-
- lib/
|
96
|
-
- lib/
|
97
|
-
- lib/
|
98
|
-
- lib/
|
99
|
-
- lib/
|
100
|
-
- lib/
|
101
|
-
- lib/
|
102
|
-
- lib/generators/
|
103
|
-
- lib/generators/
|
104
|
-
- lib/generators/
|
105
|
-
- lib/generators/
|
106
|
-
- lib/generators/
|
107
|
-
- lib/generators/
|
108
|
-
- lib/generators/
|
109
|
-
- lib/generators/
|
110
|
-
- lib/generators/
|
111
|
-
- lib/generators/
|
112
|
-
- lib/generators/
|
113
|
-
- lib/generators/
|
114
|
-
- lib/generators/
|
115
|
-
- lib/generators/
|
116
|
-
- lib/generators/
|
117
|
-
- lib/generators/
|
118
|
-
- lib/generators/
|
119
|
-
- lib/generators/
|
120
|
-
- lib/generators/
|
121
|
-
- lib/generators/
|
122
|
-
- lib/generators/
|
123
|
-
- lib/generators/
|
124
|
-
- lib/generators/
|
125
|
-
- lib/generators/
|
126
|
-
- lib/generators/
|
127
|
-
- lib/generators/
|
128
|
-
- lib/generators/
|
129
|
-
- lib/generators/
|
130
|
-
- lib/generators/
|
131
|
-
- lib/generators/
|
132
|
-
- lib/generators/
|
133
|
-
- spec/
|
134
|
-
- spec/
|
135
|
-
- spec/
|
136
|
-
- spec/
|
137
|
-
- spec/
|
138
|
-
- spec/
|
139
|
-
- spec/
|
140
|
-
- spec/
|
141
|
-
- spec/
|
92
|
+
- lib/cypress_on_rails/command_executor.rb
|
93
|
+
- lib/cypress_on_rails/configuration.rb
|
94
|
+
- lib/cypress_on_rails/middleware.rb
|
95
|
+
- lib/cypress_on_rails/railtie.rb
|
96
|
+
- lib/cypress_on_rails/simple_rails_factory.rb
|
97
|
+
- lib/cypress_on_rails/smart_factory_wrapper.rb
|
98
|
+
- lib/cypress_on_rails/version.rb
|
99
|
+
- lib/generators/cypress_on_rails/install_generator.rb
|
100
|
+
- lib/generators/cypress_on_rails/templates/config/initializers/cypress_on_rails.rb.erb
|
101
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress.json
|
102
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/activerecord_fixtures.rb
|
103
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/clean.rb
|
104
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/eval.rb
|
105
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/factory_bot.rb
|
106
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/log_fail.rb
|
107
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/app_commands/scenarios/basic.rb
|
108
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/cypress_helper.rb
|
109
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/fixtures/example.json
|
110
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/actions.spec.js
|
111
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/aliasing.spec.js
|
112
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/assertions.spec.js
|
113
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/connectors.spec.js
|
114
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cookies.spec.js
|
115
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/cypress_api.spec.js
|
116
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/files.spec.js
|
117
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/local_storage.spec.js
|
118
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/location.spec.js
|
119
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/misc.spec.js
|
120
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/navigation.spec.js
|
121
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/network_requests.spec.js
|
122
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/querying.spec.js
|
123
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/spies_stubs_clocks.spec.js
|
124
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/traversal.spec.js
|
125
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/utilities.spec.js
|
126
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/viewport.spec.js
|
127
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/waiting.spec.js
|
128
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/examples/window.spec.js
|
129
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/other_spec.js
|
130
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_factory_bot.js
|
131
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_fixtures.js
|
132
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/integration/rails_examples/using_scenarios_spec.js
|
133
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/support/commands.js
|
134
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/support/index.js
|
135
|
+
- lib/generators/cypress_on_rails/templates/spec/cypress/support/on-rails.js
|
136
|
+
- spec/cypress_on_rails/command_executor/cypress_helper.rb
|
137
|
+
- spec/cypress_on_rails/command_executor/test_command.rb
|
138
|
+
- spec/cypress_on_rails/command_executor/test_command_with_options.rb
|
139
|
+
- spec/cypress_on_rails/command_executor_spec.rb
|
140
|
+
- spec/cypress_on_rails/configuration_spec.rb
|
141
|
+
- spec/cypress_on_rails/middleware_spec.rb
|
142
|
+
- spec/cypress_on_rails/railtie_spec.rb
|
143
|
+
- spec/cypress_on_rails/simple_rails_factory_spec.rb
|
144
|
+
- spec/cypress_on_rails/smart_factory_wrapper_spec.rb
|
142
145
|
- spec/integrations/cypress.json
|
143
146
|
- spec/integrations/rails_3_2/.gitignore
|
144
147
|
- spec/integrations/rails_3_2/Gemfile
|
@@ -280,7 +283,8 @@ files:
|
|
280
283
|
homepage: http://github.com/grantspeelman/cypress-on-rails
|
281
284
|
licenses: []
|
282
285
|
metadata: {}
|
283
|
-
post_install_message:
|
286
|
+
post_install_message: The CypressDev constant is being deprecated and will be completely
|
287
|
+
removed and replaced with CypressOnRails.
|
284
288
|
rdoc_options: []
|
285
289
|
require_paths:
|
286
290
|
- lib
|
data/lib/cypress_dev/version.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'cypress_dev/configuration'
|
2
|
-
|
3
|
-
RSpec.describe CypressDev::Configuration do
|
4
|
-
it 'has defaults' do
|
5
|
-
CypressDev.configure { |config| config.reset }
|
6
|
-
|
7
|
-
expect(CypressDev.configuration.cypress_folder).to eq('spec/cypress')
|
8
|
-
expect(CypressDev.configuration.use_middleware?).to eq(true)
|
9
|
-
expect(CypressDev.configuration.logger).to_not be_nil
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'can be configured' do
|
13
|
-
my_logger = Logger.new(STDOUT)
|
14
|
-
CypressDev.configure do |config|
|
15
|
-
config.cypress_folder = 'my/path'
|
16
|
-
config.use_middleware = false
|
17
|
-
config.logger = my_logger
|
18
|
-
end
|
19
|
-
expect(CypressDev.configuration.cypress_folder).to eq('my/path')
|
20
|
-
expect(CypressDev.configuration.use_middleware?).to eq(false)
|
21
|
-
expect(CypressDev.configuration.logger).to eq(my_logger)
|
22
|
-
end
|
23
|
-
end
|