ruby_raider 0.8.9 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72f4f4c7e7650bfc8e0e0e310c5ead22bd5ccbdf482c138d1c806ea7d0792f39
4
- data.tar.gz: cca704db232dc1a96f740f7ba5355ab5c999f0f1c40c858362bb18aea6b39081
3
+ metadata.gz: cbe1cdaadd5277a886b3e916c4de3f9982eb362252283f9403bbe2905df995b5
4
+ data.tar.gz: e16f7436c7c9f558c751f404428e9494e608da7e6deb8117f1b9a6692720a942
5
5
  SHA512:
6
- metadata.gz: '0394034b63ea2cf8492ee8a7de03af6d3a18b13c2de3fe6167cdf6cb8b76eeb11bf7bd8bd67ebd76a37e3cac156e661898eb79e840f3819d1b2e95c1ebce53b7'
7
- data.tar.gz: be7be6a039005affeb510db66601d7bf8f63ca0c7deb7aa9e7c03521bde212d5f4e31bbb30988757af5b198c96435ccd7358c72c0fe111b04618c6d68f184ab5
6
+ metadata.gz: 4a97554b9b58002bce11b76c44f42710238b8e53dd2879fb677cae9cc87356190e2395369d1c2ae431a27e5d1d372f17d8a8cc563965a6bc1fb354b71ead6979
7
+ data.tar.gz: cabae226fd5666bbc9a3f2e10aff32f5bd4faa7712a9aefce7e9e81d87c26a454500af69993c527e33886daa6e622eb08ce49b428322b00fbe0e4bf3a5b34f7d
@@ -0,0 +1,42 @@
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
data/.rubocop.yml CHANGED
@@ -1,6 +1,9 @@
1
1
  require:
2
2
  - rubocop-rspec
3
3
 
4
+ AllCops:
5
+ TargetRubyVersion: 3.1.0
6
+
4
7
  # Layout
5
8
  Layout/CaseIndentation:
6
9
  Enabled: false
data/README.md CHANGED
@@ -82,6 +82,20 @@ selected.
82
82
 
83
83
  Select the ones you will like to work with.
84
84
 
85
+ If you already know which frameworks you want to use, you can do:
86
+
87
+ ```ruby
88
+ raider new [name_of_project] -p framework:[framework] automation:[automation_type] visual:[boolean] axe:[boolean]
89
+ ```
90
+
91
+ An example of the command above would be:
92
+
93
+ ```ruby
94
+ raider new test_project -p framework:rspec automation:selenium visual:false axe:true
95
+ ```
96
+
97
+ Where [frameworks] is a comma separated list of the frameworks you want to use.
98
+
85
99
  ### Ruby raider provides the following list of basic commands
86
100
 
87
101
  ###### Anything between square brackets([...]) is where your imput goes
data/Rakefile CHANGED
@@ -4,11 +4,6 @@ require_relative 'lib/ruby_raider'
4
4
  require_relative 'lib/commands/scaffolding_commands'
5
5
  require_relative 'lib/utilities/logger'
6
6
 
7
- desc 'Creates a new test project'
8
- task :new, [:name] do |_t, args|
9
- system "bin/raider -n #{args.name}"
10
- end
11
-
12
7
  desc 'Creates a page'
13
8
  task :page, [:name, :path] do |_t, args|
14
9
  ScaffoldingCommands.new.invoke(:page, nil, %W[:#{args.name} --path #{args.path}])
@@ -47,3 +42,8 @@ desc 'Runs system tests'
47
42
  task :system do |_t|
48
43
  system 'rspec spec/system'
49
44
  end
45
+
46
+ desc 'Create framework with parameters'
47
+ task :new, [:name, :params] do |_t, args|
48
+ system "bin/raider -n #{args.name} -p #{args.params}"
49
+ end
@@ -8,6 +8,8 @@ require_relative 'rspec/rspec_generator'
8
8
  # :reek:FeatureEnvy { enabled: false }
9
9
  # :reek:UtilityFunction { enabled: false }
10
10
  module InvokeGenerators
11
+ module_function
12
+
11
13
  def generate_framework(structure = {})
12
14
  generators = %w[Automation Actions Common Helpers]
13
15
  framework = structure[:framework]
@@ -15,11 +17,11 @@ module InvokeGenerators
15
17
  generators.each do |generator|
16
18
  invoke_generator({
17
19
  automation: structure[:automation],
18
- framework: framework,
19
- generator: generator,
20
+ framework:,
21
+ generator:,
20
22
  name: structure[:name],
21
- visual: structure[:visual],
22
- axe_support: structure[:axe_support]
23
+ visual: to_bool(structure[:visual]),
24
+ axe_support: to_bool(structure[:axe_support])
23
25
  })
24
26
  end
25
27
  end
@@ -36,4 +38,10 @@ module InvokeGenerators
36
38
  structure[:visual],
37
39
  structure[:axe_support]]).invoke_all
38
40
  end
41
+
42
+ def to_bool(string)
43
+ return unless string.is_a? String
44
+
45
+ string.downcase == 'true'
46
+ end
39
47
  end
@@ -85,7 +85,7 @@ class MenuGenerator
85
85
  axe = choose_axe_support if automation_type == 'selenium' && framework == 'Rspec' && visual_automation == false
86
86
  options = create_framework_options(automation: automation_type,
87
87
  framework: framework.downcase,
88
- visual_automation: visual_automation,
88
+ visual_automation:,
89
89
  axe_support: axe)
90
90
 
91
91
  # Print the chosen options
@@ -29,7 +29,7 @@ gem 'rubocop'
29
29
  <% if framework == 'rspec' -%>
30
30
  gem 'rubocop-rspec'
31
31
  <% end -%>
32
- gem 'ruby_raider', '~> 0.8.0'
32
+ gem 'ruby_raider', '~> 0.9.0'
33
33
  <%= ERB.new(File.read(File.expand_path('./partials/automation_gems.tt', __dir__))).result(binding).strip! %>
34
34
  <% if automation == 'sparkling_ios' -%>
35
35
  gem 'sparkling_watir'
@@ -76,6 +76,20 @@ selected.
76
76
 
77
77
  Select the ones you will like to work with.
78
78
 
79
+ If you already know which frameworks you want to use, you can do:
80
+
81
+ ```ruby
82
+ raider new [name_of_project] -p framework:[framework] automation:[automation_type] visual:[boolean] axe:[boolean]
83
+ ```
84
+
85
+ An example of the command above would be:
86
+
87
+ ```ruby
88
+ raider new test_project -p framework:rspec automation:selenium visual:false axe:true
89
+ ```
90
+
91
+ Where [frameworks] is a comma separated list of the frameworks you want to use.
92
+
79
93
  ### Ruby raider provides the following list of basic commands
80
94
 
81
95
  ###### Anything between square brackets([...]) is where your imput goes
data/lib/ruby_raider.rb CHANGED
@@ -8,8 +8,17 @@ require_relative '../lib/commands/utility_commands'
8
8
  module RubyRaider
9
9
  class Raider < Thor
10
10
  desc 'new [PROJECT_NAME]', 'Creates a new framework based on settings picked'
11
+ option :parameters,
12
+ type: :hash, required: false, desc: 'Parameters to avoid using the menu', aliases: '-p'
11
13
 
12
14
  def new(project_name)
15
+ params = options[:parameters]
16
+ if params
17
+ params[:name] = project_name
18
+ parsed_hash = params.transform_keys(&:to_sym)
19
+ return InvokeGenerators.generate_framework(parsed_hash)
20
+ end
21
+
13
22
  MenuGenerator.new(project_name).generate_choice_menu
14
23
  end
15
24
 
@@ -42,7 +42,9 @@ module Utilities
42
42
  end
43
43
 
44
44
  def browser_options=(*opts)
45
- config['browser_options'] = opts.flatten
45
+ args = opts.flatten
46
+ browser_args = config['browser_arguments']
47
+ browser_args[args.first&.to_sym] = browser_args + args[1..]
46
48
  overwrite_yaml
47
49
  end
48
50
 
data/lib/version CHANGED
@@ -1 +1 @@
1
- 0.8.9
1
+ 0.9.0
data/ruby_raider.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = 'agustin.pe94@gmail.com'
10
10
  s.homepage = 'https://github.com/RubyRaider/ruby_raider'
11
11
  s.license = 'MIT'
12
- s.required_ruby_version = '>= 3.0.0'
12
+ s.required_ruby_version = '>= 3.1.0'
13
13
  s.files = `git ls-files -z`.split("\x0")
14
14
  s.bindir = 'bin'
15
15
  s.executables << 'raider'
data/spec/spec_helper.rb CHANGED
@@ -15,7 +15,7 @@ RSpec.configure do |config|
15
15
  FRAMEWORKS.each do |framework|
16
16
  AUTOMATION_TYPES.each do |automation|
17
17
  [true, false].each do |visual|
18
- settings = create_settings(framework: framework, automation: automation, visual: visual, axe: axe_support)
18
+ settings = create_settings(framework:, automation:, visual:)
19
19
  generate_framework(settings)
20
20
  end
21
21
  end
@@ -26,7 +26,7 @@ RSpec.configure do |config|
26
26
  FRAMEWORKS.each do |framework|
27
27
  AUTOMATION_TYPES.each do |automation|
28
28
  [true, false].each do |visual|
29
- settings = create_settings(framework: framework, automation: automation, visual: visual)
29
+ settings = create_settings(framework:, automation:, visual:)
30
30
  FileUtils.rm_rf(settings[:name])
31
31
  end
32
32
  end
@@ -7,10 +7,10 @@ module SettingsHelper
7
7
  visual = options[:visual]
8
8
  framework = options[:framework]
9
9
  {
10
- automation: automation,
11
- framework: framework,
10
+ automation:,
11
+ framework:,
12
12
  name: "#{framework}_#{automation}#{'_visual' if visual}",
13
- visual: visual
13
+ visual:
14
14
  }
15
15
  end
16
16
  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.8.9
4
+ version: 0.9.0
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-06-16 00:00:00.000000000 Z
11
+ date: 2024-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -150,8 +150,8 @@ files:
150
150
  - ".github/workflows/integration.yml"
151
151
  - ".github/workflows/push_gem.yml"
152
152
  - ".github/workflows/reek.yml"
153
+ - ".github/workflows/rspec_selenium.yml"
153
154
  - ".github/workflows/rubocop.yml"
154
- - ".github/workflows/system.yml"
155
155
  - ".gitignore"
156
156
  - ".reek.yml"
157
157
  - ".rubocop.yml"
@@ -268,14 +268,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
268
268
  requirements:
269
269
  - - ">="
270
270
  - !ruby/object:Gem::Version
271
- version: 3.0.0
271
+ version: 3.1.0
272
272
  required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  requirements:
274
274
  - - ">="
275
275
  - !ruby/object:Gem::Version
276
276
  version: '0'
277
277
  requirements: []
278
- rubygems_version: 3.5.3
278
+ rubygems_version: 3.5.0.dev
279
279
  signing_key:
280
280
  specification_version: 4
281
281
  summary: A gem to make setup and start of UI automation projects easier
@@ -1,29 +0,0 @@
1
- env:
2
- NAME: 'CI'
3
-
4
- name: System tests
5
-
6
- on:
7
- push:
8
- branches:
9
- - master
10
-
11
- jobs:
12
- build:
13
- name: System pipeline
14
- runs-on: ubuntu-latest
15
-
16
- steps:
17
- - name: Set up Ruby
18
- uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
19
- with:
20
- ruby-version: head
21
-
22
- - name: Checkout repository
23
- uses: actions/checkout@v3
24
-
25
- - name: Install gems
26
- run: bundle install
27
-
28
- - name: Build and run system tests
29
- run: rake system