ruby_raider 0.2.5 → 0.2.8

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: 7988213b2be1daa32759ff975e5dca3ffd00705745ea9e0f78fdfb1f0148cbc8
4
- data.tar.gz: 59324df2b000cfe2687b4ed02bd005577236aa36d2ac8069d52c87f4d5d5a4b1
3
+ metadata.gz: e2b456b6b2d262b4d8f5a0667a0bcbb53f46803f00e5f01f7439422d074fafc3
4
+ data.tar.gz: 87c94fd901ea5ef4d89f3364e0f2d0cfdcacb60319114df1ee0feb1731130fc1
5
5
  SHA512:
6
- metadata.gz: a9c95ba5afce93e67e7f7f563d96228ec34d3f91b093e6eb7168c1c56a421ab887c2aa1df4e29da89ea17a18ad9e72857b17c535762b9a519e459bc205393151
7
- data.tar.gz: 58ce8f269ef6972486473f3b710ad0060d3b40144d6874b3fadc6a4420a4f9f54d7b43ce996a542e3ea0ec28ea83edf333ba14e445f276c2ea59a08bf4ce0cf5
6
+ metadata.gz: deccd21387b863799b45987a96d72da3958181cbaf165fc3fdef651b151a74ca23d2cf2e286331649aca646dad8212f34b932258085219a08f13024411d9ee07
7
+ data.tar.gz: '084c6a8df157afa64bf1f197781d121b822cf5e2eca1e0204c13899118a5af8ac51b87a8b6dfd17f54e9545fd75bd98c07d0c6f8767a312e2a95173db36a9751'
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # ruby_raider
2
- This is a gem to make setup and start of UI automation projects easier
2
+ This is a gem to make setup and start of UI automation projects easier
3
+ You can find more information and updates on releaseas in : https://ruby-raider.com/
3
4
 
4
5
  Just do:
5
6
 
@@ -7,7 +8,7 @@ Just do:
7
8
 
8
9
  then do:
9
10
 
10
- **raider [name_of_project]**
11
+ **raider new [name_of_project]**
11
12
 
12
13
  and you will have a new project in the folder you are in
13
14
 
@@ -1,4 +1,4 @@
1
- require 'rspec'
1
+ require 'yaml'
2
2
  <%= ERB.new(File.read(File.expand_path('./partials/require_raider.tt', __dir__)), nil, '-').result(binding) -%>
3
3
 
4
4
  class AbstractPage
@@ -4,7 +4,7 @@
4
4
  end
5
5
 
6
6
  def base_url
7
- 'https://automationteststore.com/'
7
+ YAML.load_file('config/config.yml')['url']
8
8
  end
9
9
 
10
10
  def url(_page)
@@ -1 +1,2 @@
1
1
  browser: :chrome
2
+ url: 'https://automationteststore.com/'
@@ -12,8 +12,8 @@ gem 'rake'
12
12
  gem '<%= framework %>'
13
13
  <% if framework == 'cucumber' -%>
14
14
  gem 'rspec'
15
- gem 'ruby_raider'
16
15
  <% end -%>
16
+ gem 'ruby_raider'
17
17
  <%= ERB.new(File.read(File.expand_path('./partials/automation_gems.tt', __dir__))).result(binding).strip! %>
18
18
  <% if %w[selenium watir].include? automation -%>
19
19
  gem 'webdrivers'
@@ -10,9 +10,9 @@ module Raider
10
10
  class << self
11
11
  attr_reader :browser
12
12
 
13
- def new_browser
14
- config = YAML.load_file('config/config.yml')
15
- @browser = Watir::Browser.new config['browser']
13
+ def new_browser(options = {})
14
+ browser = YAML.load_file('config/config.yml')['browser'].to_sym
15
+ @browser = Watir::Browser.new(browser, options: browser_opts)
16
16
  end
17
17
  end
18
18
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
-
2
+ require 'yaml'
3
3
  <% if automation == 'selenium' -%>
4
4
  require 'webdrivers'
5
5
  <% else -%>
@@ -1,6 +1,7 @@
1
1
  <% if automation == 'selenium' %>
2
- def new_driver
3
- @driver = Selenium::WebDriver.for :chrome
2
+ def new_driver(caps = {})
3
+ browser = YAML.load_file('config/config.yml')['browser'].to_sym
4
+ @driver = Selenium::WebDriver.for(browser, desired_capabilities: caps)
4
5
  end
5
6
  <% else %>
6
7
  def new_driver
data/lib/ruby_raider.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+ require 'yaml'
2
3
  require_relative 'generators/menu_generator'
3
4
  require_relative '../lib/scaffolding/scaffolding'
4
5
  require_relative '../lib/utilities/utilities'
@@ -11,31 +12,42 @@ class RubyRaider < Thor
11
12
 
12
13
  desc "page [PAGE_NAME]", "Creates a new page object"
13
14
  def page(name)
14
- Scaffolding.new([name]).generate_class
15
+ Scaffolding.new([name, load_config_path]).generate_class
15
16
  end
16
17
 
17
18
  desc "feature [FEATURE_NAME]", "Creates a new feature"
18
19
  def feature(name)
19
- Scaffolding.new([name]).generate_feature
20
+ Scaffolding.new([name, load_config_path]).generate_feature
20
21
  end
21
22
 
22
23
  desc "spec [SPEC_NAME]", "Creates a new spec"
23
24
  def spec(name)
24
- Scaffolding.new([name]).generate_spec
25
+ Scaffolding.new([name, load_config_path]).generate_spec
25
26
  end
26
27
 
27
28
  desc "path [PATH]", "Sets the default path for scaffolding"
28
29
  def path(default_path)
29
- Utilities.path = default_path
30
+ Utilities.new.path = default_path
30
31
  end
31
32
 
32
33
  desc "url [URL]", "Sets the default url for a project"
33
34
  def url(default_url)
34
- Utilities.url = default_url
35
+ Utilities.new.url = default_url
35
36
  end
36
37
 
37
38
  desc "browser [BROWSER]", "Sets the default browser for a project"
38
39
  def browser(default_browser)
39
- Utilities.browser = default_browser
40
+ Utilities.new.browser = default_browser
41
+ end
42
+
43
+ desc "raid", "It runs all the tests in a project"
44
+ def raid
45
+ Utilities.new.run
46
+ end
47
+
48
+ no_commands do
49
+ def load_config_path
50
+ YAML.load_file('config/config.yml')['path']
51
+ end
40
52
  end
41
53
  end
@@ -4,20 +4,25 @@ class Scaffolding < Thor::Group
4
4
  include Thor::Actions
5
5
 
6
6
  argument :name
7
+ argument :path, optional: true
7
8
 
8
9
  def self.source_root
9
10
  File.dirname(__FILE__) + '/templates'
10
11
  end
11
12
 
12
13
  def generate_class
13
- template('page_object.tt', "page_objects/pages/#{name}_page.rb")
14
+ template('page_object.tt', default_path("page_objects/pages/#{name}_page.rb") )
14
15
  end
15
16
 
16
17
  def generate_feature
17
- template('feature.tt', "features/#{name}.feature")
18
+ template('feature.tt', default_path("features/#{name}.feature"))
18
19
  end
19
20
 
20
21
  def generate_spec
21
- template('spec.tt', "./spec/#{name}_page.rb")
22
+ template('spec.tt', default_path("./spec/#{name}_page.rb"))
23
+ end
24
+
25
+ def default_path(standard_path)
26
+ path.nil? ? standard_path : "#{path}/#{name}"
22
27
  end
23
28
  end
@@ -1,17 +1,36 @@
1
- require 'thor'
1
+ require 'yaml'
2
2
 
3
- class Utilities < Thor::Group
4
- include Thor::Actions
3
+ class Utilities
5
4
 
6
- def browser=(browser)
5
+ def initialize
6
+ @path = 'config/config.yml'
7
+ @config = YAML.load_file(@path)
8
+ end
7
9
 
10
+ def browser=(browser)
11
+ @config['browser'] = browser
12
+ overwrite_yaml
8
13
  end
9
14
 
10
15
  def path=(path)
11
-
16
+ @config['path'] = path
17
+ overwrite_yaml
12
18
  end
13
19
 
14
20
  def url=(url)
21
+ @config['url'] = url
22
+ overwrite_yaml
23
+ end
24
+
25
+ def run
26
+ if File.directory? 'spec'
27
+ system 'rspec spec/'
28
+ else
29
+ system 'cucumber features'
30
+ end
31
+ end
15
32
 
33
+ def overwrite_yaml
34
+ File.open(@path, 'w') { |file| YAML.dump(@config, file) }
16
35
  end
17
36
  end
data/ruby_raider.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'ruby_raider'
5
- s.version = '0.2.5'
5
+ s.version = '0.2.8'
6
6
  s.summary = 'A gem to make setup and start of UI automation projects easier'
7
7
  s.description = 'This gem has everything you need to start working with test automation'
8
8
  s.authors = ['Agustin Pequeno']
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.2.5
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-25 00:00:00.000000000 Z
11
+ date: 2022-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake