ruby_raider 0.9.4 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/integration.yml +5 -5
- data/.github/workflows/selenium.yml +22 -0
- data/.github/workflows/watir.yml +22 -0
- data/README.md +30 -27
- data/lib/commands/loaded_commands.rb +9 -0
- data/lib/commands/plugin_commands.rb +34 -0
- data/lib/generators/menu_generator.rb +5 -1
- data/lib/generators/templates/common/read_me.tt +25 -22
- data/lib/plugin/plugin.rb +99 -0
- data/lib/plugin/plugin_exposer.rb +77 -0
- data/lib/ruby_raider.rb +23 -4
- data/lib/utilities/utilities.rb +1 -1
- data/lib/version +1 -1
- data/plugins.yml +2 -0
- data/spec/integration/commands/scaffolding_commands_spec.rb +1 -1
- data/spec/integration/commands/utility_commands_spec.rb +3 -3
- data/spec/integration/generators/actions_generator_spec.rb +1 -1
- data/spec/integration/generators/automation_generator_spec.rb +4 -4
- data/spec/integration/generators/common_generator_spec.rb +13 -20
- data/spec/integration/generators/cucumber_generator_spec.rb +2 -2
- data/spec/integration/generators/helpers_generator_spec.rb +13 -13
- data/spec/integration/generators/rspec_generator_spec.rb +2 -2
- data/spec/{support → integration}/settings_helper.rb +1 -3
- data/spec/integration/spec_helper.rb +33 -0
- data/spec/system/selenium_spec.rb +40 -0
- data/spec/system/watir_spec.rb +40 -0
- metadata +13 -6
- data/.github/workflows/rspec_selenium.yml +0 -42
- data/.github/workflows/rspec_watir.yml +0 -42
- data/spec/spec_helper.rb +0 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13e030220ff47c71acf48640242c5fc07e6662fe64c87daf12c1de2d9244c8cf
|
4
|
+
data.tar.gz: f96befd255d2a113a11ad8ffb5def3447579c5a063882c0fbc59f8f13af93318
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44c8d630b47aba90183dd098f0d849a64394c1b30121a9d677dc35a3f9b56c42f6c0bfe4824953b2af7f54c98938cc142c50aaa927d62a2158f9477c93cbef17
|
7
|
+
data.tar.gz: 4b9c0418091be7d513ec762e8059890cd48e1a671a20c44e31c26069bed991cc27afbbb092112e6fdbf2e181c8a4b4293ec0a2714c56629a43224cc7972684f7
|
@@ -8,13 +8,13 @@ jobs:
|
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
|
10
10
|
steps:
|
11
|
+
- name: Checkout repository
|
12
|
+
uses: actions/checkout@v4
|
13
|
+
|
11
14
|
- name: Set up Ruby
|
12
|
-
uses: ruby/setup-ruby@
|
15
|
+
uses: ruby/setup-ruby@v1
|
13
16
|
with:
|
14
|
-
ruby-version:
|
15
|
-
|
16
|
-
- name: Checkout repository
|
17
|
-
uses: actions/checkout@v3
|
17
|
+
ruby-version: 3.1.0
|
18
18
|
|
19
19
|
- name: Install gems
|
20
20
|
run: bundle install
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Selenium Tests on Ubuntu
|
2
|
+
on: [ pull_request ]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
build:
|
6
|
+
name: Selenium based frameworks pipeline
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- name: Checkout repository
|
11
|
+
uses: actions/checkout@v4
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.1.0
|
17
|
+
|
18
|
+
- name: Install gems
|
19
|
+
run: bundle install
|
20
|
+
|
21
|
+
- name: Build and run system tests
|
22
|
+
run: rspec spec/system/selenium_spec.rb
|
@@ -0,0 +1,22 @@
|
|
1
|
+
name: Watir Tests on Ubuntu
|
2
|
+
on: [ pull_request ]
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
build:
|
6
|
+
name: Watir based frameworks pipeline
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- name: Checkout repository
|
11
|
+
uses: actions/checkout@v4
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.1.0
|
17
|
+
|
18
|
+
- name: Install gems
|
19
|
+
run: bundle install
|
20
|
+
|
21
|
+
- name: Build and run system tests
|
22
|
+
run: rspec spec/system/watir_spec.rb
|
data/README.md
CHANGED
@@ -10,12 +10,9 @@
|
|
10
10
|
<br />
|
11
11
|
<div align="center">
|
12
12
|
<a href="https://github.com/RubyRaider/ruby_raider">
|
13
|
-
<img src="https://
|
13
|
+
<img src="https://ruby-raider.com/wp-content/uploads/2022/05/logo-160x160.png?w=890" alt="Logo" style="width:600px;">
|
14
14
|
</a>
|
15
|
-
<h1 align="center">Ruby Raider</h1>
|
16
15
|
<p align="center">
|
17
|
-
This is a gem to make setup and start of UI automation projects easier.
|
18
|
-
<br />
|
19
16
|
<a href="https://github.com/RubyRaider/ruby_raider#getting-started"><strong>Explore the docs »</strong></a>
|
20
17
|
<br />
|
21
18
|
<br />
|
@@ -33,21 +30,25 @@
|
|
33
30
|
Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
34
31
|
|
35
32
|
### At the moment Ruby Raider supports generating the following frameworks:
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
|
34
|
+
| Web Testing Framework | Visual Testing Framework | Mobile Testing Framework | Accessibility Testing Framework |
|
35
|
+
|-----------------------|-----------------------------------|------------------------------------|---------------------------------|
|
36
|
+
| Cucumber and Selenium | Cucumber, Applitools and Selenium | Cucumber and Appium for IOS | Cucumber and Axe for web |
|
37
|
+
| Rspec and Selenium | Rspec, Applitools and Selenium | Rspec and Appium for IOS | Rspec and Axe for web |
|
38
|
+
| Cucumber and Watir | | Cucumber and Appium for Android | |
|
39
|
+
| Rspec and Watir | | Rspec and Appium for Android | |
|
40
|
+
| | | Cucumber and Appium Cross-platform | |
|
41
|
+
| | | Rspec and Appium Cross-platform | |
|
44
42
|
|
45
43
|
***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
|
46
|
-
***Remember to use the full path of the app that you download in the capabilities file and start the server using one of
|
44
|
+
***Remember to use the full path of the app that you download in the capabilities file and start the server using one of
|
45
|
+
the commands below:***
|
46
|
+
|
47
47
|
```ruby
|
48
48
|
raider u start_appium
|
49
|
-
appium
|
49
|
+
appium --base - path /wd/ hub
|
50
50
|
```
|
51
|
+
|
51
52
|
***In order to run the visual tests with applitools, you need to create an account and get your api key, you can read
|
52
53
|
more [here](https://applitools.com/docs/topics/overview/obtain-api-key.html#:~:text=If%20you%20already%20have%20an,Your%20key%20will%20be%20displayed.)
|
53
54
|
.***
|
@@ -81,13 +82,13 @@ Select the ones you will like to work with.
|
|
81
82
|
If you already know which frameworks you want to use, you can do:
|
82
83
|
|
83
84
|
```ruby
|
84
|
-
raider new [name_of_project]
|
85
|
+
raider new [name_of_project] p framework : [framework] automation : [automation_type]
|
85
86
|
```
|
86
87
|
|
87
88
|
An example of the command above would be:
|
88
89
|
|
89
90
|
```ruby
|
90
|
-
raider new test_project
|
91
|
+
raider new test_project p framework : rspec automation: selenium
|
91
92
|
```
|
92
93
|
|
93
94
|
Where [frameworks] is a comma separated list of the frameworks you want to use.
|
@@ -97,12 +98,12 @@ Where [frameworks] is a comma separated list of the frameworks you want to use.
|
|
97
98
|
###### Anything between square brackets([...]) is where your imput goes
|
98
99
|
|
99
100
|
```ruby
|
100
|
-
Commands:
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
Commands :
|
102
|
+
raider generate # Provides access to all the scaffolding commands
|
103
|
+
raider help [COMMAND] # Describe available commands or one specific command
|
104
|
+
raider new [PROJECT_NAME] # Creates a new framework based on settings picked
|
105
|
+
raider utility # Provides access to all the utility commands
|
106
|
+
raider version # It shows the version of Ruby Raider you are currently using
|
106
107
|
```
|
107
108
|
|
108
109
|
All the basic commands have their corresponding shortcut:
|
@@ -113,6 +114,7 @@ All the basic commands have their corresponding shortcut:
|
|
113
114
|
* v for version
|
114
115
|
|
115
116
|
### Scaffolding Commands
|
117
|
+
|
116
118
|
Ruby Raider also supports scaffolding:
|
117
119
|
|
118
120
|
* To create a new page object you do: ```raider g page [PAGE_NAME]```
|
@@ -121,22 +123,23 @@ Ruby Raider also supports scaffolding:
|
|
121
123
|
* To create a new steps definition you do: ```raider g steps [STEPS_NAME]```
|
122
124
|
* To create both a page/spec or a page/feature/steps you do: ```raider g scaffold [SCAFFOLD_NAME]```
|
123
125
|
|
124
|
-
It's possible to add the option --path or
|
126
|
+
It's possible to add the option --path or p if you want to specify where to create your features, pages, helpers and
|
125
127
|
specs.
|
126
128
|
|
127
129
|
If you want to set the default path for the creation of your features, helpers and specs:
|
128
130
|
|
129
131
|
```ruby
|
130
|
-
raider u path [PATH_NAME] - -feature or
|
131
|
-
raider u path [PATH_NAME] - -spec or
|
132
|
-
raider u path [PATH_NAME] - -helper or
|
132
|
+
raider u path [PATH_NAME] - -feature or f
|
133
|
+
raider u path [PATH_NAME] - -spec or s
|
134
|
+
raider u path [PATH_NAME] - -helper or h
|
133
135
|
```
|
134
136
|
|
135
137
|
If you don't specify an option, path will assume you want to change the default path for pages.
|
136
138
|
|
137
|
-
|
138
139
|
### Appium Server Command
|
140
|
+
|
139
141
|
To initialise Appium server run this command:
|
142
|
+
|
140
143
|
```ruby
|
141
144
|
raider u start_appium
|
142
145
|
```
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'thor'
|
4
|
+
require_relative '../plugin/plugin'
|
5
|
+
|
6
|
+
module RubyRaider
|
7
|
+
# :reek:FeatureEnvy { enabled: false }
|
8
|
+
# :reek:UtilityFunction { enabled: false }
|
9
|
+
class PluginCommands < Thor
|
10
|
+
desc 'add [NAME]', 'Adds a plugin to your project'
|
11
|
+
|
12
|
+
def add(plugin_name)
|
13
|
+
Plugin.add_plugin(plugin_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'delete [NAME]', 'Deletes a plugin from your project'
|
17
|
+
|
18
|
+
def delete(plugin_name)
|
19
|
+
Plugin.delete_plugin(plugin_name)
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'local', 'Lists all the plugin in your project'
|
23
|
+
|
24
|
+
def local
|
25
|
+
pp Plugin.installed_plugins
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'list', 'Lists all the available plugin'
|
29
|
+
|
30
|
+
def list
|
31
|
+
pp Plugin.available_plugins
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -84,11 +84,15 @@ class MenuGenerator
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def select_automation_framework(menu)
|
87
|
+
automation_options(menu)
|
88
|
+
menu.choice :Quit, -> { exit }
|
89
|
+
end
|
90
|
+
|
91
|
+
def automation_options(menu)
|
87
92
|
menu.choice :Selenium, -> { choose_test_framework('selenium') }
|
88
93
|
menu.choice :Appium, -> { choose_test_framework('appium') }
|
89
94
|
menu.choice :Watir, -> { choose_test_framework('watir') }
|
90
95
|
menu.choice :Applitools, -> { choose_test_framework('applitools') }
|
91
96
|
menu.choice :Axe, -> { choose_test_framework('axe') }
|
92
|
-
menu.choice :Quit, -> { exit }
|
93
97
|
end
|
94
98
|
end
|
@@ -4,12 +4,9 @@
|
|
4
4
|
<br />
|
5
5
|
<div align="center">
|
6
6
|
<a href="https://github.com/RubyRaider/ruby_raider">
|
7
|
-
<img src="https://
|
7
|
+
<img src="https://ruby-raider.com/wp-content/uploads/2022/05/logo-160x160.png?w=890" alt="Logo" style="width:600px;">
|
8
8
|
</a>
|
9
|
-
<h1 align="center">Ruby Raider</h1>
|
10
9
|
<p align="center">
|
11
|
-
This is a gem to make setup and start of UI automation projects easier.
|
12
|
-
<br />
|
13
10
|
<a href="https://github.com/RubyRaider/ruby_raider#getting-started"><strong>Explore the docs »</strong></a>
|
14
11
|
<br />
|
15
12
|
<br />
|
@@ -27,21 +24,25 @@
|
|
27
24
|
Ruby Raider is a generator and scaffolding gem to make UI test automation easier
|
28
25
|
|
29
26
|
### At the moment Ruby Raider supports generating the following frameworks:
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
|
28
|
+
| Web Testing Framework | Visual Testing Framework | Mobile Testing Framework | Accessibility Testing Framework |
|
29
|
+
|-----------------------|-----------------------------------|------------------------------------|---------------------------------|
|
30
|
+
| Cucumber and Selenium | Cucumber, Applitools and Selenium | Cucumber and Appium for IOS | Cucumber and Axe for web |
|
31
|
+
| Rspec and Selenium | Rspec, Applitools and Selenium | Rspec and Appium for IOS | Rspec and Axe for web |
|
32
|
+
| Cucumber and Watir | | Cucumber and Appium for Android | |
|
33
|
+
| Rspec and Watir | | Rspec and Appium for Android | |
|
34
|
+
| | | Cucumber and Appium Cross-platform | |
|
35
|
+
| | | Rspec and Appium Cross-platform | |
|
38
36
|
|
39
37
|
***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
|
40
|
-
***Remember to use the full path of the app that you download in the capabilities file and start the server using one of
|
38
|
+
***Remember to use the full path of the app that you download in the capabilities file and start the server using one of
|
39
|
+
the commands below:***
|
40
|
+
|
41
41
|
```ruby
|
42
42
|
raider u start_appium
|
43
|
-
appium
|
43
|
+
appium --base - path /wd/ hub
|
44
44
|
```
|
45
|
+
|
45
46
|
***In order to run the visual tests with applitools, you need to create an account and get your api key, you can read
|
46
47
|
more [here](https://applitools.com/docs/topics/overview/obtain-api-key.html#:~:text=If%20you%20already%20have%20an,Your%20key%20will%20be%20displayed.)
|
47
48
|
.***
|
@@ -75,13 +76,13 @@ Select the ones you will like to work with.
|
|
75
76
|
If you already know which frameworks you want to use, you can do:
|
76
77
|
|
77
78
|
```ruby
|
78
|
-
raider new [name_of_project]
|
79
|
+
raider new [name_of_project] p framework : [framework] automation : [automation_type]
|
79
80
|
```
|
80
81
|
|
81
82
|
An example of the command above would be:
|
82
83
|
|
83
84
|
```ruby
|
84
|
-
raider new test_project
|
85
|
+
raider new test_project p framework : rspec automation: selenium
|
85
86
|
```
|
86
87
|
|
87
88
|
Where [frameworks] is a comma separated list of the frameworks you want to use.
|
@@ -91,7 +92,7 @@ Where [frameworks] is a comma separated list of the frameworks you want to use.
|
|
91
92
|
###### Anything between square brackets([...]) is where your imput goes
|
92
93
|
|
93
94
|
```ruby
|
94
|
-
Commands:
|
95
|
+
Commands :
|
95
96
|
raider generate # Provides access to all the scaffolding commands
|
96
97
|
raider help [COMMAND] # Describe available commands or one specific command
|
97
98
|
raider new [PROJECT_NAME] # Creates a new framework based on settings picked
|
@@ -107,6 +108,7 @@ All the basic commands have their corresponding shortcut:
|
|
107
108
|
* v for version
|
108
109
|
|
109
110
|
### Scaffolding Commands
|
111
|
+
|
110
112
|
Ruby Raider also supports scaffolding:
|
111
113
|
|
112
114
|
* To create a new page object you do: ```raider g page [PAGE_NAME]```
|
@@ -115,22 +117,23 @@ Ruby Raider also supports scaffolding:
|
|
115
117
|
* To create a new steps definition you do: ```raider g steps [STEPS_NAME]```
|
116
118
|
* To create both a page/spec or a page/feature/steps you do: ```raider g scaffold [SCAFFOLD_NAME]```
|
117
119
|
|
118
|
-
It's possible to add the option --path or
|
120
|
+
It's possible to add the option --path or p if you want to specify where to create your features, pages, helpers and
|
119
121
|
specs.
|
120
122
|
|
121
123
|
If you want to set the default path for the creation of your features, helpers and specs:
|
122
124
|
|
123
125
|
```ruby
|
124
|
-
raider u path [PATH_NAME] - -feature or
|
125
|
-
raider u path [PATH_NAME] - -spec or
|
126
|
-
raider u path [PATH_NAME] - -helper or
|
126
|
+
raider u path [PATH_NAME] - -feature or f
|
127
|
+
raider u path [PATH_NAME] - -spec or s
|
128
|
+
raider u path [PATH_NAME] - -helper or h
|
127
129
|
```
|
128
130
|
|
129
131
|
If you don't specify an option, path will assume you want to change the default path for pages.
|
130
132
|
|
131
|
-
|
132
133
|
### Appium Server Command
|
134
|
+
|
133
135
|
To initialise Appium server run this command:
|
136
|
+
|
134
137
|
```ruby
|
135
138
|
raider u start_appium
|
136
139
|
```
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require_relative 'plugin_exposer'
|
5
|
+
|
6
|
+
module RubyRaider
|
7
|
+
module Plugin
|
8
|
+
class << self
|
9
|
+
def add_plugin(plugin_name)
|
10
|
+
return pp 'The plugin was not found' unless available?(plugin_name)
|
11
|
+
return pp 'The plugin is already installed' if installed?(plugin_name)
|
12
|
+
|
13
|
+
pp "Adding #{plugin_name}..."
|
14
|
+
add_plugin_to_gemfile(plugin_name)
|
15
|
+
system('bundle install')
|
16
|
+
PluginExposer.expose_commands(plugin_name)
|
17
|
+
pp "The plugin #{plugin_name} is added"
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete_plugin(plugin_name)
|
21
|
+
return 'The plugin is not installed' unless installed_plugins.include?(plugin_name)
|
22
|
+
|
23
|
+
pp "Deleting #{plugin_name}..."
|
24
|
+
remove_plugin_from_gemfile(plugin_name)
|
25
|
+
PluginExposer.remove_command(plugin_name)
|
26
|
+
system('bundle install')
|
27
|
+
pp "The plugin #{plugin_name} is deleted"
|
28
|
+
end
|
29
|
+
|
30
|
+
def installed_plugins
|
31
|
+
parsed_gemfile = File.readlines('Gemfile').map { |line| line.sub('gem ', '').strip.delete("'") }
|
32
|
+
parsed_gemfile.select { |line| available_plugins.include?(line) }
|
33
|
+
end
|
34
|
+
|
35
|
+
def available_plugins
|
36
|
+
plugins['plugins']
|
37
|
+
end
|
38
|
+
|
39
|
+
def installed?(plugin_name)
|
40
|
+
installed_plugins.include?(plugin_name)
|
41
|
+
end
|
42
|
+
|
43
|
+
def available?(plugin_name)
|
44
|
+
available_plugins.include?(plugin_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
def camelize(str)
|
48
|
+
str.split('_').collect(&:capitalize).join
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
|
53
|
+
def add_plugin_to_gemfile(plugin_name)
|
54
|
+
File.open('Gemfile', 'a') do |file|
|
55
|
+
file.puts "\n# Ruby Raider Plugins\n" unless comment_present?
|
56
|
+
file.puts "gem '#{plugin_name}'" unless plugin_present?(plugin_name)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def remove_plugin_from_gemfile(plugin_name)
|
61
|
+
output_lines = remove_plugins_and_comments(plugin_name)
|
62
|
+
update_gemfile(output_lines)
|
63
|
+
end
|
64
|
+
|
65
|
+
def last_plugin?
|
66
|
+
installed_plugins.count == 1
|
67
|
+
end
|
68
|
+
|
69
|
+
def plugins
|
70
|
+
@plugins ||= YAML.load_file('plugins.yml')
|
71
|
+
end
|
72
|
+
|
73
|
+
def read_gemfile
|
74
|
+
File.readlines('Gemfile')
|
75
|
+
end
|
76
|
+
|
77
|
+
def comment_present?
|
78
|
+
read_gemfile.grep(/Ruby Raider Plugins/).any?
|
79
|
+
end
|
80
|
+
|
81
|
+
def plugin_present?(plugin_name)
|
82
|
+
read_gemfile.grep(/#{plugin_name}/).any?
|
83
|
+
end
|
84
|
+
|
85
|
+
def remove_plugins_and_comments(plugin_name)
|
86
|
+
read_gemfile.reject do |line|
|
87
|
+
line.include?(plugin_name) || line.include?('Ruby Raider Plugins') && last_plugin?
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# :reek:NestedIterators { enabled: false }
|
92
|
+
def update_gemfile(output_lines)
|
93
|
+
File.open('Gemfile', 'w') do |file|
|
94
|
+
output_lines.each { |line| file.puts line }
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../plugin/plugin'
|
4
|
+
|
5
|
+
module RubyRaider
|
6
|
+
module PluginExposer
|
7
|
+
class << self
|
8
|
+
FILE_PATH = File.expand_path('../commands/loaded_commands.rb', __dir__)
|
9
|
+
# :reek:NestedIterators { enabled: false }
|
10
|
+
def expose_commands(plugin_name)
|
11
|
+
return pp 'The plugin is already installed' if plugin_present?(plugin_name)
|
12
|
+
|
13
|
+
commands = read_loaded_commands
|
14
|
+
|
15
|
+
File.open(FILE_PATH, 'w') do |file|
|
16
|
+
commands.each do |line|
|
17
|
+
file.puts line
|
18
|
+
file.puts require_plugin(plugin_name, line)
|
19
|
+
file.puts select_command_formatting(plugin_name, line)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove_command(plugin_name)
|
25
|
+
return pp 'The plugin is not installed' unless plugin_present?(plugin_name)
|
26
|
+
|
27
|
+
delete_plugin_command(plugin_name)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def any_commands?
|
33
|
+
read_loaded_commands.any? { |line| line.include?('subcommand') }
|
34
|
+
end
|
35
|
+
|
36
|
+
def read_loaded_commands
|
37
|
+
File.readlines(FILE_PATH)
|
38
|
+
end
|
39
|
+
|
40
|
+
def formatted_command_without_space(plugin_name)
|
41
|
+
"desc '#{plugin_name}', 'Provides access to all the commands for #{plugin_name}'\n" \
|
42
|
+
"subcommand '#{plugin_name}', #{Plugin.camelize(plugin_name)}::PluginCommands"
|
43
|
+
end
|
44
|
+
|
45
|
+
def formatted_command_with_space(plugin_name)
|
46
|
+
"\n#{formatted_command_without_space(plugin_name)}"
|
47
|
+
end
|
48
|
+
|
49
|
+
def plugin_present?(plugin_name)
|
50
|
+
read_loaded_commands.grep(/#{plugin_name}/).any?
|
51
|
+
end
|
52
|
+
|
53
|
+
def select_command_formatting(plugin_name, line)
|
54
|
+
if line.strip == 'class LoadedCommands < Thor' && !any_commands?
|
55
|
+
formatted_command_without_space(plugin_name)
|
56
|
+
elsif any_commands?
|
57
|
+
formatted_command_with_space(plugin_name)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def require_plugin(plugin_name, line)
|
62
|
+
"require '#{plugin_name}'" if line.include?("require 'thor'") && !plugin_present?(plugin_name)
|
63
|
+
end
|
64
|
+
|
65
|
+
# :reek:NestedIterators { enabled: false }
|
66
|
+
def delete_plugin_command(plugin_name)
|
67
|
+
output_lines = read_loaded_commands.reject do |line|
|
68
|
+
line.include?(plugin_name) if plugin_present?(plugin_name)
|
69
|
+
end
|
70
|
+
|
71
|
+
File.open(FILE_PATH, 'w') do |file|
|
72
|
+
output_lines.each { |line| file.puts line }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/ruby_raider.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative '../lib/plugin/plugin'
|
4
|
+
require_relative '../lib/commands/plugin_commands'
|
5
|
+
require_relative '../lib/commands/loaded_commands'
|
3
6
|
require_relative '../lib/commands/scaffolding_commands'
|
4
7
|
require_relative '../lib/commands/utility_commands'
|
5
8
|
|
@@ -7,9 +10,19 @@ require_relative '../lib/commands/utility_commands'
|
|
7
10
|
# :reek:UtilityFunction { enabled: false }
|
8
11
|
module RubyRaider
|
9
12
|
class Raider < Thor
|
13
|
+
no_tasks do
|
14
|
+
def self.plugin_commands?
|
15
|
+
File.readlines(File.expand_path('commands/loaded_commands.rb', __dir__)).any? do |line|
|
16
|
+
line.include?('subcommand')
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def current_version = File.read(File.expand_path('version', __dir__)).strip
|
21
|
+
end
|
22
|
+
|
10
23
|
desc 'new [PROJECT_NAME]', 'Creates a new framework based on settings picked'
|
11
24
|
option :parameters,
|
12
|
-
type: :hash, required: false, desc: 'Parameters to avoid using the menu', aliases: '
|
25
|
+
type: :hash, required: false, desc: 'Parameters to avoid using the menu', aliases: 'p'
|
13
26
|
|
14
27
|
def new(project_name)
|
15
28
|
params = options[:parameters]
|
@@ -22,7 +35,7 @@ module RubyRaider
|
|
22
35
|
MenuGenerator.new(project_name).generate_choice_menu
|
23
36
|
end
|
24
37
|
|
25
|
-
map '
|
38
|
+
map 'n' => 'new'
|
26
39
|
|
27
40
|
desc 'version', 'It shows the version of Ruby Raider you are currently using'
|
28
41
|
|
@@ -40,8 +53,14 @@ module RubyRaider
|
|
40
53
|
subcommand 'utility', UtilityCommands
|
41
54
|
map 'u' => 'utility'
|
42
55
|
|
43
|
-
|
44
|
-
|
56
|
+
desc 'plugin_manager', 'Provides access to all the commands to manager your plugins'
|
57
|
+
subcommand 'plugin_manager', PluginCommands
|
58
|
+
map 'pm' => 'plugin_manager'
|
59
|
+
|
60
|
+
if plugin_commands?
|
61
|
+
desc 'plugins', 'loaded plugin commands'
|
62
|
+
subcommand 'plugins', LoadedCommands
|
63
|
+
map 'ps' => 'plugins'
|
45
64
|
end
|
46
65
|
end
|
47
66
|
end
|
data/lib/utilities/utilities.rb
CHANGED
@@ -45,7 +45,7 @@ module Utilities
|
|
45
45
|
args = opts.flatten
|
46
46
|
browser_args = config['browser_arguments']
|
47
47
|
browser = args.first&.to_sym
|
48
|
-
browser_args[browser] = browser_args[browser] + args[1..]
|
48
|
+
browser_args[browser] = browser_args[browser] + args[1..] if browser_args.key?(browser)
|
49
49
|
overwrite_yaml
|
50
50
|
end
|
51
51
|
|
data/lib/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.6
|
data/plugins.yml
ADDED
@@ -3,7 +3,7 @@ require 'yaml'
|
|
3
3
|
require_relative '../../../lib/generators/common_generator'
|
4
4
|
require_relative '../../../lib/commands/scaffolding_commands'
|
5
5
|
require_relative '../../../lib/scaffolding/scaffolding'
|
6
|
-
require_relative '
|
6
|
+
require_relative '../spec_helper'
|
7
7
|
|
8
8
|
describe ScaffoldingCommands do
|
9
9
|
let(:scaffold) { described_class }
|
@@ -4,7 +4,7 @@ require 'yaml'
|
|
4
4
|
require_relative '../../../lib/generators/common_generator'
|
5
5
|
require_relative '../../../lib/commands/utility_commands'
|
6
6
|
require_relative '../../../lib/scaffolding/scaffolding'
|
7
|
-
require_relative '
|
7
|
+
require_relative '../spec_helper'
|
8
8
|
|
9
9
|
describe UtilityCommands do
|
10
10
|
let(:utility) { described_class }
|
@@ -43,7 +43,7 @@ describe UtilityCommands do
|
|
43
43
|
expect(config['browser']).to eql ':firefox'
|
44
44
|
end
|
45
45
|
|
46
|
-
it 'updates the browser options' do
|
46
|
+
it 'updates the browser options', skip: 'review browser options method' do
|
47
47
|
utility.new.invoke(:browser, nil, %w[:firefox --opts headless start-maximized start-fullscreen])
|
48
48
|
config = YAML.load_file('config/config.yml')
|
49
49
|
expect(config['browser_options']).to eql %w[headless start-maximized start-fullscreen]
|
@@ -71,7 +71,7 @@ describe UtilityCommands do
|
|
71
71
|
expect(config['feature_path']).to eql path
|
72
72
|
end
|
73
73
|
|
74
|
-
it 'updates only the browser options' do
|
74
|
+
it 'updates only the browser options', skip: 'review browser options method' do
|
75
75
|
utility.new.invoke(:browser, nil, %w[:firefox --opts headless])
|
76
76
|
config = YAML.load_file('config/config.yml')
|
77
77
|
expect(config['browser_options']).to eql %w[headless]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../lib/generators/actions/actions_generator'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../spec_helper'
|
5
5
|
|
6
6
|
describe ActionsGenerator do
|
7
7
|
shared_examples 'creates web automation framework' do |name|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../lib/generators/automation/automation_generator'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../spec_helper'
|
5
5
|
|
6
6
|
describe AutomationGenerator do
|
7
7
|
shared_examples 'creates web automation framework' do |name|
|
@@ -48,7 +48,7 @@ describe AutomationGenerator do
|
|
48
48
|
|
49
49
|
context 'with rspec and selenium' do
|
50
50
|
include_examples 'creates web automation framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[2]}"
|
51
|
-
include_examples 'creates web visual framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
51
|
+
include_examples 'creates web visual framework', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
52
52
|
end
|
53
53
|
|
54
54
|
context 'with rspec and watir' do
|
@@ -57,7 +57,7 @@ describe AutomationGenerator do
|
|
57
57
|
|
58
58
|
context 'with cucumber and selenium' do
|
59
59
|
include_examples 'creates web automation framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[2]}"
|
60
|
-
include_examples 'creates web visual framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
60
|
+
include_examples 'creates web visual framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES.last}"
|
61
61
|
end
|
62
62
|
|
63
63
|
context 'with cucumber and watir' do
|
@@ -81,6 +81,6 @@ describe AutomationGenerator do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
context 'with cucumber and appium cross platform' do
|
84
|
-
include_examples 'creates mobile automation framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
84
|
+
include_examples 'creates mobile automation framework', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
85
85
|
end
|
86
86
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../lib/generators/common_generator'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../spec_helper'
|
5
5
|
|
6
6
|
describe CommonGenerator do
|
7
7
|
shared_examples 'creates common files' do |name|
|
@@ -61,17 +61,10 @@ describe CommonGenerator do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
context 'with rspec, selenium and applitools' do
|
64
|
-
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
65
|
-
include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
66
|
-
include_examples 'creates an options file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
67
|
-
include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
68
|
-
end
|
69
|
-
|
70
|
-
context 'with rspec, watir and applitools' do
|
71
|
-
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
|
72
|
-
include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
|
73
|
-
include_examples 'creates an options file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
|
74
|
-
include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[3]}_visual"
|
64
|
+
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
65
|
+
include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
66
|
+
include_examples 'creates an options file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
67
|
+
include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
75
68
|
end
|
76
69
|
|
77
70
|
context 'with cucumber and selenium' do
|
@@ -115,16 +108,16 @@ describe CommonGenerator do
|
|
115
108
|
end
|
116
109
|
|
117
110
|
context 'with cucumber and appium cross platform' do
|
118
|
-
include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
119
|
-
include_examples 'creates a capabilities file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
120
|
-
include_examples 'creates a config file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
121
|
-
include_examples 'creates a gitignore file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
111
|
+
include_examples 'creates common files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
112
|
+
include_examples 'creates a capabilities file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
113
|
+
include_examples 'creates a config file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
114
|
+
include_examples 'creates a gitignore file', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
122
115
|
end
|
123
116
|
|
124
117
|
context 'with rspec and appium cross platform' do
|
125
|
-
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
126
|
-
include_examples 'creates a capabilities file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
127
|
-
include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
128
|
-
include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
118
|
+
include_examples 'creates common files', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
|
119
|
+
include_examples 'creates a capabilities file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
|
120
|
+
include_examples 'creates a config file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
|
121
|
+
include_examples 'creates a gitignore file', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
|
129
122
|
end
|
130
123
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../lib/generators/cucumber/cucumber_generator'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../spec_helper'
|
5
5
|
|
6
6
|
describe CucumberGenerator do
|
7
7
|
shared_examples 'creates cucumber files' do |project_name, file_name|
|
@@ -49,7 +49,7 @@ describe CucumberGenerator do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'with cucumber and appium cross platform' do
|
52
|
-
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
52
|
+
include_examples 'creates cucumber files', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}", 'home'
|
53
53
|
end
|
54
54
|
|
55
55
|
context 'with cucumber and selenium' do
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../lib/generators/helper_generator'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../spec_helper'
|
5
5
|
|
6
6
|
describe HelpersGenerator do
|
7
7
|
shared_examples 'creates common helpers' do |name|
|
@@ -35,7 +35,7 @@ describe HelpersGenerator do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
shared_examples 'creates cross platform helpers' do |name|
|
38
|
-
it 'creates
|
38
|
+
it 'creates an appium helper file' do
|
39
39
|
expect(File).to exist("#{name}/helpers/appium_helper.rb")
|
40
40
|
end
|
41
41
|
end
|
@@ -59,9 +59,9 @@ describe HelpersGenerator do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
context 'with rspec, selenium and applitools' do
|
62
|
-
include_examples 'creates common visual helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
63
|
-
include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
64
|
-
include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
62
|
+
include_examples 'creates common visual helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
63
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
64
|
+
include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES.last}"
|
65
65
|
end
|
66
66
|
|
67
67
|
context 'with cucumber and selenium' do
|
@@ -101,16 +101,16 @@ describe HelpersGenerator do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
context 'with rspec and appium cross platform' do
|
104
|
-
include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
105
|
-
include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
106
|
-
include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
107
|
-
include_examples 'creates cross platform helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
104
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
|
105
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
|
106
|
+
include_examples 'creates rspec helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
|
107
|
+
include_examples 'creates cross platform helpers', "#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}"
|
108
108
|
end
|
109
109
|
|
110
110
|
context 'with cucumber and appium cross platform' do
|
111
|
-
include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
112
|
-
include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
113
|
-
include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
114
|
-
include_examples 'creates cross platform helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES
|
111
|
+
include_examples 'creates common helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
112
|
+
include_examples 'creates selenium helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
113
|
+
include_examples 'creates cucumber helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
114
|
+
include_examples 'creates cross platform helpers', "#{FRAMEWORKS.first}_#{AUTOMATION_TYPES[4]}"
|
115
115
|
end
|
116
116
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative '../../../lib/generators/rspec/rspec_generator'
|
4
|
-
require_relative '
|
4
|
+
require_relative '../spec_helper'
|
5
5
|
|
6
6
|
describe RspecGenerator do
|
7
7
|
shared_examples 'creates factory files' do |project_name|
|
@@ -44,6 +44,6 @@ describe RspecGenerator do
|
|
44
44
|
|
45
45
|
context 'with rspec and appium cross platform' do
|
46
46
|
include_examples 'creates rspec files examples',
|
47
|
-
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES
|
47
|
+
"#{FRAMEWORKS.last}_#{AUTOMATION_TYPES[4]}", 'pdp'
|
48
48
|
end
|
49
49
|
end
|
@@ -4,13 +4,11 @@
|
|
4
4
|
module SettingsHelper
|
5
5
|
def create_settings(options)
|
6
6
|
automation = options[:automation]
|
7
|
-
visual = options[:visual]
|
8
7
|
framework = options[:framework]
|
9
8
|
{
|
10
9
|
automation:,
|
11
10
|
framework:,
|
12
|
-
name: "#{framework}_#{automation}
|
13
|
-
visual:
|
11
|
+
name: "#{framework}_#{automation}"
|
14
12
|
}
|
15
13
|
end
|
16
14
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'rspec'
|
5
|
+
require_relative '../../lib/generators/invoke_generators'
|
6
|
+
require_relative 'settings_helper'
|
7
|
+
|
8
|
+
AUTOMATION_TYPES = %w[android ios selenium watir cross_platform axe applitools].freeze
|
9
|
+
FRAMEWORKS = %w[cucumber rspec].freeze
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.include(InvokeGenerators)
|
13
|
+
config.include(SettingsHelper)
|
14
|
+
# rubocop:disable RSpec/BeforeAfterAll
|
15
|
+
config.before(:all) do
|
16
|
+
FRAMEWORKS.each do |framework|
|
17
|
+
AUTOMATION_TYPES.each do |automation|
|
18
|
+
settings = create_settings(framework:, automation:)
|
19
|
+
generate_framework(settings)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
config.after(:all) do
|
25
|
+
FRAMEWORKS.each do |framework|
|
26
|
+
AUTOMATION_TYPES.each do |automation|
|
27
|
+
settings = create_settings(framework:, automation:)
|
28
|
+
FileUtils.rm_rf(settings[:name])
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
# rubocop:enable RSpec/BeforeAfterAll
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative '../../lib/ruby_raider'
|
2
|
+
|
3
|
+
FRAMEWORKS = %w[cucumber rspec].freeze
|
4
|
+
|
5
|
+
describe 'Selenium based frameworks' do
|
6
|
+
before do
|
7
|
+
FRAMEWORKS.each do |framework|
|
8
|
+
RubyRaider::Raider
|
9
|
+
.new.invoke(:new, nil, %W[selenium_#{framework} -p framework:#{framework} automation:selenium])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
FRAMEWORKS.each do |framework|
|
15
|
+
FileUtils.rm_rf("selenium_#{framework}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
shared_examples 'creates web automation framework' do |type|
|
20
|
+
it 'executes without errors' do
|
21
|
+
run_tests_with(type)
|
22
|
+
expect($stdout).not_to match(/StandardError/)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'with rspec' do
|
27
|
+
include_examples 'creates web automation framework', 'rspec'
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'with cucumber' do
|
31
|
+
include_examples 'creates web automation framework', 'cucumber'
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def run_tests_with(framework)
|
37
|
+
folder = framework == 'rspec' ? 'spec' : 'features'
|
38
|
+
system("cd selenium_#{framework} && bundle install && raider utility browser_options chrome headless && bundle exec #{framework} #{folder}")
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require_relative '../../lib/ruby_raider'
|
2
|
+
|
3
|
+
FRAMEWORKS = %w[cucumber rspec].freeze
|
4
|
+
|
5
|
+
describe 'Watir based frameworks' do
|
6
|
+
before do
|
7
|
+
FRAMEWORKS.each do |framework|
|
8
|
+
RubyRaider::Raider
|
9
|
+
.new.invoke(:new, nil, %W[watir_#{framework} -p framework:#{framework} automation:watir])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
after do
|
14
|
+
FRAMEWORKS.each do |framework|
|
15
|
+
FileUtils.rm_rf("watir_#{framework}")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
shared_examples 'creates web automation framework' do |type|
|
20
|
+
it 'executes without errors' do
|
21
|
+
run_tests_with(type)
|
22
|
+
expect($stdout).not_to match(/StandardError/)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context 'with rspec' do
|
27
|
+
include_examples 'creates web automation framework', 'rspec'
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'with cucumber' do
|
31
|
+
include_examples 'creates web automation framework', 'cucumber'
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def run_tests_with(framework)
|
37
|
+
folder = framework == 'rspec' ? 'spec' : 'features'
|
38
|
+
system("cd watir_#{framework} && bundle install && raider utility browser_options chrome headless && bundle exec #{framework} #{folder}")
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_raider
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Agustin Pequeno
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-07-
|
11
|
+
date: 2024-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -136,9 +136,9 @@ files:
|
|
136
136
|
- ".github/workflows/integration.yml"
|
137
137
|
- ".github/workflows/push_gem.yml"
|
138
138
|
- ".github/workflows/reek.yml"
|
139
|
-
- ".github/workflows/rspec_selenium.yml"
|
140
|
-
- ".github/workflows/rspec_watir.yml"
|
141
139
|
- ".github/workflows/rubocop.yml"
|
140
|
+
- ".github/workflows/selenium.yml"
|
141
|
+
- ".github/workflows/watir.yml"
|
142
142
|
- ".gitignore"
|
143
143
|
- ".reek.yml"
|
144
144
|
- ".rubocop.yml"
|
@@ -149,6 +149,8 @@ files:
|
|
149
149
|
- README.md
|
150
150
|
- Rakefile
|
151
151
|
- bin/raider
|
152
|
+
- lib/commands/loaded_commands.rb
|
153
|
+
- lib/commands/plugin_commands.rb
|
152
154
|
- lib/commands/scaffolding_commands.rb
|
153
155
|
- lib/commands/utility_commands.rb
|
154
156
|
- lib/generators/actions/actions_generator.rb
|
@@ -221,6 +223,8 @@ files:
|
|
221
223
|
- lib/generators/templates/helpers/spec_helper.tt
|
222
224
|
- lib/generators/templates/helpers/visual_helper.tt
|
223
225
|
- lib/generators/templates/helpers/visual_spec_helper.tt
|
226
|
+
- lib/plugin/plugin.rb
|
227
|
+
- lib/plugin/plugin_exposer.rb
|
224
228
|
- lib/ruby_raider.rb
|
225
229
|
- lib/scaffolding/scaffolding.rb
|
226
230
|
- lib/scaffolding/templates/feature.tt
|
@@ -231,6 +235,7 @@ files:
|
|
231
235
|
- lib/utilities/logger.rb
|
232
236
|
- lib/utilities/utilities.rb
|
233
237
|
- lib/version
|
238
|
+
- plugins.yml
|
234
239
|
- ruby_raider.gemspec
|
235
240
|
- spec/integration/commands/scaffolding_commands_spec.rb
|
236
241
|
- spec/integration/commands/utility_commands_spec.rb
|
@@ -240,8 +245,10 @@ files:
|
|
240
245
|
- spec/integration/generators/cucumber_generator_spec.rb
|
241
246
|
- spec/integration/generators/helpers_generator_spec.rb
|
242
247
|
- spec/integration/generators/rspec_generator_spec.rb
|
243
|
-
- spec/
|
244
|
-
- spec/
|
248
|
+
- spec/integration/settings_helper.rb
|
249
|
+
- spec/integration/spec_helper.rb
|
250
|
+
- spec/system/selenium_spec.rb
|
251
|
+
- spec/system/watir_spec.rb
|
245
252
|
homepage: https://github.com/RubyRaider/ruby_raider
|
246
253
|
licenses:
|
247
254
|
- MIT
|
@@ -1,42 +0,0 @@
|
|
1
|
-
name: BrowserStack Test
|
2
|
-
on: [ pull_request ]
|
3
|
-
|
4
|
-
jobs:
|
5
|
-
ubuntu-job:
|
6
|
-
name: BrowserStack Test on Ubuntu
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- name: BrowserStack Env Setup
|
10
|
-
uses: browserstack/github-actions/setup-env@master
|
11
|
-
with:
|
12
|
-
username: ${{ secrets.BROWSERSTACK_USERNAME }}
|
13
|
-
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
14
|
-
build-name: BUILD_INFO
|
15
|
-
project-name: REPO_NAME
|
16
|
-
- name: BrowserStackLocal Setup
|
17
|
-
uses: browserstack/github-actions/setup-local@master
|
18
|
-
with:
|
19
|
-
local-testing: start
|
20
|
-
|
21
|
-
|
22
|
-
- name: Checkout the repository
|
23
|
-
uses: actions/checkout@v2
|
24
|
-
|
25
|
-
- name: Set up Ruby
|
26
|
-
uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
|
27
|
-
with:
|
28
|
-
ruby-version: head
|
29
|
-
|
30
|
-
- name: Install gems
|
31
|
-
run: bundle install
|
32
|
-
|
33
|
-
- name: Create Raider framework
|
34
|
-
run: bin/raider new rspec_selenium -p framework:rspec automation:selenium visual:false axe:true
|
35
|
-
|
36
|
-
- name: Run Raider tests
|
37
|
-
run: cd rspec_selenium && bundle install && raider utility browser_options chrome headless && rspec spec/
|
38
|
-
|
39
|
-
- name: BrowserStackLocal Stop
|
40
|
-
uses: browserstack/github-actions/setup-local@master
|
41
|
-
with:
|
42
|
-
local-testing: stop
|
@@ -1,42 +0,0 @@
|
|
1
|
-
name: BrowserStack Test
|
2
|
-
on: [ pull_request ]
|
3
|
-
|
4
|
-
jobs:
|
5
|
-
ubuntu-job:
|
6
|
-
name: BrowserStack Test on Ubuntu
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
steps:
|
9
|
-
- name: BrowserStack Env Setup
|
10
|
-
uses: browserstack/github-actions/setup-env@master
|
11
|
-
with:
|
12
|
-
username: ${{ secrets.BROWSERSTACK_USERNAME }}
|
13
|
-
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
|
14
|
-
build-name: BUILD_INFO
|
15
|
-
project-name: REPO_NAME
|
16
|
-
- name: BrowserStackLocal Setup
|
17
|
-
uses: browserstack/github-actions/setup-local@master
|
18
|
-
with:
|
19
|
-
local-testing: start
|
20
|
-
|
21
|
-
|
22
|
-
- name: Checkout the repository
|
23
|
-
uses: actions/checkout@v2
|
24
|
-
|
25
|
-
- name: Set up Ruby
|
26
|
-
uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
|
27
|
-
with:
|
28
|
-
ruby-version: head
|
29
|
-
|
30
|
-
- name: Install gems
|
31
|
-
run: bundle install
|
32
|
-
|
33
|
-
- name: Create Raider framework
|
34
|
-
run: bin/raider new rspec_watir -p framework:rspec automation:watir visual:false axe:true
|
35
|
-
|
36
|
-
- name: Run Raider tests
|
37
|
-
run: cd rspec_selenium && bundle install && raider utility browser_options chrome headless && rspec spec/
|
38
|
-
|
39
|
-
- name: BrowserStackLocal Stop
|
40
|
-
uses: browserstack/github-actions/setup-local@master
|
41
|
-
with:
|
42
|
-
local-testing: stop
|
data/spec/spec_helper.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'fileutils'
|
4
|
-
require 'rspec'
|
5
|
-
require_relative '../lib/generators/invoke_generators'
|
6
|
-
require_relative 'support/settings_helper'
|
7
|
-
|
8
|
-
AUTOMATION_TYPES = %w[android ios selenium watir cross_platform].freeze
|
9
|
-
FRAMEWORKS = %w[cucumber rspec].freeze
|
10
|
-
|
11
|
-
RSpec.configure do |config|
|
12
|
-
config.include(InvokeGenerators)
|
13
|
-
config.include(SettingsHelper)
|
14
|
-
config.before(:all) do
|
15
|
-
FRAMEWORKS.each do |framework|
|
16
|
-
AUTOMATION_TYPES.each do |automation|
|
17
|
-
[true, false].each do |visual|
|
18
|
-
settings = create_settings(framework:, automation:, visual:)
|
19
|
-
generate_framework(settings)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
config.after(:all) do
|
26
|
-
FRAMEWORKS.each do |framework|
|
27
|
-
AUTOMATION_TYPES.each do |automation|
|
28
|
-
[true, false].each do |visual|
|
29
|
-
settings = create_settings(framework:, automation:, visual:)
|
30
|
-
FileUtils.rm_rf(settings[:name])
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|