SaudeiD 0.2.4 → 0.2.7
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/azure-pipelines.yaml +36 -33
- data/bin/SaudeiD +146 -146
- data/credentials +2 -0
- data/lib/SaudeiD/SaudeiD_helper.rb +41 -41
- data/lib/SaudeiD/version.rb +1 -1
- data/lib/SkeletonApi/.gitignore +1 -1
- data/lib/SkeletonApi/.rubocop.yml +62 -62
- data/lib/SkeletonApi/.solargraph.yml +16 -16
- data/lib/SkeletonApi/Gemfile +18 -18
- data/lib/SkeletonApi/README.md +36 -36
- data/lib/SkeletonApi/cucumber.yml +11 -11
- data/lib/SkeletonApi/features/support/config/environments/dev.yml +5 -5
- data/lib/SkeletonApi/features/support/config/environments/qa.yml +5 -5
- data/lib/SkeletonApi/features/support/env.rb +28 -28
- data/lib/SkeletonApi/features/support/helper.rb +6 -6
- data/lib/SkeletonApi/features/support/hooks.rb +53 -53
- data/lib/SkeletonWeb/.gitignore +7 -7
- data/lib/SkeletonWeb/.rubocop.yml +52 -52
- data/lib/SkeletonWeb/.solargraph.yml +16 -16
- data/lib/SkeletonWeb/Gemfile +13 -13
- data/lib/SkeletonWeb/README.md +49 -49
- data/lib/SkeletonWeb/cucumber.yml +16 -16
- data/lib/SkeletonWeb/features/support/config/elements.yml +2 -2
- data/lib/SkeletonWeb/features/support/env.rb +49 -49
- data/lib/SkeletonWeb/features/support/helper.rb +37 -37
- data/lib/SkeletonWeb/features/support/hooks.rb +56 -56
- data/lib/SkeletonWeb/features/support/pages/base_page.rb +3 -3
- data/lib/locales/en.yml +16 -16
- data/lib/locales/pt.yml +15 -15
- data/lib/templates/feature.tt +8 -8
- data/lib/templates/page.tt +8 -8
- data/lib/templates/services.tt +10 -10
- data/lib/templates/steps.tt +5 -5
- metadata +8 -7
@@ -1,49 +1,49 @@
|
|
1
|
-
require 'awesome_print'
|
2
|
-
require 'capybara'
|
3
|
-
require 'capybara/cucumber'
|
4
|
-
require 'capybara/rspec'
|
5
|
-
require 'date'
|
6
|
-
require 'dotenv/load'
|
7
|
-
require 'pry'
|
8
|
-
require 'report_builder'
|
9
|
-
require 'rspec'
|
10
|
-
require 'rspec/expectations'
|
11
|
-
require 'selenium-webdriver'
|
12
|
-
require 'touch_action'
|
13
|
-
|
14
|
-
require_relative 'helper'
|
15
|
-
|
16
|
-
include Helper
|
17
|
-
|
18
|
-
CONFIG = YAML.load_file(File.join(Dir.pwd, "features/support/config/environments/#{ENV['ENV_TYPE']}.yml"))
|
19
|
-
EL = YAML.load_file('features/support/config/elements.yml')
|
20
|
-
|
21
|
-
@browser = ENV['BROWSER']
|
22
|
-
|
23
|
-
case @browser
|
24
|
-
when 'firefox'
|
25
|
-
@driver = :selenium
|
26
|
-
when 'firefox_headless'
|
27
|
-
@driver = :selenium_headless
|
28
|
-
when 'chrome'
|
29
|
-
@driver = :selenium_chrome
|
30
|
-
when 'chrome_headless'
|
31
|
-
Capybara.register_driver :selenium_chrome_headless do |app|
|
32
|
-
chrome_options = Selenium::WebDriver::Chrome::Options.new.tap do |options|
|
33
|
-
options.add_argument '--headless'
|
34
|
-
options.add_argument '--disable-gpu'
|
35
|
-
options.add_argument '--no-sandbox'
|
36
|
-
options.add_argument '--disable-site-isolation-trials'
|
37
|
-
end
|
38
|
-
Capybara::Selenium::Driver.new(app, browser: :chrome, options: chrome_options)
|
39
|
-
end
|
40
|
-
@driver = :selenium_chrome_headless
|
41
|
-
else
|
42
|
-
p 'Invalid browser'
|
43
|
-
end
|
44
|
-
|
45
|
-
Capybara.configure do |config|
|
46
|
-
config.default_driver = @driver
|
47
|
-
config.app_host = CONFIG['URL_BASE']
|
48
|
-
config.default_max_wait_time = 15
|
49
|
-
end
|
1
|
+
require 'awesome_print'
|
2
|
+
require 'capybara'
|
3
|
+
require 'capybara/cucumber'
|
4
|
+
require 'capybara/rspec'
|
5
|
+
require 'date'
|
6
|
+
require 'dotenv/load'
|
7
|
+
require 'pry'
|
8
|
+
require 'report_builder'
|
9
|
+
require 'rspec'
|
10
|
+
require 'rspec/expectations'
|
11
|
+
require 'selenium-webdriver'
|
12
|
+
require 'touch_action'
|
13
|
+
|
14
|
+
require_relative 'helper'
|
15
|
+
|
16
|
+
include Helper
|
17
|
+
|
18
|
+
CONFIG = YAML.load_file(File.join(Dir.pwd, "features/support/config/environments/#{ENV['ENV_TYPE']}.yml"))
|
19
|
+
EL = YAML.load_file('features/support/config/elements.yml')
|
20
|
+
|
21
|
+
@browser = ENV['BROWSER']
|
22
|
+
|
23
|
+
case @browser
|
24
|
+
when 'firefox'
|
25
|
+
@driver = :selenium
|
26
|
+
when 'firefox_headless'
|
27
|
+
@driver = :selenium_headless
|
28
|
+
when 'chrome'
|
29
|
+
@driver = :selenium_chrome
|
30
|
+
when 'chrome_headless'
|
31
|
+
Capybara.register_driver :selenium_chrome_headless do |app|
|
32
|
+
chrome_options = Selenium::WebDriver::Chrome::Options.new.tap do |options|
|
33
|
+
options.add_argument '--headless'
|
34
|
+
options.add_argument '--disable-gpu'
|
35
|
+
options.add_argument '--no-sandbox'
|
36
|
+
options.add_argument '--disable-site-isolation-trials'
|
37
|
+
end
|
38
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome, options: chrome_options)
|
39
|
+
end
|
40
|
+
@driver = :selenium_chrome_headless
|
41
|
+
else
|
42
|
+
p 'Invalid browser'
|
43
|
+
end
|
44
|
+
|
45
|
+
Capybara.configure do |config|
|
46
|
+
config.default_driver = @driver
|
47
|
+
config.app_host = CONFIG['URL_BASE']
|
48
|
+
config.default_max_wait_time = 15
|
49
|
+
end
|
@@ -1,37 +1,37 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# !/usr/bin/env ruby
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
module Helper
|
6
|
-
include Capybara::DSL
|
7
|
-
|
8
|
-
def take_screenshot(scenario)
|
9
|
-
scn_name = scenario.name.gsub(%r{([_@#!%()\-=;><,{}\~\[\]\.\/\?\"\*\^\$\+\-]+)}, '_')
|
10
|
-
screenshot = scenario.failed? ? "#{Dir.pwd}/report/screenshots/test_failed/#{scn_name}.png" : "#{Dir.pwd}/report/screenshots/test_passed/#{scn_name}.png"
|
11
|
-
screenshot = screenshot.tr!(' ', '_') if screenshot.include?(' ')
|
12
|
-
page.save_screenshot(screenshot)
|
13
|
-
attach(screenshot, 'image/png')
|
14
|
-
end
|
15
|
-
|
16
|
-
def wait_until_text_exist(element, text)
|
17
|
-
300.times do
|
18
|
-
find(element).assert_text(text) == true
|
19
|
-
break
|
20
|
-
rescue StandardError
|
21
|
-
sleep 0.1
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def wait_until_element_exist(element)
|
26
|
-
300.times do
|
27
|
-
find(element, wait: 0.5)
|
28
|
-
break
|
29
|
-
rescue StandardError
|
30
|
-
sleep 0.1
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def element_wait(time)
|
35
|
-
sleep(time)
|
36
|
-
end
|
37
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
# !/usr/bin/env ruby
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Helper
|
6
|
+
include Capybara::DSL
|
7
|
+
|
8
|
+
def take_screenshot(scenario)
|
9
|
+
scn_name = scenario.name.gsub(%r{([_@#!%()\-=;><,{}\~\[\]\.\/\?\"\*\^\$\+\-]+)}, '_')
|
10
|
+
screenshot = scenario.failed? ? "#{Dir.pwd}/report/screenshots/test_failed/#{scn_name}.png" : "#{Dir.pwd}/report/screenshots/test_passed/#{scn_name}.png"
|
11
|
+
screenshot = screenshot.tr!(' ', '_') if screenshot.include?(' ')
|
12
|
+
page.save_screenshot(screenshot)
|
13
|
+
attach(screenshot, 'image/png')
|
14
|
+
end
|
15
|
+
|
16
|
+
def wait_until_text_exist(element, text)
|
17
|
+
300.times do
|
18
|
+
find(element).assert_text(text) == true
|
19
|
+
break
|
20
|
+
rescue StandardError
|
21
|
+
sleep 0.1
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def wait_until_element_exist(element)
|
26
|
+
300.times do
|
27
|
+
find(element, wait: 0.5)
|
28
|
+
break
|
29
|
+
rescue StandardError
|
30
|
+
sleep 0.1
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def element_wait(time)
|
35
|
+
sleep(time)
|
36
|
+
end
|
37
|
+
end
|
@@ -1,56 +1,56 @@
|
|
1
|
-
Before do
|
2
|
-
window = Capybara.current_session.current_window
|
3
|
-
window.resize_to(1366, 768)
|
4
|
-
window.maximize
|
5
|
-
|
6
|
-
@page = ->(klass) { klass.new }
|
7
|
-
end
|
8
|
-
|
9
|
-
After do |scenario|
|
10
|
-
take_screenshot(scenario)
|
11
|
-
|
12
|
-
exception_message(scenario)
|
13
|
-
end
|
14
|
-
|
15
|
-
def exception_message(scenario)
|
16
|
-
scene = scenario.failed?
|
17
|
-
return unless scene == true
|
18
|
-
|
19
|
-
print_reason(scenario)
|
20
|
-
end
|
21
|
-
|
22
|
-
def print_reason(scenario)
|
23
|
-
log("\n-------------")
|
24
|
-
log("\nINCONSISTENCY")
|
25
|
-
log("\n-------------")
|
26
|
-
log("\n🔥🔥🔥 #{scenario.exception.message.split('(')[0]}")
|
27
|
-
end
|
28
|
-
|
29
|
-
AfterConfiguration do |config|
|
30
|
-
config.on_event(:test_case_finished) do |event|
|
31
|
-
puts "\n--------------------------------------------------------------------------------------------------"
|
32
|
-
puts 'Results:'
|
33
|
-
puts " - Scenario: #{event.test_case.name}"
|
34
|
-
puts " - Result..: [ #{event.result.passed? ? '✅ ]' : '❌ ]'}"
|
35
|
-
puts "--------------------------------------------------------------------------------------------------\n"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
at_exit do
|
40
|
-
@infos = {
|
41
|
-
'Browser' => Capybara.default_driver.to_s.capitalize,
|
42
|
-
'Environment' => ENV['ENV_TYPE'],
|
43
|
-
'Data do Teste' => Time.now.strftime('%d/%B/%Y'),
|
44
|
-
'Hora do Teste' => Time.now.strftime('%H:%M:%S')
|
45
|
-
}
|
46
|
-
|
47
|
-
ReportBuilder.configure do |config|
|
48
|
-
config.input_path = 'report/report.json'
|
49
|
-
config.report_path = 'report/report'
|
50
|
-
config.report_types = [:html]
|
51
|
-
config.report_title = '[SaudeId] - My Title'
|
52
|
-
config.additional_info = @infos
|
53
|
-
config.color = 'indigo'
|
54
|
-
end
|
55
|
-
ReportBuilder.build_report
|
56
|
-
end
|
1
|
+
Before do
|
2
|
+
window = Capybara.current_session.current_window
|
3
|
+
window.resize_to(1366, 768)
|
4
|
+
window.maximize
|
5
|
+
|
6
|
+
@page = ->(klass) { klass.new }
|
7
|
+
end
|
8
|
+
|
9
|
+
After do |scenario|
|
10
|
+
take_screenshot(scenario)
|
11
|
+
|
12
|
+
exception_message(scenario)
|
13
|
+
end
|
14
|
+
|
15
|
+
def exception_message(scenario)
|
16
|
+
scene = scenario.failed?
|
17
|
+
return unless scene == true
|
18
|
+
|
19
|
+
print_reason(scenario)
|
20
|
+
end
|
21
|
+
|
22
|
+
def print_reason(scenario)
|
23
|
+
log("\n-------------")
|
24
|
+
log("\nINCONSISTENCY")
|
25
|
+
log("\n-------------")
|
26
|
+
log("\n🔥🔥🔥 #{scenario.exception.message.split('(')[0]}")
|
27
|
+
end
|
28
|
+
|
29
|
+
AfterConfiguration do |config|
|
30
|
+
config.on_event(:test_case_finished) do |event|
|
31
|
+
puts "\n--------------------------------------------------------------------------------------------------"
|
32
|
+
puts 'Results:'
|
33
|
+
puts " - Scenario: #{event.test_case.name}"
|
34
|
+
puts " - Result..: [ #{event.result.passed? ? '✅ ]' : '❌ ]'}"
|
35
|
+
puts "--------------------------------------------------------------------------------------------------\n"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
at_exit do
|
40
|
+
@infos = {
|
41
|
+
'Browser' => Capybara.default_driver.to_s.capitalize,
|
42
|
+
'Environment' => ENV['ENV_TYPE'],
|
43
|
+
'Data do Teste' => Time.now.strftime('%d/%B/%Y'),
|
44
|
+
'Hora do Teste' => Time.now.strftime('%H:%M:%S')
|
45
|
+
}
|
46
|
+
|
47
|
+
ReportBuilder.configure do |config|
|
48
|
+
config.input_path = 'report/report.json'
|
49
|
+
config.report_path = 'report/report'
|
50
|
+
config.report_types = [:html]
|
51
|
+
config.report_title = '[SaudeId] - My Title'
|
52
|
+
config.additional_info = @infos
|
53
|
+
config.color = 'indigo'
|
54
|
+
end
|
55
|
+
ReportBuilder.build_report
|
56
|
+
end
|
@@ -1,3 +1,3 @@
|
|
1
|
-
class BasePage
|
2
|
-
include Capybara::DSL
|
3
|
-
end
|
1
|
+
class BasePage
|
2
|
+
include Capybara::DSL
|
3
|
+
end
|
data/lib/locales/en.yml
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
en:
|
2
|
-
first_scenario: "First Scenario"
|
3
|
-
background: "Background"
|
4
|
-
feature: "Feature"
|
5
|
-
scenario: "Scenario"
|
6
|
-
given: "Given"
|
7
|
-
when: "When"
|
8
|
-
then: "Then"
|
9
|
-
describe: description
|
10
|
-
context: description
|
11
|
-
it: does something
|
12
|
-
comments:
|
13
|
-
insert_steps: "Insert steps"
|
14
|
-
elements: "Declare all the elements of this page"
|
15
|
-
actions: "Declare all actions of this page"
|
16
|
-
services: "Where is the configuration of a particular request"
|
1
|
+
en:
|
2
|
+
first_scenario: "First Scenario"
|
3
|
+
background: "Background"
|
4
|
+
feature: "Feature"
|
5
|
+
scenario: "Scenario"
|
6
|
+
given: "Given"
|
7
|
+
when: "When"
|
8
|
+
then: "Then"
|
9
|
+
describe: description
|
10
|
+
context: description
|
11
|
+
it: does something
|
12
|
+
comments:
|
13
|
+
insert_steps: "Insert steps"
|
14
|
+
elements: "Declare all the elements of this page"
|
15
|
+
actions: "Declare all actions of this page"
|
16
|
+
services: "Where is the configuration of a particular request"
|
17
17
|
|
data/lib/locales/pt.yml
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
pt:
|
2
|
-
first_scenario: "Primeiro Cenário"
|
3
|
-
background: "Contexto"
|
4
|
-
feature: "Funcionalidade"
|
5
|
-
scenario: "Cenário"
|
6
|
-
given: "Dado"
|
7
|
-
when: "Quando"
|
8
|
-
then: "Entao"
|
9
|
-
describe: descrição
|
10
|
-
context: descrição
|
11
|
-
it: faz alguma coisa
|
12
|
-
comments:
|
13
|
-
insert_steps: "Insira os passos"
|
14
|
-
elements: "Declare todos os elementos da página"
|
15
|
-
actions: "Declare todas as ações da página"
|
1
|
+
pt:
|
2
|
+
first_scenario: "Primeiro Cenário"
|
3
|
+
background: "Contexto"
|
4
|
+
feature: "Funcionalidade"
|
5
|
+
scenario: "Cenário"
|
6
|
+
given: "Dado"
|
7
|
+
when: "Quando"
|
8
|
+
then: "Entao"
|
9
|
+
describe: descrição
|
10
|
+
context: descrição
|
11
|
+
it: faz alguma coisa
|
12
|
+
comments:
|
13
|
+
insert_steps: "Insira os passos"
|
14
|
+
elements: "Declare todos os elementos da página"
|
15
|
+
actions: "Declare todas as ações da página"
|
16
16
|
services: "Onde fica as configuraçōes de uma determinada requisição"
|
data/lib/templates/feature.tt
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
<%= "#language: #{options[:lang]}" %>
|
2
|
-
<%= I18n.translate( :feature ) %>: <%= config[:name] %>
|
3
|
-
|
4
|
-
<%= I18n.translate( :background ) %>:
|
5
|
-
# <%= I18n.translate( "comments.insert_steps" ) %>
|
6
|
-
|
7
|
-
<%= I18n.translate( :scenario ) %>: <%= I18n.translate( :first_scenario ) %>
|
8
|
-
# <%= I18n.translate( "comments.insert_steps" ) %>
|
1
|
+
<%= "#language: #{options[:lang]}" %>
|
2
|
+
<%= I18n.translate( :feature ) %>: <%= config[:name] %>
|
3
|
+
|
4
|
+
<%= I18n.translate( :background ) %>:
|
5
|
+
# <%= I18n.translate( "comments.insert_steps" ) %>
|
6
|
+
|
7
|
+
<%= I18n.translate( :scenario ) %>: <%= I18n.translate( :first_scenario ) %>
|
8
|
+
# <%= I18n.translate( "comments.insert_steps" ) %>
|
data/lib/templates/page.tt
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
class <%= config[:name] %>Page < BasePage
|
2
|
-
# attr_reader :element
|
3
|
-
|
4
|
-
def initialize
|
5
|
-
# @element = EL['element']
|
6
|
-
end
|
7
|
-
|
8
|
-
end
|
1
|
+
class <%= config[:name] %>Page < BasePage
|
2
|
+
# attr_reader :element
|
3
|
+
|
4
|
+
def initialize
|
5
|
+
# @element = EL['element']
|
6
|
+
end
|
7
|
+
|
8
|
+
end
|
data/lib/templates/services.tt
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
class <%= config[:name] %>Service
|
2
|
-
include HTTParty
|
3
|
-
|
4
|
-
base_uri CONFIG['BASE_URI']
|
5
|
-
headers CONFIG['API_HEADERS']
|
6
|
-
default_timeout 120
|
7
|
-
|
8
|
-
def initialize() end
|
9
|
-
|
10
|
-
end
|
1
|
+
class <%= config[:name] %>Service
|
2
|
+
include HTTParty
|
3
|
+
|
4
|
+
base_uri CONFIG['BASE_URI']
|
5
|
+
headers CONFIG['API_HEADERS']
|
6
|
+
default_timeout 120
|
7
|
+
|
8
|
+
def initialize() end
|
9
|
+
|
10
|
+
end
|
data/lib/templates/steps.tt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
######### <%= I18n.translate( :given ).upcase %> #########
|
2
|
-
|
3
|
-
######### <%= I18n.translate( :when ).upcase %> #########
|
4
|
-
|
5
|
-
######### <%= I18n.translate( :then ).upcase %> #########
|
1
|
+
######### <%= I18n.translate( :given ).upcase %> #########
|
2
|
+
|
3
|
+
######### <%= I18n.translate( :when ).upcase %> #########
|
4
|
+
|
5
|
+
######### <%= I18n.translate( :then ).upcase %> #########
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SaudeiD
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Raphael Castro
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -116,6 +116,7 @@ files:
|
|
116
116
|
- bin/SaudeiD
|
117
117
|
- bin/console
|
118
118
|
- bin/setup
|
119
|
+
- credentials
|
119
120
|
- lib/SaudeiD.rb
|
120
121
|
- lib/SaudeiD/SaudeiD_helper.rb
|
121
122
|
- lib/SaudeiD/version.rb
|
@@ -164,11 +165,11 @@ files:
|
|
164
165
|
- lib/templates/services.tt
|
165
166
|
- lib/templates/steps.tt
|
166
167
|
- sig/SaudeiD.rbs
|
167
|
-
homepage:
|
168
|
+
homepage:
|
168
169
|
licenses:
|
169
170
|
- MIT
|
170
171
|
metadata: {}
|
171
|
-
post_install_message:
|
172
|
+
post_install_message:
|
172
173
|
rdoc_options: []
|
173
174
|
require_paths:
|
174
175
|
- lib
|
@@ -183,8 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
184
|
- !ruby/object:Gem::Version
|
184
185
|
version: '0'
|
185
186
|
requirements: []
|
186
|
-
rubygems_version: 3.
|
187
|
-
signing_key:
|
187
|
+
rubygems_version: 3.3.7
|
188
|
+
signing_key:
|
188
189
|
specification_version: 4
|
189
190
|
summary: Generates an Web, Api Test Automation project with Cucumber, Rspec, Capybara,
|
190
191
|
Selenium, Httparty and JsonSchema.
|