ruby_raider 0.8.2 → 0.8.5

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: aace14774067301e8684757746f8bcbfce04d3515e65760d5152e5161246d668
4
- data.tar.gz: 2ca8f14af7aef79f26c7fa95339f2d73f45ecf75c1b424f2318501dd576ef1ec
3
+ metadata.gz: 781def304ec2056ea9b417b071c9acf9fd8bda461cc80d5ffb98b16463feec44
4
+ data.tar.gz: d997baceec6e372557299bfbc07888d9c1a9821cbed8846025d4d22b105976dd
5
5
  SHA512:
6
- metadata.gz: a52a934e23410edc20803c6b8e8c6f494c93b7f7cfd76427ed3d205c235524d5ee81213765daa3ab2053318118a6f9ab38100159d87bd19312aef411450496c0
7
- data.tar.gz: d1751f9086dfe00cc95dd8f5a39e246d6a8c57558dfd9caa82e434ea54c55d39b77e16a7a957e0f3a746392a6d4a4abb512fab21932816309923ef648a4ac3a0
6
+ metadata.gz: 6413ebeadf5606fd74ea25e26ded0376da68bbfa242561ef0f32fb6a4e248d1bc50a7b4f2fea1db21a517cecb3f11c14fdf04ff96e15aaf67ce0cacfa527a426
7
+ data.tar.gz: 22ab647b145a58ec29cdd78e4bd65624af48585cf479a3647cb9eecb883fddd4d7c07eed68f2dff6833a1f4e13c7520ee25dd1ca406eaed5be8ab923226c1a25
data/README.md CHANGED
@@ -26,43 +26,30 @@
26
26
  <p align="center"> For more information and updates on releases, see <a href="https://ruby-raider.com">https://ruby-raider.com</a></p>
27
27
  </div>
28
28
 
29
- ## What is ruby raider?
29
+ ## What is Ruby Raider?
30
30
 
31
31
  Ruby Raider is a generator and scaffolding gem to make UI test automation easier
32
32
 
33
- ### At the moment Ruby raider supports
33
+ ### At the moment Ruby Raider supports generating the following frameworks:
34
+ | Web Testing Framework | Visual Testing Framework | Mobile Testing Framework |
35
+ |----------------------------|---------------------------------------------|-------------------------------------------|
36
+ | Cucumber and Selenium | Cucumber, Applitools and Selenium | Cucumber and Appium for IOS |
37
+ | Rspec and Selenium | Rspec, Applitools and Selenium | Rspec and Appium for IOS |
38
+ | Cucumber and Watir | | Cucumber and Appium for Android |
39
+ | Rspec and Watir | | Rspec and Appium for Android |
40
+ | | | Cucumber and Appium Cross-platform |
41
+ | | | Rspec and Appium Cross-platform |
42
+ | | | Cucumber and Sparkling Watir for IOS |
43
+ | | | Rspec and Sparkling Watir for IOS |
34
44
 
35
- * Generating a framework with Cucumber and Selenium
36
45
 
37
- * Generating a framework with Rspec and Selenium
38
-
39
- * Generating a framework with Cucumber and Watir
40
-
41
- * Generating a framework with Rspec and Watir
42
-
43
- * Generating a framework with Rspec and Appium for IOS
44
-
45
- * Generating a framework with Cucumber and Appium for IOS
46
-
47
- * Generating a framework with Rspec and Appium for Android
48
-
49
- * Generating a framework with Cucumber and Appium for Android
50
-
51
- * Generating a framework with Rspec and Appium cross platform
52
-
53
- * Generating a framework with Cucumber and Appium cross platform
54
-
55
- * Generating a visual testing framework with Rspec, Applitools and Selenium
56
-
57
- * Generating a visual testing framework with Cucumber, Applitools and Selenium
58
-
59
- * Generating a mobile testing framework with Rspec and Sparkling Watir for IOS
60
-
61
- * Generating a mobile testing framework with Cucumber and Sparkling Watir for IOS
62
46
 
63
47
  ***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
64
- ***Remember to use the full path of the app that you download in the capabilities file***
65
-
48
+ ***Remember to use the full path of the app that you download in the capabilities file and start the server using one of the commands below:***
49
+ ```ruby
50
+ raider u start_appium
51
+ appium --base-path /wd/hub
52
+ ```
66
53
  ***In order to run the visual tests with applitools, you need to create an account and get your api key, you can read
67
54
  more [here](https://applitools.com/docs/topics/overview/obtain-api-key.html#:~:text=If%20you%20already%20have%20an,Your%20key%20will%20be%20displayed.)
68
55
  .***
@@ -98,13 +85,12 @@ Select the ones you will like to work with.
98
85
  ###### Anything between square brackets([...]) is where your imput goes
99
86
 
100
87
  ```ruby
101
- Commands :
88
+ Commands:
102
89
  raider generate # Provides access to all the generators commands
103
- raider help [COMMAND] # Describe available commands or one specific command
104
- raider new [PROJECT_NAME] # Creates a new framework based on settings picked
105
- raider open_ai # Provides access to all the open ai commands
106
- raider utility # Provides access to all the utility commands
107
- raider version # It shows the version of Ruby Raider you are currently using
90
+ raider help [COMMAND] # Describe available commands or one specific command
91
+ raider new [PROJECT_NAME] # Creates a new framework based on settings picked
92
+ raider open_ai # Provides access to all the open ai commands
93
+ raider utility # Provides access to all the utility commands raider version # It shows the version of Ruby Raider you are currently using
108
94
  ```
109
95
 
110
96
  All the basic commands have their corresponding shortcut:
@@ -134,6 +120,12 @@ raider u path [PATH_NAME] - -helper or -h
134
120
 
135
121
  If you don't specify an option, path will assume you want to change the default path for pages.
136
122
 
123
+ ### Appium Server Command
124
+ To initialise Appium server run this command:
125
+ ```ruby
126
+ raider u start_appium
127
+ ```
128
+
137
129
  ### Open AI Commands
138
130
 
139
131
  ```ruby
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+ require 'faraday'
2
3
  require_relative '../open_ai/open_ai'
3
4
 
4
5
  class OpenAiCommands < Thor
@@ -58,4 +59,27 @@ class OpenAiCommands < Thor
58
59
  make(options[:open_ai], "#{path}/#{name}_steps.rb")
59
60
  end
60
61
  end
62
+
63
+ desc 'test', 'Uses open AI to create a file or generate output'
64
+ def test
65
+ conn = Faraday.new(url: 'https://api.openai.com') do |faraday|
66
+ faraday.headers['Content-Type'] = 'application/json'
67
+ faraday.headers['Authorization'] = "Bearer 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"
68
+ faraday.headers['OpenAI-Beta'] = 'assistants=v1'
69
+ end
70
+
71
+ # Data payload for the POST request
72
+ payload = {
73
+ instructions: "You are a personal math tutor. When asked a question, write and run Python code to answer the question.",
74
+ name: "Math Tutor",
75
+ tools: [{ type: "code_interpreter" }],
76
+ model: "gpt-4-1106-preview"
77
+ }
78
+
79
+ # Perform the POST request
80
+ response = conn.post('/v1/assistants', payload.to_json)
81
+
82
+ # Output the response body
83
+ puts response.body
84
+ end
61
85
  end
@@ -87,4 +87,9 @@ class UtilityCommands < Thor
87
87
  Utilities.download_android_build
88
88
  Utilities.download_ios_build
89
89
  end
90
+
91
+ desc 'start_appium', 'It starts the appium server'
92
+ def start_appium
93
+ system 'appium --base-path /wd/hub'
94
+ end
90
95
  end
@@ -31,14 +31,8 @@ jobs:
31
31
  - name: Create allure-results folder
32
32
  run: mkdir -p allure-results
33
33
 
34
- - name: Create screenshots folder
35
- run: mkdir -p allure-results/screenshots
36
-
37
- - name: Prepare the browser options
38
- run: raider utility browser_options headless no-sandbox window-size=1920,1080
39
-
40
34
  - name: Build and test with rspec
41
- run: <%- if framework == 'cucumber' -%>cucumber features --format pretty <%- else -%>bundle exec rspec spec --format documentation<%- end %>
35
+ run: <%- if framework == 'cucumber' -%>cucumber features --format pretty <%- else -%>bundle exec rspec spec --format documentation<%- end -%>
42
36
 
43
37
  - name: Get Allure history
44
38
  uses: actions/checkout@v2
@@ -36,8 +36,4 @@ class CommonGenerator < Generator
36
36
  def create_allure_folder
37
37
  empty_directory "#{name}/allure-results"
38
38
  end
39
-
40
- def create_screenshots_folder
41
- empty_directory "#{name}/allure-results/screenshots"
42
- end
43
39
  end
@@ -1,4 +1,5 @@
1
1
  <%- if automation == 'sparkling_ios' -%>
2
+ require 'tmpdir'
2
3
  require_relative '../../helpers/allure_helper'
3
4
  require_relative '../../helpers/driver_helper'
4
5
 
@@ -10,11 +11,14 @@ Before do
10
11
  end
11
12
 
12
13
  After do |scenario|
13
- app.screenshot.save("allure-results/screenshots/#{scenario.name}.png")
14
- AllureHelper.add_screenshot(scenario.name)
14
+ Dir.mktmpdir do |temp_folder|
15
+ screenshot = app.screenshot.save("#{temp_folder}/#{scenario.name}.png")
16
+ AllureHelper.add_screenshot(scenario.name, screenshot)
17
+ end
15
18
  app.close
16
19
  end
17
20
  <%- else -%>
21
+ require 'tmpdir'
18
22
  require_relative '../../helpers/allure_helper'
19
23
  require_relative '../../helpers/driver_helper'
20
24
 
@@ -26,8 +30,10 @@ Before do
26
30
  end
27
31
 
28
32
  After do |scenario|
29
- driver.screenshot("allure-results/screenshots/#{scenario.name}.png")
30
- AllureHelper.add_screenshot(scenario.name)
33
+ Dir.mktmpdir do |temp_folder|
34
+ screenshot = driver.screenshot("#{temp_folder}/#{scenario.name}.png")
35
+ AllureHelper.add_screenshot(scenario.name, screenshot)
36
+ end
31
37
  driver.quit_driver
32
38
  end
33
- <%- end -%>
39
+ <%- end -%>
@@ -19,8 +19,11 @@ end
19
19
  <%- else -%>
20
20
  # frozen_string_literal: true
21
21
 
22
- require_relative '../../page_objects/pages/home_page'
23
- require_relative '../../page_objects/pages/pdp_page'
22
+ <% if automation == 'cross_platform' -%>
23
+ require_relative '../../helpers/appium_helper'
24
+ <%- end -%>
25
+ require_relative '../../page_objects/pages/home'
26
+ require_relative '../../page_objects/pages/pdp'
24
27
 
25
28
  Given("I'm an anonymous user on the home page") do
26
29
  @home_page = Home.new(driver)
@@ -1,6 +1,7 @@
1
1
  <%- if visual_automation -%>
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'tmpdir'
4
5
  require_relative '../../helpers/allure_helper'
5
6
  require_relative '../../helpers/driver_helper'
6
7
  require_relative '../../helpers/visual_helper'
@@ -17,8 +18,10 @@ Before do
17
18
  end
18
19
 
19
20
  After do |scenario|
20
- driver.save_screenshot("allure-results/screenshots/#{scenario.name}.png")
21
- AllureHelper.add_screenshot(scenario.name)
21
+ Dir.mktmpdir do |temp_folder|
22
+ screenshot = driver.save_screenshot("#{temp_folder}/#{scenario.name}.png")
23
+ AllureHelper.add_screenshot(scenario.name, screenshot)
24
+ end
22
25
  @eyes.close
23
26
  @driver.quit
24
27
  @eyes.abort_async
@@ -29,6 +32,7 @@ end
29
32
  <%- else -%>
30
33
  # frozen_string_literal: true
31
34
 
35
+ require 'tmpdir'
32
36
  require_relative '../../helpers/driver_helper'
33
37
  require_relative '../../helpers/allure_helper'
34
38
 
@@ -39,8 +43,10 @@ Before do
39
43
  end
40
44
 
41
45
  After do |scenario|
42
- driver.save_screenshot("allure-results/screenshots/#{scenario.name}.png")
43
- AllureHelper.add_screenshot(scenario.name)
46
+ Dir.mktmpdir do |temp_folder|
47
+ screenshot = driver.save_screenshot("#{temp_folder}/#{scenario.name}.png")
48
+ AllureHelper.add_screenshot(scenario.name, screenshot)
49
+ end
44
50
  driver.quit
45
51
  end
46
- <%- end -%>
52
+ <%- end -%>
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'tmpdir'
3
4
  require_relative '../../helpers/allure_helper'
4
5
  require_relative '../../helpers/browser_helper'
5
6
 
@@ -10,7 +11,9 @@ Before do
10
11
  end
11
12
 
12
13
  After do |scenario|
13
- browser.screenshot.save("allure-results/screenshots/#{scenario.name}.png")
14
- AllureHelper.add_screenshot(scenario.name)
14
+ Dir.mktmpdir do |temp_folder|
15
+ screenshot = browser.screenshot.save("#{temp_folder}/#{scenario.name}.png")
16
+ AllureHelper.add_screenshot(scenario.name, screenshot)
17
+ end
15
18
  browser.quit
16
19
  end
@@ -60,6 +60,9 @@ class PdpSpec
60
60
  end
61
61
  end
62
62
  <%- else -%>
63
+ <% if automation == 'cross_platform' -%>
64
+ require_relative '../helpers/appium_helper'
65
+ <%- end -%>
63
66
  require_relative '../helpers/spec_helper'
64
67
  require_relative '../page_objects/pages/home'
65
68
  require_relative '../page_objects/pages/pdp'
@@ -1,5 +1,5 @@
1
1
  <% if %w[ios android cross_platform].include?(automation) -%>
2
2
  <%= ERB.new(File.read(File.expand_path('./partials/mobile_config.tt', __dir__))).result(binding) %>
3
3
  <% else -%>
4
- <%= ERB.new(File.read(File.expand_path('./partials/web_config.tt', __dir__))).result(binding) %>
4
+ <%= ERB.new(File.read(File.expand_path('./partials/web_config.tt', __dir__)), trim_mode: '-').result(binding) %>
5
5
  <% end -%>
@@ -1,3 +1,17 @@
1
1
  browser: :chrome
2
2
  url: 'https://automationteststore.com/'
3
3
 
4
+ <%- if automation == 'selenium' -%>
5
+ driver_options:
6
+ :timeouts:
7
+ :implicit: 10000 # 10 seconds
8
+ <% end -%>
9
+
10
+ browser_arguments:
11
+ :chrome:
12
+ - no-sandbox
13
+ - disable-dev-shm-usage
14
+ - ignore-certificate-errors
15
+ :firefox:
16
+ - acceptInsecureCerts
17
+ - no-sandbox
@@ -1,5 +1,9 @@
1
1
  # Ruby Raider
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/ruby_raider.svg)](https://badge.fury.io/rb/ruby_raider)
4
+ [![Rubocop](https://github.com/RubyRaider/ruby_raider/actions/workflows/rspec.yml/badge.svg)](https://github.com/RubyRaider/ruby_raider/actions/workflows/rspec.yml)
5
+ [![Gitter](https://badges.gitter.im/RubyRaider/community.svg)](https://gitter.im/RubyRaider/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
6
+
3
7
  <!-- PROJECT LOGO -->
4
8
  <br />
5
9
  <div align="center">
@@ -22,39 +26,23 @@
22
26
  <p align="center"> For more information and updates on releases, see <a href="https://ruby-raider.com">https://ruby-raider.com</a></p>
23
27
  </div>
24
28
 
25
- ## What is ruby raider?
29
+ ## What is Ruby Raider?
26
30
 
27
31
  Ruby Raider is a generator and scaffolding gem to make UI test automation easier
28
32
 
29
- ### At the moment Ruby raider supports
30
-
31
- * Generating a framework with Cucumber and Selenium
32
-
33
- * Generating a framework with Rspec and Selenium
34
-
35
- * Generating a framework with Cucumber and Watir
36
-
37
- * Generating a framework with Rspec and Watir
38
-
39
- * Generating a framework with Rspec and Appium for IOS
40
-
41
- * Generating a framework with Cucumber and Appium for IOS
42
-
43
- * Generating a framework with Rspec and Appium for Android
44
-
45
- * Generating a framework with Cucumber and Appium for Android
46
-
47
- * Generating a framework with Rspec and Appium cross platform
48
-
49
- * Generating a framework with Cucumber and Appium cross platform
50
-
51
- * Generating a visual testing framework with Rspec, Applitools and Selenium
52
-
53
- * Generating a visual testing framework with Cucumber, Applitools and Selenium
33
+ ### At the moment Ruby Raider supports generating the following frameworks:
34
+ | Web Testing Framework | Visual Testing Framework | Mobile Testing Framework |
35
+ |----------------------------|---------------------------------------------|-------------------------------------------|
36
+ | Cucumber and Selenium | Cucumber, Applitools and Selenium | Cucumber and Appium for IOS |
37
+ | Rspec and Selenium | Rspec, Applitools and Selenium | Rspec and Appium for IOS |
38
+ | Cucumber and Watir | | Cucumber and Appium for Android |
39
+ | Rspec and Watir | | Rspec and Appium for Android |
40
+ | | | Cucumber and Appium Cross-platform |
41
+ | | | Rspec and Appium Cross-platform |
42
+ | | | Cucumber and Sparkling Watir for IOS |
43
+ | | | Rspec and Sparkling Watir for IOS |
54
44
 
55
- * Generating a mobile testing framework with Rspec and Sparkling Watir for IOS
56
45
 
57
- * Generating a mobile testing framework with Cucumber and Sparkling Watir for IOS
58
46
 
59
47
  ***In order to run the Appium tests, download the example [app](https://github.com/saucelabs/my-demo-app-rn).***
60
48
  ***Remember to use the full path of the app that you download in the capabilities file***
@@ -95,7 +83,7 @@ Select the ones you will like to work with.
95
83
 
96
84
  ```ruby
97
85
  Commands :
98
- raider generate # Provides access to all the generators commands
86
+ raider generate # Provides access to all the generators commands
99
87
  raider help [COMMAND] # Describe available commands or one specific command
100
88
  raider new [PROJECT_NAME] # Creates a new framework based on settings picked
101
89
  raider open_ai # Provides access to all the open ai commands
@@ -13,10 +13,10 @@ module AllureHelper
13
13
  end
14
14
  end
15
15
 
16
- def add_screenshot(screenshot_name)
16
+ def add_screenshot(name, file)
17
17
  Allure.add_attachment(
18
- name: name,
19
- source: File.open("allure-results/screenshots/#{screenshot_name}.png"),
18
+ name:,
19
+ source: file,
20
20
  type: Allure::ContentType::PNG,
21
21
  test_case: true
22
22
  )
@@ -28,4 +28,4 @@ module AllureHelper
28
28
  end
29
29
  <%- end -%>
30
30
  end
31
- end
31
+ end
@@ -11,10 +11,12 @@ module BrowserHelper
11
11
 
12
12
  private
13
13
 
14
+ def config
15
+ @config ||= YAML.load_file('config/config.yml')
16
+ end
17
+
14
18
  def create_browser(*args)
15
- @config = YAML.load_file('config/config.yml')
16
- browser = @config['browser'].to_sym
17
- args = args.empty? ? @config['browser_options'] : args
18
- @browser = Watir::Browser.new(browser, options: { args: args })
19
+ args = args.empty? ? config['browser_arguments'][config['browser']] : args
20
+ Watir::Browser.new(config['browser'], options: { args: args })
19
21
  end
20
- end
22
+ end
@@ -2,20 +2,24 @@
2
2
  def create_driver(*opts)
3
3
  @config = YAML.load_file('config/config.yml')
4
4
  browser = @config['browser'].to_sym
5
- Selenium::WebDriver.for(browser, options: browser_options(*opts))
5
+ Selenium::WebDriver.for(browser, options: create_webdriver_options(*opts))
6
6
  end
7
7
 
8
- def browser_options(*opts)
9
- opts = opts.empty? ? @config['browser_options'] : opts
10
- create_options(*opts)
8
+ def browser_arguments(*opts)
9
+ opts.empty? ? @config['browser_arguments'][@config['browser']] : opts
10
+ end
11
+
12
+ def driver_options
13
+ @config['driver_options']
11
14
  end
12
15
 
13
16
  # :reek:FeatureEnvy
14
- def create_options(*opts)
17
+ def create_webdriver_options(*opts)
15
18
  load_browser = @config['browser'].to_s
16
19
  browser = load_browser == 'ie' ? load_browser.upcase : load_browser.capitalize
17
20
  options = "Selenium::WebDriver::#{browser}::Options".constantize.new
18
- opts.each { |option| options.add_argument(option) }
21
+ browser_arguments(*opts).each { |arg| options.add_argument(arg) }
22
+ driver_options.each { |opt| options.add_option(opt.first, opt.last) }
19
23
  options
20
24
  end
21
25
 
@@ -1,8 +1,8 @@
1
1
  <% case automation
2
2
  when 'selenium' %>
3
- driver.save_screenshot("allure-results/screenshots/#{example_name}.png")
3
+ screenshot = driver.save_screenshot("#{temp_folder}/#{example_name}.png")
4
4
  <% when 'watir' %>
5
- browser.screenshot.save("allure-results/screenshots/#{example_name}.png")
5
+ screenshot = browser.screenshot.save("#{temp_folder}/#{example_name}.png")
6
6
  <% else %>
7
- driver.screenshot("allure-results/screenshots/#{example_name}.png")
8
- <% end %>
7
+ screenshot = driver.screenshot("#{temp_folder}/#{example_name}.png")
8
+ <% end %>
@@ -2,6 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'rspec'
5
+ require 'tmpdir'
5
6
  require_relative 'allure_helper'
6
7
  require_relative 'driver_helper'
7
8
  require 'sparkling_watir'
@@ -16,10 +17,12 @@ module SpecHelper
16
17
  app
17
18
  end
18
19
 
19
- config.after(:each) do
20
- example_name = self.class.descendant_filtered_examples.first.description
21
- app.screenshot.save("allure-results/screenshots/#{example_name}.png")
22
- AllureHelper.add_screenshot example_name
20
+ config.after(:each) do |example|
21
+ example_name = example.description
22
+ Dir.mktmpdir do |temp_folder|
23
+ screenshot = app.screenshot.save("#{temp_folder}/#{example_name}.png")
24
+ AllureHelper.add_screenshot(example_name, screenshot)
25
+ end
23
26
  app.close
24
27
  end
25
28
  end
@@ -28,6 +31,7 @@ end
28
31
  # frozen_string_literal: true
29
32
 
30
33
  require 'rspec'
34
+ require 'tmpdir'
31
35
  require_relative 'allure_helper'
32
36
  <%- if automation == 'watir' -%>
33
37
  require_relative 'browser_helper'
@@ -55,12 +59,14 @@ module SpecHelper
55
59
  end
56
60
  <%- end -%>
57
61
 
58
- config.after(:each) do
59
- example_name = self.class.descendant_filtered_examples.first.description
60
- <%= ERB.new(File.read(File.expand_path('./partials/screenshot.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
61
- AllureHelper.add_screenshot example_name
62
+ config.after(:each) do |example|
63
+ example_name = example.description
64
+ Dir.mktmpdir do |temp_folder|
65
+ <%= ERB.new(File.read(File.expand_path('./partials/screenshot.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
66
+ AllureHelper.add_screenshot(example_name, screenshot)
67
+ end
62
68
  <%= ERB.new(File.read(File.expand_path('./partials/quit_driver.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
63
69
  end
64
70
  end
65
71
  end
66
- <%- end -%>
72
+ <%- end -%>
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rspec'
4
+ require 'tmpdir'
4
5
  require 'eyes_selenium'
5
6
  require_relative 'allure_helper'
6
7
  require_relative 'driver_helper'
@@ -18,13 +19,15 @@ module SpecHelper
18
19
  @driver = @eyes.open(driver: driver)
19
20
  end
20
21
 
21
- config.after(:each) do
22
- example_name = self.class.descendant_filtered_examples.first.description
23
- driver.save_screenshot("allure-results/screenshots/#{example_name}.png")
22
+ config.after(:each) do |example|
23
+ example_name = example.description
24
+ Dir.mktmpdir do |temp_folder|
25
+ <%= ERB.new(File.read(File.expand_path('./partials/screenshot.tt', __dir__)), trim_mode: '-').result(binding).strip! %>
26
+ AllureHelper.add_screenshot(example_name, screenshot)
27
+ end
24
28
  @eyes.close
25
29
  @driver.quit
26
30
  @eyes.abort_async
27
- AllureHelper.add_screenshot example_name
28
31
  results = @grid_runner.get_all_test_results
29
32
  puts results
30
33
  end
@@ -14,12 +14,12 @@ module OpenAi
14
14
 
15
15
  def configure_client
16
16
  OpenAI.configure do |config|
17
- config.access_token = ENV.fetch('OPENAI_ACCESS_TOKEN')
17
+ config.access_token = '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'
18
18
  config.organization_id = ENV.fetch('OPENAI_ORGANIZATION_ID', nil)
19
19
  end
20
20
  end
21
21
 
22
- def input(request, model = 'gpt-3.5-turbo', temperature = 0.7)
22
+ def input(request, model = 'gpt-4', temperature = 0.7)
23
23
  client.chat(
24
24
  parameters: {
25
25
  model: model,
data/lib/ruby_raider.rb CHANGED
@@ -19,7 +19,7 @@ module RubyRaider
19
19
  desc 'version', 'It shows the version of Ruby Raider you are currently using'
20
20
 
21
21
  def version
22
- puts 'The Ruby Raider version is 0.8.2, Happy testing!'
22
+ puts "The version is #{parsed_version}, happy testing!"
23
23
  end
24
24
 
25
25
  map 'v' => 'version'
@@ -35,5 +35,10 @@ module RubyRaider
35
35
  desc 'utility', 'Provides access to all the utility commands'
36
36
  subcommand 'utility', UtilityCommands
37
37
  map 'u' => 'utility'
38
+
39
+ no_commands do
40
+ def gemspec = Gem::Specification.load('ruby_raider.gemspec')
41
+ def parsed_version = Gem::Version.new(gemspec.version)
42
+ end
38
43
  end
39
44
  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.8.2'
5
+ s.version = '0.8.5'
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']
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'rubocop-performance', '~> 1.15.0'
22
22
  s.add_development_dependency 'rubocop-rspec', '~> 2.9.0'
23
23
 
24
- s.add_runtime_dependency 'faraday', '~> 2.7', '>= 2.7.10'
24
+ s.add_runtime_dependency 'faraday', '~> 1.10.0'
25
25
  s.add_runtime_dependency 'ruby-openai', '~> 3.5'
26
26
  s.add_runtime_dependency 'thor', '~> 1.2.1'
27
27
  s.add_runtime_dependency 'tty-prompt', '~> 0.23.1'
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.2
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Agustin Pequeno
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-20 00:00:00.000000000 Z
11
+ date: 2024-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -114,20 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: '2.7'
118
- - - ">="
119
- - !ruby/object:Gem::Version
120
- version: 2.7.10
117
+ version: 1.10.0
121
118
  type: :runtime
122
119
  prerelease: false
123
120
  version_requirements: !ruby/object:Gem::Requirement
124
121
  requirements:
125
122
  - - "~>"
126
123
  - !ruby/object:Gem::Version
127
- version: '2.7'
128
- - - ">="
129
- - !ruby/object:Gem::Version
130
- version: 2.7.10
124
+ version: 1.10.0
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: ruby-openai
133
127
  requirement: !ruby/object:Gem::Requirement
@@ -308,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
308
302
  - !ruby/object:Gem::Version
309
303
  version: '0'
310
304
  requirements: []
311
- rubygems_version: 3.4.19
305
+ rubygems_version: 3.4.10
312
306
  signing_key:
313
307
  specification_version: 4
314
308
  summary: A gem to make setup and start of UI automation projects easier