SaudeiD 0.2.2 → 0.2.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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/SaudeiD.gemspec +1 -1
  3. data/azure-pipelines.yaml +35 -32
  4. data/bin/SaudeiD +146 -146
  5. data/credentials +2 -0
  6. data/lib/SaudeiD/SaudeiD_helper.rb +41 -41
  7. data/lib/SaudeiD/version.rb +1 -1
  8. data/lib/SkeletonApi/.gitignore +1 -1
  9. data/lib/SkeletonApi/.rubocop.yml +62 -62
  10. data/lib/SkeletonApi/.solargraph.yml +16 -16
  11. data/lib/SkeletonApi/Gemfile +18 -18
  12. data/lib/SkeletonApi/README.md +36 -36
  13. data/lib/SkeletonApi/cucumber.yml +11 -11
  14. data/lib/SkeletonApi/features/support/config/environments/dev.yml +5 -5
  15. data/lib/SkeletonApi/features/support/config/environments/qa.yml +5 -5
  16. data/lib/SkeletonApi/features/support/env.rb +28 -28
  17. data/lib/SkeletonApi/features/support/helper.rb +6 -6
  18. data/lib/SkeletonApi/features/support/hooks.rb +53 -53
  19. data/lib/SkeletonWeb/.gitignore +7 -7
  20. data/lib/SkeletonWeb/.rubocop.yml +52 -52
  21. data/lib/SkeletonWeb/.solargraph.yml +16 -16
  22. data/lib/SkeletonWeb/Gemfile +13 -13
  23. data/lib/SkeletonWeb/README.md +49 -49
  24. data/lib/SkeletonWeb/cucumber.yml +16 -16
  25. data/lib/SkeletonWeb/features/support/config/elements.yml +2 -2
  26. data/lib/SkeletonWeb/features/support/env.rb +49 -49
  27. data/lib/SkeletonWeb/features/support/helper.rb +37 -37
  28. data/lib/SkeletonWeb/features/support/hooks.rb +56 -56
  29. data/lib/SkeletonWeb/features/support/pages/base_page.rb +3 -3
  30. data/lib/locales/en.yml +16 -16
  31. data/lib/locales/pt.yml +15 -15
  32. data/lib/templates/feature.tt +8 -8
  33. data/lib/templates/page.tt +8 -8
  34. data/lib/templates/services.tt +10 -10
  35. data/lib/templates/steps.tt +5 -5
  36. metadata +9 -9
  37. data/bin/saudeid +0 -146
@@ -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"
@@ -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" ) %>
@@ -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
@@ -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
@@ -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.2
4
+ version: 0.2.6
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-18 00:00:00.000000000 Z
11
+ date: 2022-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -100,7 +100,7 @@ description: |-
100
100
  email:
101
101
  - raphael_antonio_vieira@hotmail.com
102
102
  executables:
103
- - saudeid
103
+ - SaudeiD
104
104
  extensions: []
105
105
  extra_rdoc_files: []
106
106
  files:
@@ -115,8 +115,8 @@ files:
115
115
  - azure-pipelines.yaml
116
116
  - bin/SaudeiD
117
117
  - bin/console
118
- - bin/saudeid
119
118
  - bin/setup
119
+ - credentials
120
120
  - lib/SaudeiD.rb
121
121
  - lib/SaudeiD/SaudeiD_helper.rb
122
122
  - lib/SaudeiD/version.rb
@@ -165,11 +165,11 @@ files:
165
165
  - lib/templates/services.tt
166
166
  - lib/templates/steps.tt
167
167
  - sig/SaudeiD.rbs
168
- homepage:
168
+ homepage:
169
169
  licenses:
170
170
  - MIT
171
171
  metadata: {}
172
- post_install_message:
172
+ post_install_message:
173
173
  rdoc_options: []
174
174
  require_paths:
175
175
  - lib
@@ -184,8 +184,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  - !ruby/object:Gem::Version
185
185
  version: '0'
186
186
  requirements: []
187
- rubygems_version: 3.1.6
188
- signing_key:
187
+ rubygems_version: 3.3.7
188
+ signing_key:
189
189
  specification_version: 4
190
190
  summary: Generates an Web, Api Test Automation project with Cucumber, Rspec, Capybara,
191
191
  Selenium, Httparty and JsonSchema.
data/bin/saudeid DELETED
@@ -1,146 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'i18n'
4
- require 'json'
5
- require 'tempfile'
6
- require 'thor'
7
- require 'thor/group'
8
- require 'yaml'
9
-
10
- require File.join(File.dirname(__FILE__),
11
- '../lib/SaudeiD/SaudeiD_helper')
12
- require_relative '../lib/SaudeiD/version.rb'
13
-
14
- module GeneCapybara
15
- class Generate < Thor
16
- include Thor::Actions
17
-
18
- desc 'feature [RESOURCE_NAME]', 'Generates a feature'
19
- option :lang,
20
- banner: 'any of the gherkin support languages',
21
- default: :pt
22
- def feature(name)
23
- I18n.config.default_locale = options[:lang]
24
- in_root_project_folder?
25
- create_feature_file(name)
26
- end
27
-
28
- desc 'step [RESOURCE_NAME]', 'Generates a step'
29
- option :lang,
30
- banner: 'any of the gherkin supported languages',
31
- default: :pt
32
- def step(name)
33
- I18n.config.default_locale = options[:lang]
34
- in_root_project_folder?
35
- create_steps_file name
36
- end
37
-
38
- desc 'page [RESOURCE_NAME]', 'Generates pages'
39
- option :lang,
40
- banner: 'any of the gherkin supported languages',
41
- default: :pt
42
- def page(name)
43
- I18n.config.default_locale = options[:lang]
44
- in_root_project_folder?
45
- create_page_file name
46
- end
47
-
48
- desc 'services [RESOURCE_NAME]', 'Generates services'
49
- option :lang,
50
- banner: 'any of the gherkin supported languages',
51
- default: :pt
52
- def service(name)
53
- I18n.config.default_locale = options[:lang]
54
- in_root_project_folder?
55
- create_service_file name
56
- end
57
-
58
- desc 'all_web [RESOURCE_NAME]', 'Generates features, steps and pages'
59
- option :lang,
60
- banner: 'any of the gherkin supported languages',
61
- default: :pt
62
- def all_web(name)
63
- I18n.config.default_locale = options[:lang]
64
- in_root_project_folder?
65
- create_feature_file name
66
- create_steps_file name
67
- create_page_file name
68
- end
69
-
70
- desc 'all_api [RESOURCE_NAME]', 'Generates feature and steps'
71
- option :lang,
72
- banner: 'any of the gherkin supported languages',
73
- default: :pt
74
- def all_api(name)
75
- I18n.config.default_locale = options[:lang]
76
- in_root_project_folder?
77
- create_feature_file name
78
- create_steps_file name
79
- create_service_file name
80
- end
81
-
82
- def self.source_root
83
- File.join(File.dirname(__FILE__), '../lib/templates')
84
- end
85
- end
86
- end
87
-
88
- module GeneCapybara
89
- class GeneCapybaraRunner < Thor
90
- include Thor::Actions
91
-
92
- map %w[-v --version] => :version
93
-
94
- default_task :help
95
-
96
- register GeneCapybara::Generate, 'generate',
97
- 'generate [GENERATOR] [RESOURCE_NAME]',
98
- 'Generates various resources'
99
- register GeneCapybara::Generate, 'g',
100
- 'g [GENERATOR] [RESOURCE_NAME]',
101
- 'Generates various resources'
102
-
103
- desc 'new web PROJECT_NAME',
104
- 'Generates the structure of a new project that uses '\
105
- 'Capybara, Selenium and Cucumber'
106
- option :lang,
107
- banner: 'any of the gherkin supported languages',
108
- default: :pt
109
- def new_web(name)
110
- I18n.config.default_locale = options[:lang]
111
- directory File.join(File.dirname(__FILE__),
112
- '../lib/SkeletonWeb'), name
113
- end
114
-
115
- desc 'new api PROJECT_NAME',
116
- 'Generates the structure of api'
117
- option :lang,
118
- banner: 'any of the gherkin supported languages',
119
- default: :pt
120
- def new_api(name)
121
- I18n.config.default_locale = options[:lang]
122
- directory File.join(File.dirname(__FILE__),
123
- '../lib/SkeletonApi'), name
124
- end
125
-
126
- desc 'version', 'Shows the gem version'
127
- def version
128
- puts "GeneCapybara Version #{SaudeiD::VERSION}"
129
- end
130
-
131
- def self.source_root
132
- File.join(File.dirname(__FILE__), '../lib/templates')
133
- end
134
-
135
- def initialize(*args)
136
- super
137
- locales_folder_path = File.join(File.dirname(__FILE__),
138
- '../lib/locales')
139
- I18n.load_path = Dir[File.join(locales_folder_path, '*.yml')]
140
- I18n.backend.load_translations
141
- I18n.config.enforce_available_locales = true
142
- end
143
- end
144
- end
145
-
146
- GeneCapybara::GeneCapybaraRunner.start