ruby_raider 0.3.5 → 0.3.6
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 +4 -4
- data/.github/workflows/reek.yml +23 -0
- data/.github/workflows/rspec.yml +27 -0
- data/.github/workflows/rubocop.yml +28 -0
- data/.rubocop.yml +3 -1
- data/README.md +16 -10
- data/Rakefile +11 -7
- data/lib/commands/scaffolding_commands.rb +116 -0
- data/lib/commands/utility_commands.rb +67 -0
- data/lib/generators/menu_generator.rb +67 -52
- data/lib/generators/templates/cucumber/partials/watir_env.tt +1 -1
- data/lib/generators/templates/helpers/allure_helper.tt +1 -1
- data/lib/generators/templates/helpers/browser_helper.tt +3 -3
- data/lib/generators/templates/helpers/driver_helper.tt +2 -1
- data/lib/generators/templates/helpers/partials/driver_and_options.tt +25 -0
- data/lib/generators/templates/helpers/partials/screenshot.tt +3 -3
- data/lib/generators/templates/helpers/spec_helper.tt +1 -2
- data/lib/ruby_raider.rb +4 -147
- data/lib/scaffolding/scaffolding.rb +3 -3
- data/lib/utilities/utilities.rb +2 -2
- data/ruby_raider.gemspec +1 -1
- data/spec/{ruby_raider_spec.rb → scaffolding_spec.rb} +73 -78
- metadata +9 -4
- data/lib/generators/templates/helpers/partials/new_driver.tt +0 -14
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: aa0c6d643c3cde2157842b7627cd91377aab6e76d47f6f4136c14a6999eacedf
         | 
| 4 | 
            +
              data.tar.gz: 94105992da2846eb8585d10d8b2c471418b6c8544ef2db948ea3a62c950006d8
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9ab37f89743262fa6fddfa3a72791e118bfb46f01596177cc488f9900207835ddf4478dd16f53d017ca58d1e11a72f7e4431a64035f25c8958949e1d2934bef9
         | 
| 7 | 
            +
              data.tar.gz: ea715071ad366384139705627bf4ad0b5bee9665d3ee3dc4853debc735acea6ebc1ae32860188cf235bb62da47463bb97ac3c17d2509a99f76067fe4500270c5
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            name: Reek Code Review
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on: [pull_request]
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            jobs:
         | 
| 6 | 
            +
              reek:
         | 
| 7 | 
            +
                name: runner / reek
         | 
| 8 | 
            +
                runs-on: ubuntu-latest
         | 
| 9 | 
            +
                steps:
         | 
| 10 | 
            +
                  - name: Set up Ruby
         | 
| 11 | 
            +
                    uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
         | 
| 12 | 
            +
                    with:
         | 
| 13 | 
            +
                      ruby-version: head
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  - name: Check out code
         | 
| 16 | 
            +
                    uses: actions/checkout@v1
         | 
| 17 | 
            +
                      
         | 
| 18 | 
            +
                  - name: reek
         | 
| 19 | 
            +
                    uses: reviewdog/action-reek@v1
         | 
| 20 | 
            +
                    with:
         | 
| 21 | 
            +
                      reek_version: gemfile
         | 
| 22 | 
            +
                      reporter: github-pr-review # Default is github-pr-check
         | 
| 23 | 
            +
                      fail_on_error: true
         | 
| @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            name: Rspec Tests
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              push:
         | 
| 5 | 
            +
                branches: [ "*" ]
         | 
| 6 | 
            +
              pull_request:
         | 
| 7 | 
            +
                branches: [ "*" ]
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            jobs:
         | 
| 10 | 
            +
              build:
         | 
| 11 | 
            +
                name: CI
         | 
| 12 | 
            +
                runs-on: ubuntu-latest
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                steps:
         | 
| 15 | 
            +
                  - name: Set up Ruby
         | 
| 16 | 
            +
                    uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
         | 
| 17 | 
            +
                    with:
         | 
| 18 | 
            +
                      ruby-version: head
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  - name: Checkout repository
         | 
| 21 | 
            +
                    uses: actions/checkout@v3
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                  - name: Install gems
         | 
| 24 | 
            +
                    run: bundle install
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                  - name: Build and test with rspec
         | 
| 27 | 
            +
                    run: bundle exec rspec spec
         | 
| @@ -0,0 +1,28 @@ | |
| 1 | 
            +
            name: Rubocop
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on: [pull_request]
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            permissions:
         | 
| 6 | 
            +
              contents: read
         | 
| 7 | 
            +
              pull-requests: write
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            jobs:
         | 
| 10 | 
            +
              rubocop:
         | 
| 11 | 
            +
                name: runner / rubocop
         | 
| 12 | 
            +
                runs-on: ubuntu-latest
         | 
| 13 | 
            +
                steps:
         | 
| 14 | 
            +
                  - name: Set up Ruby
         | 
| 15 | 
            +
                    uses: ruby/setup-ruby@f20f1eae726df008313d2e0d78c5e602562a1bcf
         | 
| 16 | 
            +
                    with:
         | 
| 17 | 
            +
                      ruby-version: head
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                  - name: Check out code
         | 
| 20 | 
            +
                    uses: actions/checkout@v1
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                  - name: rubocop
         | 
| 23 | 
            +
                    uses: reviewdog/action-rubocop@v2
         | 
| 24 | 
            +
                    with:
         | 
| 25 | 
            +
                      rubocop_version: gemfile
         | 
| 26 | 
            +
                      rubocop_extensions: rubocop-rspec:gemfile
         | 
| 27 | 
            +
                      reporter: github-pr-review # Default is github-pr-check
         | 
| 28 | 
            +
                      fail_on_error: true
         | 
    
        data/.rubocop.yml
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,7 +1,11 @@ | |
| 1 1 | 
             
            # Ruby Raider
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 3 | 
            +
            [](https://badge.fury.io/rb/ruby_raider)
         | 
| 4 | 
            +
            [](https://github.com/RubyRaider/ruby_raider/actions/workflows/rspec.yml)
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            This is a gem to make setup and start of UI automation projects easier.
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            You can find more information and updates on releases in : [https://ruby-raider.com/](https://ruby-raider.com/)
         | 
| 5 9 |  | 
| 6 10 | 
             
            Just do:
         | 
| 7 11 |  | 
| @@ -11,11 +15,11 @@ then do: | |
| 11 15 |  | 
| 12 16 | 
             
            **raider new [name_of_project]**
         | 
| 13 17 |  | 
| 14 | 
            -
            and you will have a new project in the folder you are in
         | 
| 18 | 
            +
            and you will have a new project in the folder you are in.
         | 
| 15 19 |  | 
| 16 20 | 
             
            Currently we support:
         | 
| 17 21 |  | 
| 18 | 
            -
            *  | 
| 22 | 
            +
            * Generating a framework with Cucumber and Selenium
         | 
| 19 23 |  | 
| 20 24 | 
             
            * Generating a framework with Rspec and Selenium
         | 
| 21 25 |  | 
| @@ -27,18 +31,20 @@ Currently we support: | |
| 27 31 |  | 
| 28 32 | 
             
            * Generating a framework with Cucumber and Appium for IOS
         | 
| 29 33 |  | 
| 30 | 
            -
            In order to run the  | 
| 34 | 
            +
            In order to run the Appium tests, download the example [app](https://github.com/cloudgrey-io/the-app/releases/tag/v1.10.0).
         | 
| 31 35 |  | 
| 32 | 
            -
            This works in all the platforms (Tested on Mac OS, Linux and Windows)
         | 
| 36 | 
            +
            This works in all the platforms (Tested on Mac OS, Linux and Windows).
         | 
| 33 37 |  | 
| 34 38 | 
             
            **Ruby raider provides the following list of commands**
         | 
| 35 39 | 
             
            ```
         | 
| 36 40 | 
             
            Commands:
         | 
| 37 41 | 
             
              raider browser [BROWSER]         # Sets the default browser for a project
         | 
| 38 42 |  | 
| 43 | 
            +
              raider browser_options [OPTIONS]  # Sets the browser options for the project
         | 
| 44 | 
            +
             | 
| 39 45 | 
             
              raider feature [FEATURE_NAME]    # Creates a new feature
         | 
| 40 46 |  | 
| 41 | 
            -
              raider help [COMMAND]            #  | 
| 47 | 
            +
              raider help [COMMAND]            # Describes available commands or one specific command
         | 
| 42 48 |  | 
| 43 49 | 
             
              raider helper [HELPER_NAME]      # Creates a new helper
         | 
| 44 50 |  | 
| @@ -48,9 +54,9 @@ Commands: | |
| 48 54 |  | 
| 49 55 | 
             
              raider path [PATH]               # Sets the default path for scaffolding
         | 
| 50 56 |  | 
| 51 | 
            -
              raider raid                      #  | 
| 57 | 
            +
              raider raid                      # Runs all the tests in a project
         | 
| 52 58 |  | 
| 53 | 
            -
              raider scaffold [SCAFFOLD_NAME]  #  | 
| 59 | 
            +
              raider scaffold [SCAFFOLD_NAME]  # Generates everything needed to start automating
         | 
| 54 60 |  | 
| 55 61 | 
             
              raider spec [SPEC_NAME]          # Creates a new spec
         | 
| 56 62 |  | 
| @@ -68,4 +74,4 @@ raider path [PATH_NAME] --spec or -s | |
| 68 74 | 
             
            raider path [PATH_NAME] --helper or -h
         | 
| 69 75 | 
             
            ```
         | 
| 70 76 |  | 
| 71 | 
            -
            If you don't specify an option path will assume you want to change the default path for pages
         | 
| 77 | 
            +
            If you don't specify an option, path will assume you want to change the default path for pages.
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -1,15 +1,19 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 3 | 
             
            require_relative 'lib/ruby_raider'
         | 
| 4 | 
            +
            require_relative 'lib/commands/scaffolding_commands'
         | 
| 4 5 |  | 
| 5 | 
            -
            desc ' | 
| 6 | 
            -
            task :new | 
| 6 | 
            +
            desc 'Creates a new test project'
         | 
| 7 | 
            +
            task :new do
         | 
| 7 8 | 
             
              RubyRaider.start
         | 
| 8 | 
            -
              RubyRaider.new(args.name)
         | 
| 9 9 | 
             
            end
         | 
| 10 10 |  | 
| 11 | 
            -
            desc ' | 
| 12 | 
            -
            task :page, [:name] do |_t, args|
         | 
| 13 | 
            -
               | 
| 14 | 
            -
             | 
| 11 | 
            +
            desc 'Creates a page'
         | 
| 12 | 
            +
            task :page, [:name, :path] do |_t, args|
         | 
| 13 | 
            +
              ScaffoldingCommands.new.invoke(:page, nil, %W[:#{args.name} --path #{args.path}])
         | 
| 14 | 
            +
            end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            desc 'Sets a browser'
         | 
| 17 | 
            +
            task :browser, [:type, :options] do |_t, args|
         | 
| 18 | 
            +
              ScaffoldingCommands.new.invoke(:browser, nil, %W[:#{args.type} --opts #{args.options}])
         | 
| 15 19 | 
             
            end
         | 
| @@ -0,0 +1,116 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require_relative '../generators/menu_generator'
         | 
| 4 | 
            +
            require_relative '../scaffolding/scaffolding'
         | 
| 5 | 
            +
            require_relative '../commands/utility_commands'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            class ScaffoldingCommands < UtilityCommands
         | 
| 8 | 
            +
              desc 'new [PROJECT_NAME]', 'Creates a new framework based on settings picked'
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              def new(project_name)
         | 
| 11 | 
            +
                MenuGenerator.new(project_name).generate_choice_menu
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              map '-n' => 'new'
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              desc 'page [PAGE_NAME]', 'Creates a new page object'
         | 
| 17 | 
            +
              option :path,
         | 
| 18 | 
            +
                     type: :string, required: false, desc: 'The path where your page will be created', aliases: '-p'
         | 
| 19 | 
            +
              option :delete,
         | 
| 20 | 
            +
                     type: :boolean, required: false, desc: 'This will delete the selected page', aliases: '-d'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              def page(name)
         | 
| 23 | 
            +
                path = options[:path] || load_config_path('page')
         | 
| 24 | 
            +
                if options[:delete]
         | 
| 25 | 
            +
                  Scaffolding.new([name, path]).delete_class
         | 
| 26 | 
            +
                else
         | 
| 27 | 
            +
                  Scaffolding.new([name, path]).generate_class
         | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
              map '-pg' => 'page'
         | 
| 32 | 
            +
             | 
| 33 | 
            +
              desc 'feature [FEATURE_NAME]', 'Creates a new feature'
         | 
| 34 | 
            +
              option :path,
         | 
| 35 | 
            +
                     type: :string, required: false, desc: 'The path where your feature will be created', aliases: '-p'
         | 
| 36 | 
            +
              option :delete,
         | 
| 37 | 
            +
                     type: :boolean, required: false, desc: 'This will delete the selected feature', aliases: '-d'
         | 
| 38 | 
            +
             | 
| 39 | 
            +
              def feature(name)
         | 
| 40 | 
            +
                path = options[:path] || load_config_path('feature')
         | 
| 41 | 
            +
                if options[:delete]
         | 
| 42 | 
            +
                  Scaffolding.new([name, path]).delete_feature
         | 
| 43 | 
            +
                else
         | 
| 44 | 
            +
                  Scaffolding.new([name, path]).generate_feature
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              map '-f' => 'feature'
         | 
| 49 | 
            +
             | 
| 50 | 
            +
              desc 'spec [SPEC_NAME]', 'Creates a new spec'
         | 
| 51 | 
            +
              option :path,
         | 
| 52 | 
            +
                     type: :string, required: false, desc: 'The path where your spec will be created', aliases: '-p'
         | 
| 53 | 
            +
              option :delete,
         | 
| 54 | 
            +
                     type: :boolean, required: false, desc: 'This will delete the selected spec', aliases: '-d'
         | 
| 55 | 
            +
             | 
| 56 | 
            +
              def spec(name)
         | 
| 57 | 
            +
                path = options[:path] || load_config_path('spec')
         | 
| 58 | 
            +
                if options[:delete]
         | 
| 59 | 
            +
                  Scaffolding.new([name, path]).delete_spec
         | 
| 60 | 
            +
                else
         | 
| 61 | 
            +
                  Scaffolding.new([name, path]).generate_spec
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
              map '-s' => 'spec'
         | 
| 66 | 
            +
             | 
| 67 | 
            +
              desc 'helper [HELPER_NAME]', 'Creates a new helper'
         | 
| 68 | 
            +
              option :path,
         | 
| 69 | 
            +
                     type: :string, required: false, desc: 'The path where your helper will be created', aliases: '-p'
         | 
| 70 | 
            +
              option :delete,
         | 
| 71 | 
            +
                     type: :boolean, required: false, desc: 'This will delete the selected helper', aliases: '-d'
         | 
| 72 | 
            +
             | 
| 73 | 
            +
              def helper(name)
         | 
| 74 | 
            +
                path = options[:path] || load_config_path('helper')
         | 
| 75 | 
            +
                if options[:delete]
         | 
| 76 | 
            +
                  Scaffolding.new([name, path]).delete_helper
         | 
| 77 | 
            +
                else
         | 
| 78 | 
            +
                  Scaffolding.new([name, path]).generate_helper
         | 
| 79 | 
            +
                end
         | 
| 80 | 
            +
              end
         | 
| 81 | 
            +
             | 
| 82 | 
            +
              map '-h' => 'helper'
         | 
| 83 | 
            +
             | 
| 84 | 
            +
              desc 'scaffold [SCAFFOLD_NAME]', 'It generates everything needed to start automating'
         | 
| 85 | 
            +
             | 
| 86 | 
            +
              def scaffold(name)
         | 
| 87 | 
            +
                if Pathname.new('spec').exist? && !Pathname.new('features').exist?
         | 
| 88 | 
            +
                  Scaffolding.new([name, load_config_path('spec')]).generate_spec
         | 
| 89 | 
            +
                elsif Pathname.new('features').exist?
         | 
| 90 | 
            +
                  Scaffolding.new([name, load_config_path('feature')]).generate_feature
         | 
| 91 | 
            +
                end
         | 
| 92 | 
            +
                Scaffolding.new([name, load_config_path('page')]).generate_class
         | 
| 93 | 
            +
              end
         | 
| 94 | 
            +
             | 
| 95 | 
            +
              map '-sf' => 'scaffold'
         | 
| 96 | 
            +
             | 
| 97 | 
            +
              desc 'config', 'Creates configuration file'
         | 
| 98 | 
            +
              option :delete,
         | 
| 99 | 
            +
                     type: :boolean, required: false, desc: 'This will delete the config file', aliases: '-d'
         | 
| 100 | 
            +
             | 
| 101 | 
            +
              def config
         | 
| 102 | 
            +
                if options[:delete]
         | 
| 103 | 
            +
                  Scaffolding.new.delete_config
         | 
| 104 | 
            +
                else
         | 
| 105 | 
            +
                  Scaffolding.new.generate_config
         | 
| 106 | 
            +
                end
         | 
| 107 | 
            +
              end
         | 
| 108 | 
            +
             | 
| 109 | 
            +
              map '-c' => 'config'
         | 
| 110 | 
            +
             | 
| 111 | 
            +
              no_commands do
         | 
| 112 | 
            +
                def load_config_path(type)
         | 
| 113 | 
            +
                  YAML.load_file('config/config.yml')["#{type}_path"] if YAML.load_file('config/config.yml')
         | 
| 114 | 
            +
                end
         | 
| 115 | 
            +
              end
         | 
| 116 | 
            +
            end
         | 
| @@ -0,0 +1,67 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require 'thor'
         | 
| 4 | 
            +
            require_relative '../utilities/utilities'
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            class UtilityCommands < Thor
         | 
| 7 | 
            +
              desc 'path [PATH]', 'Sets the default path for scaffolding'
         | 
| 8 | 
            +
              option :feature,
         | 
| 9 | 
            +
                     type: :boolean, required: false, desc: 'The default path for your features', aliases: '-f'
         | 
| 10 | 
            +
              option :helper,
         | 
| 11 | 
            +
                     type: :boolean, required: false, desc: 'The default path for your helpers', aliases: '-h'
         | 
| 12 | 
            +
              option :spec,
         | 
| 13 | 
            +
                     type: :boolean, required: false, desc: 'The default path for your specs', aliases: '-s'
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              def path(default_path)
         | 
| 16 | 
            +
                type = options.empty? ? 'page' : options.keys.first
         | 
| 17 | 
            +
                Utilities.new.send("#{type}_path=", default_path)
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              map '-p' => 'path'
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              desc 'url [URL]', 'Sets the default url for a project'
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              def url(default_url)
         | 
| 25 | 
            +
                Utilities.new.url = default_url
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              map '-u' => 'url'
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              desc 'browser [BROWSER]', 'Sets the default browser for a project'
         | 
| 31 | 
            +
              option :opts,
         | 
| 32 | 
            +
                     type: :array, required: false, desc: 'The options you want your browser to run with', aliases: '-o'
         | 
| 33 | 
            +
              option :delete,
         | 
| 34 | 
            +
                     type: :boolean, required: false, desc: 'This will delete your browser options', aliases: '-d'
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              def browser(default_browser = nil)
         | 
| 37 | 
            +
                Utilities.new.browser = default_browser if default_browser
         | 
| 38 | 
            +
                browser_options(options[:opts]) if options[:opts] || options[:delete]
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              map '-b' => 'browser'
         | 
| 42 | 
            +
             | 
| 43 | 
            +
              desc 'browser_options [OPTIONS]', 'Sets the browser options for the project'
         | 
| 44 | 
            +
              option :delete,
         | 
| 45 | 
            +
                     type: :boolean, required: false, desc: 'This will delete your browser options', aliases: '-d'
         | 
| 46 | 
            +
             | 
| 47 | 
            +
              def browser_options(*opts)
         | 
| 48 | 
            +
                Utilities.new.browser_options = opts unless opts.empty?
         | 
| 49 | 
            +
                Utilities.new.delete_browser_options if options[:delete]
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
              map '-bo' => 'browser_options'
         | 
| 53 | 
            +
             | 
| 54 | 
            +
              desc 'raid', 'It runs all the tests in a project'
         | 
| 55 | 
            +
             | 
| 56 | 
            +
              def raid
         | 
| 57 | 
            +
                Utilities.new.run
         | 
| 58 | 
            +
              end
         | 
| 59 | 
            +
             | 
| 60 | 
            +
              map '-r' => 'raid'
         | 
| 61 | 
            +
             | 
| 62 | 
            +
              desc 'config', 'Creates a new config file'
         | 
| 63 | 
            +
              option :path,
         | 
| 64 | 
            +
                     type: :string, required: false, desc: 'The path where your config file will be created', aliases: '-p'
         | 
| 65 | 
            +
              option :delete,
         | 
| 66 | 
            +
                     type: :boolean, required: false, desc: 'This will delete the selected config file', aliases: '-d'
         | 
| 67 | 
            +
            end
         | 
| @@ -8,64 +8,79 @@ require_relative 'helper_generator' | |
| 8 8 | 
             
            require_relative 'rspec_generator'
         | 
| 9 9 |  | 
| 10 10 | 
             
            class MenuGenerator
         | 
| 11 | 
            -
               | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 11 | 
            +
              attr_reader :cli, :name, :generators
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              def initialize(project_name)
         | 
| 14 | 
            +
                @cli = HighLine.new
         | 
| 15 | 
            +
                @name = project_name
         | 
| 16 | 
            +
                @generators = %w[Automation Common Helpers]
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              def generate_choice_menu
         | 
| 20 | 
            +
                @cli.choose do |menu|
         | 
| 21 | 
            +
                  menu.prompt = 'Please select your automation framework'
         | 
| 22 | 
            +
                  menu.choice('Selenium') { choose_test_framework('selenium') }
         | 
| 23 | 
            +
                  menu.choice('Watir') { choose_test_framework('watir') }
         | 
| 24 | 
            +
                  menu.choice('Appium') { choose_test_framework('appium') }
         | 
| 25 | 
            +
                  menu.choice('Quit') { exit }
         | 
| 21 26 | 
             
                end
         | 
| 27 | 
            +
              end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
              def choose_test_framework(automation)
         | 
| 30 | 
            +
                system('clear') || system('cls')
         | 
| 31 | 
            +
                sleep 0.3
         | 
| 32 | 
            +
                automation = automation == 'appium' ? choose_mobile_platform : automation
         | 
| 33 | 
            +
                select_test_framework(automation)
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              def set_framework(automation, framework)
         | 
| 37 | 
            +
                add_generator framework.capitalize
         | 
| 38 | 
            +
                generators.each { |generator| invoke_generator(automation, framework, generator) }
         | 
| 39 | 
            +
                system "cd #{name} && gem install bundler && bundle install"
         | 
| 40 | 
            +
              end
         | 
| 22 41 |  | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
                   | 
| 26 | 
            -
                   | 
| 27 | 
            -
                   | 
| 28 | 
            -
                   | 
| 29 | 
            -
             | 
| 30 | 
            -
                    menu.choice('Rspec') do
         | 
| 31 | 
            -
                      framework = 'rspec'
         | 
| 32 | 
            -
                      set_framework(automation, framework, project_name)
         | 
| 33 | 
            -
                    end
         | 
| 34 | 
            -
                    menu.choice('Cucumber') do
         | 
| 35 | 
            -
                      framework = 'cucumber'
         | 
| 36 | 
            -
                      set_framework(automation, framework, project_name)
         | 
| 37 | 
            -
                    end
         | 
| 38 | 
            -
                    menu.choice('Quit') { exit }
         | 
| 39 | 
            -
                  end
         | 
| 40 | 
            -
                  @cli.say("You have chosen to use #{framework} with #{automation}")
         | 
| 42 | 
            +
              def choose_mobile_platform
         | 
| 43 | 
            +
                @cli.choose do |menu|
         | 
| 44 | 
            +
                  menu.prompt = 'Please select your mobile platform'
         | 
| 45 | 
            +
                  menu.choice('iOS') { 'appium_ios' }
         | 
| 46 | 
            +
                  error_handling(menu, 'Android')
         | 
| 47 | 
            +
                  error_handling(menu, 'Cross Platform')
         | 
| 48 | 
            +
                  menu.choice('Quit') { exit }
         | 
| 41 49 | 
             
                end
         | 
| 50 | 
            +
              end
         | 
| 51 | 
            +
             | 
| 52 | 
            +
              protected
         | 
| 42 53 |  | 
| 43 | 
            -
             | 
| 44 | 
            -
             | 
| 45 | 
            -
             | 
| 46 | 
            -
             | 
| 47 | 
            -
             | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
             | 
| 51 | 
            -
                   | 
| 52 | 
            -
                   | 
| 54 | 
            +
              def add_generator(*opts)
         | 
| 55 | 
            +
                opts.each { |opt| @generators.push opt }
         | 
| 56 | 
            +
              end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
              private
         | 
| 59 | 
            +
             | 
| 60 | 
            +
              def framework_choice(invoker, framework, automation_type)
         | 
| 61 | 
            +
                invoker.choice(framework) do
         | 
| 62 | 
            +
                  set_framework(automation_type, framework.downcase)
         | 
| 63 | 
            +
                  @cli.say("You have chosen to use #{framework} with #{automation_type}")
         | 
| 53 64 | 
             
                end
         | 
| 65 | 
            +
              end
         | 
| 54 66 |  | 
| 55 | 
            -
             | 
| 56 | 
            -
             | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
                    menu.choice('Android') do
         | 
| 60 | 
            -
                      pp 'Android appium is coming soon. Thank you for the interest'
         | 
| 61 | 
            -
                      exit
         | 
| 62 | 
            -
                    end
         | 
| 63 | 
            -
                    menu.choice('Cross Platform') do
         | 
| 64 | 
            -
                      pp 'Cross platform appium is coming soon. Thank you for the interest'
         | 
| 65 | 
            -
                      exit
         | 
| 66 | 
            -
                    end
         | 
| 67 | 
            -
                    menu.choice('Quit') { exit }
         | 
| 68 | 
            -
                  end
         | 
| 67 | 
            +
              def error_handling(invoker, platform)
         | 
| 68 | 
            +
                invoker.choice(platform) do
         | 
| 69 | 
            +
                  pp "#{platform} appium is coming soon. Thank you for the interest"
         | 
| 70 | 
            +
                  exit
         | 
| 69 71 | 
             
                end
         | 
| 70 72 | 
             
              end
         | 
| 73 | 
            +
             | 
| 74 | 
            +
              def select_test_framework(automation)
         | 
| 75 | 
            +
                @cli.choose do |menu|
         | 
| 76 | 
            +
                  menu.prompt = 'Please select your test framework'
         | 
| 77 | 
            +
                  framework_choice(menu, 'Rspec', automation)
         | 
| 78 | 
            +
                  framework_choice(menu, 'Cucumber', automation)
         | 
| 79 | 
            +
                  menu.choice('Quit') { exit }
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
              end
         | 
| 82 | 
            +
             | 
| 83 | 
            +
              def invoke_generator(automation, framework, generator)
         | 
| 84 | 
            +
                Object.const_get("#{generator}Generator").new([automation, framework, name]).invoke_all
         | 
| 85 | 
            +
              end
         | 
| 71 86 | 
             
            end
         | 
| @@ -7,7 +7,7 @@ Before do | |
| 7 7 | 
             
            end
         | 
| 8 8 |  | 
| 9 9 | 
             
            After do |scenario|
         | 
| 10 | 
            -
              browser. | 
| 10 | 
            +
              browser.screenshot.save("allure-results/screenshots/#{scenario.name}.png")
         | 
| 11 11 | 
             
              Raider::AllureHelper.add_screenshot(scenario.name)
         | 
| 12 12 | 
             
              browser.quit
         | 
| 13 13 | 
             
            end
         | 
| @@ -16,7 +16,7 @@ module Raider | |
| 16 16 | 
             
                  def add_screenshot(screenshot_name)
         | 
| 17 17 | 
             
                    Allure.add_attachment(
         | 
| 18 18 | 
             
                      name: name,
         | 
| 19 | 
            -
                      source:  | 
| 19 | 
            +
                      source: File.open("allure-results/screenshots/#{screenshot_name}.png"),
         | 
| 20 20 | 
             
                      type: Allure::ContentType::PNG,
         | 
| 21 21 | 
             
                      test_case: true
         | 
| 22 22 | 
             
                    )
         | 
| @@ -9,11 +9,11 @@ module Raider | |
| 9 9 | 
             
              module BrowserHelper
         | 
| 10 10 | 
             
                  attr_reader :browser
         | 
| 11 11 |  | 
| 12 | 
            -
                  def new_browser( | 
| 12 | 
            +
                  def new_browser(*args)
         | 
| 13 13 | 
             
                    @config = YAML.load_file('config/config.yml')
         | 
| 14 14 | 
             
                    browser = @config['browser'].to_sym
         | 
| 15 | 
            -
                     | 
| 16 | 
            -
                    @browser = Watir::Browser.new(browser, options:  | 
| 15 | 
            +
                    args = args.empty? ? @config['browser_options'] : args
         | 
| 16 | 
            +
                    @browser = Watir::Browser.new(browser, options: { args: args })
         | 
| 17 17 | 
             
                  end
         | 
| 18 18 | 
             
              end
         | 
| 19 19 | 
             
            end
         | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 | 
             
            require 'yaml'
         | 
| 3 3 | 
             
            <% if automation == 'selenium' -%>
         | 
| 4 | 
            +
            require 'active_support/inflector'
         | 
| 4 5 | 
             
            require 'webdrivers'
         | 
| 5 6 | 
             
            <% else -%>
         | 
| 6 7 | 
             
            require 'appium_lib'
         | 
| @@ -11,6 +12,6 @@ module Raider | |
| 11 12 | 
             
              module DriverHelper
         | 
| 12 13 | 
             
                  attr_reader :driver
         | 
| 13 14 |  | 
| 14 | 
            -
                  <%= ERB.new(File.read(File.expand_path('./partials/ | 
| 15 | 
            +
                  <%= ERB.new(File.read(File.expand_path('./partials/driver_and_options.tt', __dir__))).result(binding).strip! %>
         | 
| 15 16 | 
             
              end
         | 
| 16 17 | 
             
            end
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            <% if automation == 'selenium' %>
         | 
| 2 | 
            +
                  def new_driver(*opts)
         | 
| 3 | 
            +
                    @config = YAML.load_file('config/config.yml')
         | 
| 4 | 
            +
                    browser = @config['browser'].to_sym
         | 
| 5 | 
            +
                    @driver = Selenium::WebDriver.for(browser, capabilities: browser_options(*opts))
         | 
| 6 | 
            +
                  end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
                  def browser_options(*opts)
         | 
| 9 | 
            +
                    opts = opts.empty? ? @config['browser_options'] : opts
         | 
| 10 | 
            +
                    create_options(*opts)
         | 
| 11 | 
            +
                  end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  def create_options(*opts)
         | 
| 14 | 
            +
                    browser = @config['browser'] == :ie ? @config['browser'].to_s.upcase : @config['browser'].to_s.capitalize
         | 
| 15 | 
            +
                    caps = "Selenium::WebDriver::#{browser}::Options".constantize.new
         | 
| 16 | 
            +
                    opts.each {|option| caps.add_argument(option) }
         | 
| 17 | 
            +
                    caps
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
            <% else %>
         | 
| 20 | 
            +
                  def new_driver
         | 
| 21 | 
            +
                    appium_file = File.join(Dir.pwd, 'appium.txt')
         | 
| 22 | 
            +
                    caps = Appium.load_appium_txt(file: appium_file)
         | 
| 23 | 
            +
                    @driver = Appium::Driver.new(caps)
         | 
| 24 | 
            +
                  end
         | 
| 25 | 
            +
            <% end %>
         | 
| @@ -1,8 +1,8 @@ | |
| 1 1 | 
             
            <% case automation
         | 
| 2 2 | 
             
             when 'selenium' %>
         | 
| 3 | 
            -
            driver.save_screenshot("allure-results/screenshots/#{example_name}.png") | 
| 3 | 
            +
            driver.save_screenshot("allure-results/screenshots/#{example_name}.png")
         | 
| 4 4 | 
             
            <% when 'watir' %>
         | 
| 5 | 
            -
            browser. | 
| 5 | 
            +
            browser.screenshot.save("allure-results/screenshots/#{example_name}.png")
         | 
| 6 6 | 
             
            <% else %>
         | 
| 7 | 
            -
            driver.screenshot("allure-results/screenshots/#{example_name}.png") | 
| 7 | 
            +
            driver.screenshot("allure-results/screenshots/#{example_name}.png")
         | 
| 8 8 | 
             
            <% end %>
         | 
| @@ -21,9 +21,8 @@ module Raider | |
| 21 21 |  | 
| 22 22 | 
             
                  config.after(:each) do
         | 
| 23 23 | 
             
                    example_name = self.class.descendant_filtered_examples.first.description
         | 
| 24 | 
            -
                    status = self.class.descendant_filtered_examples.first.execution_result.status
         | 
| 25 24 | 
             
                    <%= ERB.new(File.read(File.expand_path('./partials/screenshot.tt', __dir__))).result(binding).strip! %>
         | 
| 26 | 
            -
                    AllureHelper.add_screenshot example_name | 
| 25 | 
            +
                    AllureHelper.add_screenshot example_name
         | 
| 27 26 | 
             
                    <%= ERB.new(File.read(File.expand_path('./partials/quit_driver.tt', __dir__))).result(binding).strip! %>
         | 
| 28 27 | 
             
                  end
         | 
| 29 28 | 
             
                end
         | 
    
        data/lib/ruby_raider.rb
    CHANGED
    
    | @@ -1,152 +1,9 @@ | |
| 1 1 | 
             
            # frozen_string_literal: true
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
            require 'yaml'
         | 
| 5 | 
            -
            require_relative 'generators/menu_generator'
         | 
| 6 | 
            -
            require_relative '../lib/scaffolding/scaffolding'
         | 
| 7 | 
            -
            require_relative '../lib/utilities/utilities'
         | 
| 3 | 
            +
            require_relative '../lib/commands/scaffolding_commands'
         | 
| 8 4 |  | 
| 9 | 
            -
            class RubyRaider | 
| 10 | 
            -
               | 
| 11 | 
            -
             | 
| 12 | 
            -
              def new(project_name)
         | 
| 13 | 
            -
                MenuGenerator.generate_choice_menu(project_name)
         | 
| 14 | 
            -
              end
         | 
| 15 | 
            -
              map '-n' => "new"
         | 
| 16 | 
            -
             | 
| 17 | 
            -
              desc 'page [PAGE_NAME]', 'Creates a new page object'
         | 
| 18 | 
            -
              option :path,
         | 
| 19 | 
            -
                     type: :string, required: false, desc: 'The path where your page will be created', aliases: '-p'
         | 
| 20 | 
            -
              option :delete,
         | 
| 21 | 
            -
                     type: :boolean, required: false, desc: 'This will delete the selected page', aliases: '-d'
         | 
| 22 | 
            -
             | 
| 23 | 
            -
              def page(name)
         | 
| 24 | 
            -
                path = options[:path].nil? ? load_config_path('page') : options[:path]
         | 
| 25 | 
            -
                if options[:delete]
         | 
| 26 | 
            -
                  Scaffolding.new([name, path]).delete_class
         | 
| 27 | 
            -
                else
         | 
| 28 | 
            -
                  Scaffolding.new([name, path]).generate_class
         | 
| 29 | 
            -
                end
         | 
| 30 | 
            -
              end
         | 
| 31 | 
            -
              map '-pg' => "page"
         | 
| 32 | 
            -
             | 
| 33 | 
            -
              desc 'feature [FEATURE_NAME]', 'Creates a new feature'
         | 
| 34 | 
            -
              option :path,
         | 
| 35 | 
            -
                     type: :string, required: false, desc: 'The path where your feature will be created', aliases: '-p'
         | 
| 36 | 
            -
              option :delete,
         | 
| 37 | 
            -
                     type: :boolean, required: false, desc: 'This will delete the selected feature', aliases: '-d'
         | 
| 38 | 
            -
             | 
| 39 | 
            -
              def feature(name)
         | 
| 40 | 
            -
                path = options[:path].nil? ? load_config_path('feature') : options[:path]
         | 
| 41 | 
            -
                if options[:delete]
         | 
| 42 | 
            -
                  Scaffolding.new([name, path]).delete_feature
         | 
| 43 | 
            -
                else
         | 
| 44 | 
            -
                  Scaffolding.new([name, path]).generate_feature
         | 
| 45 | 
            -
                end
         | 
| 46 | 
            -
              end
         | 
| 47 | 
            -
              map '-f' => "feature"
         | 
| 48 | 
            -
             | 
| 49 | 
            -
              desc 'spec [SPEC_NAME]', 'Creates a new spec'
         | 
| 50 | 
            -
              option :path,
         | 
| 51 | 
            -
                     type: :string, required: false, desc: 'The path where your spec will be created', aliases: '-p'
         | 
| 52 | 
            -
              option :delete,
         | 
| 53 | 
            -
                     type: :boolean, required: false, desc: 'This will delete the selected spec', aliases: '-d'
         | 
| 54 | 
            -
             | 
| 55 | 
            -
              def spec(name)
         | 
| 56 | 
            -
                path = options[:path].nil? ? load_config_path('spec') : options[:path]
         | 
| 57 | 
            -
                if options[:delete]
         | 
| 58 | 
            -
                  Scaffolding.new([name, path]).delete_spec
         | 
| 59 | 
            -
                else
         | 
| 60 | 
            -
                  Scaffolding.new([name, path]).generate_spec
         | 
| 61 | 
            -
                end
         | 
| 62 | 
            -
              end
         | 
| 63 | 
            -
              map '-s' => "spec"
         | 
| 64 | 
            -
             | 
| 65 | 
            -
              desc 'helper [HELPER_NAME]', 'Creates a new helper'
         | 
| 66 | 
            -
              option :path,
         | 
| 67 | 
            -
                     type: :string, required: false, desc: 'The path where your helper will be created', aliases: '-p'
         | 
| 68 | 
            -
              option :delete,
         | 
| 69 | 
            -
                     type: :boolean, required: false, desc: 'This will delete the selected helper', aliases: '-d'
         | 
| 70 | 
            -
             | 
| 71 | 
            -
              def helper(name)
         | 
| 72 | 
            -
                path = options[:path].nil? ? load_config_path('helper') : options[:path]
         | 
| 73 | 
            -
                if options[:delete]
         | 
| 74 | 
            -
                  Scaffolding.new([name, path]).delete_helper
         | 
| 75 | 
            -
                else
         | 
| 76 | 
            -
                  Scaffolding.new([name, path]).generate_helper
         | 
| 77 | 
            -
                end
         | 
| 78 | 
            -
              end
         | 
| 79 | 
            -
              map '-h' => "helper"
         | 
| 80 | 
            -
             | 
| 81 | 
            -
              desc 'path [PATH]', 'Sets the default path for scaffolding'
         | 
| 82 | 
            -
              option :feature,
         | 
| 83 | 
            -
                     type: :boolean, required: false, desc: 'The default path for your features', aliases: '-f'
         | 
| 84 | 
            -
              option :helper,
         | 
| 85 | 
            -
                     type: :boolean, required: false, desc: 'The default path for your helpers', aliases: '-h'
         | 
| 86 | 
            -
              option :spec,
         | 
| 87 | 
            -
                     type: :boolean, required: false, desc: 'The default path for your specs', aliases: '-s'
         | 
| 88 | 
            -
              def path(default_path)
         | 
| 89 | 
            -
                type = options.empty? ? 'page' : options.keys.first
         | 
| 90 | 
            -
                Utilities.new.send("#{type}_path=", default_path)
         | 
| 91 | 
            -
              end
         | 
| 92 | 
            -
              map '-p' => "path"
         | 
| 93 | 
            -
             | 
| 94 | 
            -
              desc 'url [URL]', 'Sets the default url for a project'
         | 
| 95 | 
            -
             | 
| 96 | 
            -
              def url(default_url)
         | 
| 97 | 
            -
                Utilities.new.url = default_url
         | 
| 98 | 
            -
              end
         | 
| 99 | 
            -
              map '-u' => "url"
         | 
| 100 | 
            -
             | 
| 101 | 
            -
              desc 'browser [BROWSER]', 'Sets the default browser for a project'
         | 
| 102 | 
            -
              option :opts,
         | 
| 103 | 
            -
                     type: :hash, required: false, desc: 'The options you want your browser to run with', aliases: '-o'
         | 
| 104 | 
            -
              option :delete,
         | 
| 105 | 
            -
                     type: :boolean, required: false, desc: 'This will delete your browser options', aliases: '-d'
         | 
| 106 | 
            -
              def browser(default_browser = nil)
         | 
| 107 | 
            -
                Utilities.new.browser = default_browser unless default_browser.nil?
         | 
| 108 | 
            -
                Utilities.new.browser_options = options[:opts] unless options[:opts].nil?
         | 
| 109 | 
            -
                Utilities.new.delete_browser_options if options[:delete]
         | 
| 110 | 
            -
              end
         | 
| 111 | 
            -
              map '-b' => "browser"
         | 
| 112 | 
            -
             | 
| 113 | 
            -
              desc 'raid', 'It runs all the tests in a project'
         | 
| 114 | 
            -
              def raid
         | 
| 115 | 
            -
                Utilities.new.run
         | 
| 116 | 
            -
              end
         | 
| 117 | 
            -
              map '-r' => "raid"
         | 
| 118 | 
            -
             | 
| 119 | 
            -
              desc 'scaffold [SCAFFOLD_NAME]', 'It generates everything needed to start automating'
         | 
| 120 | 
            -
              def scaffold(name)
         | 
| 121 | 
            -
                if Pathname.new('spec').exist? && !Pathname.new('features').exist?
         | 
| 122 | 
            -
                  Scaffolding.new([name, load_config_path('spec')]).generate_spec
         | 
| 123 | 
            -
                  Scaffolding.new([name, load_config_path('page')]).generate_class
         | 
| 124 | 
            -
                elsif Pathname.new('features').exist?
         | 
| 125 | 
            -
                  Scaffolding.new([name, load_config_path('feature')]).generate_feature
         | 
| 126 | 
            -
                  Scaffolding.new([name, load_config_path('page')]).generate_class
         | 
| 127 | 
            -
                else
         | 
| 128 | 
            -
                  raise 'No features or spec folders where found. We are not sure which type of project you are running'
         | 
| 129 | 
            -
                end
         | 
| 130 | 
            -
              end
         | 
| 131 | 
            -
              map '-sf' => "scaffold"
         | 
| 132 | 
            -
             | 
| 133 | 
            -
              desc 'config', 'Creates a new config file'
         | 
| 134 | 
            -
              option :path,
         | 
| 135 | 
            -
                     type: :string, required: false, desc: 'The path where your config file will be created', aliases: '-p'
         | 
| 136 | 
            -
              option :delete,
         | 
| 137 | 
            -
                     type: :boolean, required: false, desc: 'This will delete the selected config file', aliases: '-d'
         | 
| 138 | 
            -
              def config
         | 
| 139 | 
            -
                if options[:delete]
         | 
| 140 | 
            -
                  Scaffolding.new.delete_config
         | 
| 141 | 
            -
                else
         | 
| 142 | 
            -
                  Scaffolding.new.generate_config
         | 
| 143 | 
            -
                end
         | 
| 144 | 
            -
              end
         | 
| 145 | 
            -
              map '-c' => "config"
         | 
| 146 | 
            -
             | 
| 147 | 
            -
              no_commands do
         | 
| 148 | 
            -
                def load_config_path(type)
         | 
| 149 | 
            -
                  YAML.load_file('config/config.yml')["#{type}_path"] unless YAML.load_file('config/config.yml').nil?
         | 
| 150 | 
            -
                end
         | 
| 5 | 
            +
            class RubyRaider
         | 
| 6 | 
            +
              def self.start
         | 
| 7 | 
            +
                ScaffoldingCommands.start
         | 
| 151 8 | 
             
              end
         | 
| 152 9 | 
             
            end
         | 
| @@ -30,7 +30,7 @@ class Scaffolding < Thor::Group | |
| 30 30 |  | 
| 31 31 | 
             
              def generate_config
         | 
| 32 32 | 
             
                template('../../generators/templates/common/config.tt',
         | 
| 33 | 
            -
                         default_path( | 
| 33 | 
            +
                         default_path('config/config.yml', '.yml'))
         | 
| 34 34 | 
             
              end
         | 
| 35 35 |  | 
| 36 36 | 
             
              def delete_class
         | 
| @@ -50,10 +50,10 @@ class Scaffolding < Thor::Group | |
| 50 50 | 
             
              end
         | 
| 51 51 |  | 
| 52 52 | 
             
              def delete_config
         | 
| 53 | 
            -
                remove_file(default_path( | 
| 53 | 
            +
                remove_file(default_path('config/config.yml', '.yml'))
         | 
| 54 54 | 
             
              end
         | 
| 55 55 |  | 
| 56 56 | 
             
              def default_path(standard_path, file_type)
         | 
| 57 | 
            -
                path | 
| 57 | 
            +
                path ? "#{path}/#{name}#{file_type}" : standard_path
         | 
| 58 58 | 
             
              end
         | 
| 59 59 | 
             
            end
         | 
    
        data/lib/utilities/utilities.rb
    CHANGED
    
    
    
        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.3. | 
| 5 | 
            +
              s.version     = '0.3.6'
         | 
| 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']
         | 
| @@ -1,60 +1,88 @@ | |
| 1 1 | 
             
            require 'pathname'
         | 
| 2 2 | 
             
            require 'yaml'
         | 
| 3 | 
            -
            require_relative 'spec_helper'
         | 
| 4 | 
            -
            require_relative '../lib/ruby_raider'
         | 
| 5 3 | 
             
            require_relative '../lib/generators/common_generator'
         | 
| 4 | 
            +
            require_relative '../lib/commands/scaffolding_commands'
         | 
| 5 | 
            +
            require_relative 'spec_helper'
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            describe ScaffoldingCommands do
         | 
| 8 | 
            +
              let(:scaffold) { ScaffoldingCommands }
         | 
| 9 | 
            +
              let(:name) { 'test' }
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              context 'with a spec folder' do
         | 
| 12 | 
            +
                before(:all) do
         | 
| 13 | 
            +
                  ScaffoldingCommands.new.invoke(:config)
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                it 'scaffolds for rspec' do
         | 
| 17 | 
            +
                  scaffold.new.invoke(:scaffold, nil, %W[#{name}])
         | 
| 18 | 
            +
                  expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
         | 
| 19 | 
            +
                  expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
         | 
| 20 | 
            +
                end
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
              context 'with a features folder' do
         | 
| 24 | 
            +
                it 'scaffolds for cucumber' do
         | 
| 25 | 
            +
                  FileUtils.mkdir 'features'
         | 
| 26 | 
            +
                  scaffold.new.invoke(:scaffold, nil, %W[#{name}])
         | 
| 27 | 
            +
                  expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
         | 
| 28 | 
            +
                  expect(Pathname.new("features/#{name}.feature")).to be_file
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 6 31 |  | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 32 | 
            +
              after(:all) do
         | 
| 33 | 
            +
                folders = %w[test config page_objects features]
         | 
| 34 | 
            +
                folders.each do |folder|
         | 
| 35 | 
            +
                  FileUtils.rm_rf(folder)
         | 
| 36 | 
            +
                end
         | 
| 37 | 
            +
                FileUtils.rm('spec/test_spec.rb') if Pathname.new('spec/test_spec.rb').exist?
         | 
| 38 | 
            +
              end
         | 
| 10 39 |  | 
| 11 40 | 
             
              context 'with path from config file' do
         | 
| 12 41 | 
             
                before(:all) do
         | 
| 13 | 
            -
                   | 
| 14 | 
            -
                  FileUtils.cp_lr('test/config', './')
         | 
| 42 | 
            +
                  ScaffoldingCommands.new.invoke(:config)
         | 
| 15 43 | 
             
                end
         | 
| 16 44 |  | 
| 17 45 | 
             
                it 'creates a page' do
         | 
| 18 | 
            -
                   | 
| 46 | 
            +
                  scaffold.new.invoke(:page, nil, %W[#{name}])
         | 
| 19 47 | 
             
                  expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
         | 
| 20 48 | 
             
                end
         | 
| 21 49 |  | 
| 22 50 | 
             
                it 'creates a feature' do
         | 
| 23 | 
            -
                   | 
| 51 | 
            +
                  scaffold.new.invoke(:feature, nil, %W[#{name}])
         | 
| 24 52 | 
             
                  expect(Pathname.new("features/#{name}.feature")).to be_file
         | 
| 25 53 | 
             
                end
         | 
| 26 54 |  | 
| 27 55 | 
             
                it 'creates a spec' do
         | 
| 28 | 
            -
                   | 
| 56 | 
            +
                  scaffold.new.invoke(:spec, nil, %W[#{name}])
         | 
| 29 57 | 
             
                  expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
         | 
| 30 58 | 
             
                end
         | 
| 31 59 |  | 
| 32 60 | 
             
                it 'creates a helper' do
         | 
| 33 | 
            -
                   | 
| 61 | 
            +
                  scaffold.new.invoke(:helper, nil, %W[#{name}])
         | 
| 34 62 | 
             
                  expect(Pathname.new("helpers/#{name}_helper.rb")).to be_file
         | 
| 35 63 | 
             
                end
         | 
| 36 64 |  | 
| 37 65 | 
             
                it 'deletes a page' do
         | 
| 38 | 
            -
                   | 
| 39 | 
            -
                   | 
| 66 | 
            +
                  scaffold.new.invoke(:page, nil, %W[#{name}])
         | 
| 67 | 
            +
                  scaffold.new.invoke(:page, nil, %W[#{name} --delete])
         | 
| 40 68 | 
             
                  expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to_not be_file
         | 
| 41 69 | 
             
                end
         | 
| 42 70 |  | 
| 43 71 | 
             
                it 'deletes a feature' do
         | 
| 44 | 
            -
                   | 
| 45 | 
            -
                   | 
| 72 | 
            +
                  scaffold.new.invoke(:feature, nil, %W[#{name}])
         | 
| 73 | 
            +
                  scaffold.new.invoke(:feature, nil, %W[#{name} --delete])
         | 
| 46 74 | 
             
                  expect(Pathname.new("features/#{name}.feature")).to_not be_file
         | 
| 47 75 | 
             
                end
         | 
| 48 76 |  | 
| 49 77 | 
             
                it 'deletes a spec' do
         | 
| 50 | 
            -
                   | 
| 51 | 
            -
                   | 
| 78 | 
            +
                  scaffold.new.invoke(:spec, nil, %W[#{name}])
         | 
| 79 | 
            +
                  scaffold.new.invoke(:spec, nil, %W[#{name} --delete])
         | 
| 52 80 | 
             
                  expect(Pathname.new("spec/#{name}_spec.rb")).to_not be_file
         | 
| 53 81 | 
             
                end
         | 
| 54 82 |  | 
| 55 83 | 
             
                it 'deletes a helper' do
         | 
| 56 | 
            -
                   | 
| 57 | 
            -
                   | 
| 84 | 
            +
                  scaffold.new.invoke(:helper, nil, %W[#{name}])
         | 
| 85 | 
            +
                  scaffold.new.invoke(:helper, nil, %W[#{name} --delete])
         | 
| 58 86 | 
             
                  expect(Pathname.new("helpers/#{name}_helper.rb")).to_not be_file
         | 
| 59 87 | 
             
                end
         | 
| 60 88 |  | 
| @@ -71,22 +99,22 @@ describe RubyRaider do | |
| 71 99 | 
             
                let(:path) { 'test_folder' }
         | 
| 72 100 |  | 
| 73 101 | 
             
                it 'creates a page' do
         | 
| 74 | 
            -
                   | 
| 102 | 
            +
                  scaffold.new.invoke(:page, nil, %W[#{name} --path #{path}])
         | 
| 75 103 | 
             
                  expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
         | 
| 76 104 | 
             
                end
         | 
| 77 105 |  | 
| 78 106 | 
             
                it 'creates a feature' do
         | 
| 79 | 
            -
                   | 
| 107 | 
            +
                  scaffold.new.invoke(:feature, nil, %W[#{name} --path #{path}])
         | 
| 80 108 | 
             
                  expect(Pathname.new("#{path}/#{name}.feature")).to be_file
         | 
| 81 109 | 
             
                end
         | 
| 82 110 |  | 
| 83 111 | 
             
                it 'creates a spec' do
         | 
| 84 | 
            -
                   | 
| 112 | 
            +
                  scaffold.new.invoke(:spec, nil, %W[#{name} --path #{path}])
         | 
| 85 113 | 
             
                  expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
         | 
| 86 114 | 
             
                end
         | 
| 87 115 |  | 
| 88 116 | 
             
                it 'creates a helper' do
         | 
| 89 | 
            -
                   | 
| 117 | 
            +
                  scaffold.new.invoke(:helper, nil, %W[#{name} --path #{path}])
         | 
| 90 118 | 
             
                  expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
         | 
| 91 119 | 
             
                end
         | 
| 92 120 |  | 
| @@ -99,49 +127,48 @@ describe RubyRaider do | |
| 99 127 | 
             
                let(:path) { 'test_folder' }
         | 
| 100 128 |  | 
| 101 129 | 
             
                before(:all) do
         | 
| 102 | 
            -
                   | 
| 103 | 
            -
                  FileUtils.cp_lr('test/config', './')
         | 
| 130 | 
            +
                  ScaffoldingCommands.new.invoke(:config)
         | 
| 104 131 | 
             
                end
         | 
| 105 132 |  | 
| 106 133 | 
             
                it 'changes the path for pages' do
         | 
| 107 | 
            -
                   | 
| 134 | 
            +
                  scaffold.new.invoke(:path, nil, %W[#{path}])
         | 
| 108 135 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 109 136 | 
             
                  expect(config['page_path']).to eql path
         | 
| 110 137 | 
             
                end
         | 
| 111 138 |  | 
| 112 139 | 
             
                it 'changes the path for features' do
         | 
| 113 | 
            -
                   | 
| 140 | 
            +
                  scaffold.new.invoke(:path, nil, %W[#{path} -f])
         | 
| 114 141 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 115 142 | 
             
                  expect(config['feature_path']).to eql path
         | 
| 116 143 | 
             
                end
         | 
| 117 144 |  | 
| 118 145 | 
             
                it 'changes the path for specs' do
         | 
| 119 | 
            -
                   | 
| 146 | 
            +
                  scaffold.new.invoke(:path, nil, %W[#{path} -s])
         | 
| 120 147 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 121 148 | 
             
                  expect(config['spec_path']).to eql path
         | 
| 122 149 | 
             
                end
         | 
| 123 150 |  | 
| 124 151 | 
             
                it 'creates page' do
         | 
| 125 | 
            -
                   | 
| 126 | 
            -
                   | 
| 152 | 
            +
                  scaffold.new.invoke(:path, nil, %W[#{path}])
         | 
| 153 | 
            +
                  scaffold.new.invoke(:page, nil, %W[#{name}])
         | 
| 127 154 | 
             
                  expect(Pathname.new("#{path}/#{name}_page.rb")).to be_file
         | 
| 128 155 | 
             
                end
         | 
| 129 156 |  | 
| 130 157 | 
             
                it 'creates feature' do
         | 
| 131 | 
            -
                   | 
| 132 | 
            -
                   | 
| 158 | 
            +
                  scaffold.new.invoke(:path, nil, %W[#{path} -f])
         | 
| 159 | 
            +
                  scaffold.new.invoke(:feature, nil, %W[#{name}])
         | 
| 133 160 | 
             
                  expect(Pathname.new("#{path}/#{name}.feature")).to be_file
         | 
| 134 161 | 
             
                end
         | 
| 135 162 |  | 
| 136 163 | 
             
                it 'creates spec' do
         | 
| 137 | 
            -
                   | 
| 138 | 
            -
                   | 
| 164 | 
            +
                  scaffold.new.invoke(:path, nil, %W[#{path} -s])
         | 
| 165 | 
            +
                  scaffold.new.invoke(:spec, nil, %W[#{name}])
         | 
| 139 166 | 
             
                  expect(Pathname.new("#{path}/#{name}_spec.rb")).to be_file
         | 
| 140 167 | 
             
                end
         | 
| 141 168 |  | 
| 142 169 | 
             
                it 'creates spec' do
         | 
| 143 | 
            -
                   | 
| 144 | 
            -
                   | 
| 170 | 
            +
                  scaffold.new.invoke(:path, nil, %W[#{path} -h])
         | 
| 171 | 
            +
                  scaffold.new.invoke(:helper, nil, %W[#{name}])
         | 
| 145 172 | 
             
                  expect(Pathname.new("#{path}/#{name}_helper.rb")).to be_file
         | 
| 146 173 | 
             
                end
         | 
| 147 174 |  | 
| @@ -160,39 +187,39 @@ describe RubyRaider do | |
| 160 187 | 
             
                end
         | 
| 161 188 |  | 
| 162 189 | 
             
                it 'updates the url' do
         | 
| 163 | 
            -
                   | 
| 190 | 
            +
                  scaffold.new.invoke(:url, nil, %W[test.com])
         | 
| 164 191 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 165 192 | 
             
                  expect(config['url']).to eql 'test.com'
         | 
| 166 193 | 
             
                end
         | 
| 167 194 |  | 
| 168 195 | 
             
                it 'updates the browser' do
         | 
| 169 | 
            -
                   | 
| 196 | 
            +
                  scaffold.new.invoke(:browser, nil, %W[:firefox])
         | 
| 170 197 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 171 198 | 
             
                  expect(config['browser']).to eql ':firefox'
         | 
| 172 199 | 
             
                end
         | 
| 173 200 |  | 
| 174 201 | 
             
                it 'updates the browser and the browser options' do
         | 
| 175 | 
            -
                   | 
| 202 | 
            +
                  scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless start-maximized start-fullscreen])
         | 
| 176 203 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 177 204 | 
             
                  expect(config['browser']).to eql ':firefox'
         | 
| 178 | 
            -
                  expect(config['browser_options']).to eql  | 
| 205 | 
            +
                  expect(config['browser_options']).to eql %W[headless start-maximized start-fullscreen]
         | 
| 179 206 | 
             
                end
         | 
| 180 207 |  | 
| 181 208 | 
             
                it 'updates only the browser options' do
         | 
| 182 | 
            -
                   | 
| 209 | 
            +
                  scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless])
         | 
| 183 210 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 184 | 
            -
                  expect(config['browser_options']).to eql  | 
| 211 | 
            +
                  expect(config['browser_options']).to eql %w[headless]
         | 
| 185 212 | 
             
                end
         | 
| 186 213 |  | 
| 187 214 | 
             
                it 'deletes the browser options when passed with the delete parameter' do
         | 
| 188 | 
            -
                   | 
| 215 | 
            +
                  scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless --delete])
         | 
| 189 216 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 190 217 | 
             
                  expect(config['browser_options']).to be_nil
         | 
| 191 218 | 
             
                end
         | 
| 192 219 |  | 
| 193 220 | 
             
                it 'deletes the browser options' do
         | 
| 194 | 
            -
                   | 
| 195 | 
            -
                   | 
| 221 | 
            +
                  scaffold.new.invoke(:browser, nil, %W[:firefox --opts headless])
         | 
| 222 | 
            +
                  scaffold.new.invoke(:browser, nil, %W[--delete])
         | 
| 196 223 | 
             
                  config = YAML.load_file('config/config.yml')
         | 
| 197 224 | 
             
                  expect(config['browser_options']).to be_nil
         | 
| 198 225 | 
             
                end
         | 
| @@ -204,36 +231,4 @@ describe RubyRaider do | |
| 204 231 | 
             
                  end
         | 
| 205 232 | 
             
                end
         | 
| 206 233 | 
             
              end
         | 
| 207 | 
            -
             | 
| 208 | 
            -
              context 'scaffolding' do
         | 
| 209 | 
            -
                before(:all) do
         | 
| 210 | 
            -
                  CommonGenerator.new(%w[rspec selenium test]).invoke(:generate_config_file)
         | 
| 211 | 
            -
                  FileUtils.cp_lr('test/config', './')
         | 
| 212 | 
            -
                end
         | 
| 213 | 
            -
             | 
| 214 | 
            -
                context 'with a spec folder' do
         | 
| 215 | 
            -
                  it 'scaffolds for rspec' do
         | 
| 216 | 
            -
                    raider.new.invoke(:scaffold, nil, %W[#{name}])
         | 
| 217 | 
            -
                    expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
         | 
| 218 | 
            -
                    expect(Pathname.new("spec/#{name}_spec.rb")).to be_file
         | 
| 219 | 
            -
                  end
         | 
| 220 | 
            -
                end
         | 
| 221 | 
            -
             | 
| 222 | 
            -
                context 'with a features folder' do
         | 
| 223 | 
            -
                  it 'scaffolds for cucumber' do
         | 
| 224 | 
            -
                    FileUtils.mkdir 'features'
         | 
| 225 | 
            -
                    raider.new.invoke(:scaffold, nil, %W[#{name}])
         | 
| 226 | 
            -
                    expect(Pathname.new("page_objects/pages/#{name}_page.rb")).to be_file
         | 
| 227 | 
            -
                    expect(Pathname.new("features/#{name}.feature")).to be_file
         | 
| 228 | 
            -
                  end
         | 
| 229 | 
            -
                end
         | 
| 230 | 
            -
             | 
| 231 | 
            -
                after(:all) do
         | 
| 232 | 
            -
                  folders = %w[test config page_objects features]
         | 
| 233 | 
            -
                  folders.each do |folder|
         | 
| 234 | 
            -
                    FileUtils.rm_rf(folder)
         | 
| 235 | 
            -
                  end
         | 
| 236 | 
            -
                  FileUtils.rm('spec/test_spec.rb') if Pathname.new('spec/test_spec.rb').exist?
         | 
| 237 | 
            -
                end
         | 
| 238 | 
            -
              end
         | 
| 239 | 
            -
            end
         | 
| 234 | 
            +
            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.3. | 
| 4 | 
            +
              version: 0.3.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: 2022- | 
| 11 | 
            +
            date: 2022-07-23 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         | 
| @@ -117,6 +117,9 @@ extra_rdoc_files: [] | |
| 117 117 | 
             
            files:
         | 
| 118 118 | 
             
            - ".github/ISSUE_TEMPLATE/bug_report.md"
         | 
| 119 119 | 
             
            - ".github/ISSUE_TEMPLATE/feature_request.md"
         | 
| 120 | 
            +
            - ".github/workflows/reek.yml"
         | 
| 121 | 
            +
            - ".github/workflows/rspec.yml"
         | 
| 122 | 
            +
            - ".github/workflows/rubocop.yml"
         | 
| 120 123 | 
             
            - ".gitignore"
         | 
| 121 124 | 
             
            - ".reek.yml"
         | 
| 122 125 | 
             
            - ".rubocop.yml"
         | 
| @@ -127,6 +130,8 @@ files: | |
| 127 130 | 
             
            - README.md
         | 
| 128 131 | 
             
            - Rakefile
         | 
| 129 132 | 
             
            - bin/raider
         | 
| 133 | 
            +
            - lib/commands/scaffolding_commands.rb
         | 
| 134 | 
            +
            - lib/commands/utility_commands.rb
         | 
| 130 135 | 
             
            - lib/generators/automation_generator.rb
         | 
| 131 136 | 
             
            - lib/generators/common_generator.rb
         | 
| 132 137 | 
             
            - lib/generators/cucumber_generator.rb
         | 
| @@ -167,7 +172,7 @@ files: | |
| 167 172 | 
             
            - lib/generators/templates/helpers/driver_helper.tt
         | 
| 168 173 | 
             
            - lib/generators/templates/helpers/partials/allure_imports.tt
         | 
| 169 174 | 
             
            - lib/generators/templates/helpers/partials/allure_requirements.tt
         | 
| 170 | 
            -
            - lib/generators/templates/helpers/partials/ | 
| 175 | 
            +
            - lib/generators/templates/helpers/partials/driver_and_options.tt
         | 
| 171 176 | 
             
            - lib/generators/templates/helpers/partials/quit_driver.tt
         | 
| 172 177 | 
             
            - lib/generators/templates/helpers/partials/require_automation.tt
         | 
| 173 178 | 
             
            - lib/generators/templates/helpers/partials/screenshot.tt
         | 
| @@ -190,7 +195,7 @@ files: | |
| 190 195 | 
             
            - spec/cucumber_generator_spec.rb
         | 
| 191 196 | 
             
            - spec/helpers_generator_spec.rb
         | 
| 192 197 | 
             
            - spec/rspec_generator_spec.rb
         | 
| 193 | 
            -
            - spec/ | 
| 198 | 
            +
            - spec/scaffolding_spec.rb
         | 
| 194 199 | 
             
            - spec/spec_helper.rb
         | 
| 195 200 | 
             
            homepage: https://github.com/RubyRaider/ruby_raider
         | 
| 196 201 | 
             
            licenses:
         | 
| @@ -1,14 +0,0 @@ | |
| 1 | 
            -
            <% if automation == 'selenium' %>
         | 
| 2 | 
            -
                  def new_driver(caps = {})
         | 
| 3 | 
            -
                    @config = YAML.load_file('config/config.yml')
         | 
| 4 | 
            -
                    browser = @config['browser'].to_sym
         | 
| 5 | 
            -
                    caps = caps.nil? ? @config['browser_options'] : caps
         | 
| 6 | 
            -
                    @driver = Selenium::WebDriver.for(browser, desired_capabilities: caps)
         | 
| 7 | 
            -
                  end
         | 
| 8 | 
            -
            <% else %>
         | 
| 9 | 
            -
                  def new_driver
         | 
| 10 | 
            -
                    appium_file = File.join(Dir.pwd, 'appium.txt')
         | 
| 11 | 
            -
                    caps = Appium.load_appium_txt(file: appium_file)
         | 
| 12 | 
            -
                    @driver = Appium::Driver.new(caps)
         | 
| 13 | 
            -
                  end
         | 
| 14 | 
            -
            <% end %>
         |