appium_failure_helper 1.2.4 → 1.3.0

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: a496ea646258e4d0d11ee11e5d0424b9ce37099ad0ae578de7793508e2ce8196
4
- data.tar.gz: ae1c2e4e1ea18407d2989541ed7461bee8252535de1437cc48288a9944246477
3
+ metadata.gz: a20267977f0afde8bb695938eebce5b191dc3cba987e5c282a6035e07d881621
4
+ data.tar.gz: abc7bbfb5dbaa920db3c4830bf93089c39874bc3c1d093e9490ac65e3f58e9de
5
5
  SHA512:
6
- metadata.gz: 5689dff21366fbacdb663189b0368c716399bdaf2434df6cf8db3ae68982fe4b29c11ef506b640472d18483eff659eea12c67ac1e76e35285406ef4c0eb2e8ce
7
- data.tar.gz: f1075a47223d23ac6bd0f0bd0494a07e33a07791bfc95b1f8928791a80adde465a5fdd8125df4d79afe38d3a5b4f935526a5caefef600f3c6054a830d6755b2b
6
+ metadata.gz: 9f890998e4660b52c93b034e6237e73b11022430807dba957ed6bfaff38245eee55fda60a1dcf04191ac955e967d9a5a174976d1345196c3b049970f7602c05a
7
+ data.tar.gz: c0514430f06deae0ede268aedcc2b3ca56fce697e26b0f612ac4bdace28afda15d0c14dffce72b5d94898cb3c7384a17d78a5bca6e822b4ac3fc3047d0c02ae0
data/README.md CHANGED
@@ -129,6 +129,12 @@ A cada falha, uma nova pasta é criada em `reports_failure/`, contendo o relató
129
129
 
130
130
  A GEM é dividida em módulos com responsabilidades únicas para facilitar a manutenção e a extensibilidade (Handler, Analyzer, ReportGenerator, XPathFactory, etc.).
131
131
 
132
+ ## 🔄 Fluxo Interno da GEM
133
+
134
+ Abaixo o fluxo de como os módulos conversam entre si durante o diagnóstico de uma falha:
135
+
136
+ ![Fluxo Interno](img\fluxo_appium_failure_helper.png)
137
+
132
138
  ## 🤝 Como Contribuir
133
139
 
134
140
  Pull Requests são bem-vindos. Para bugs ou sugestões, por favor, abra uma *Issue* no repositório.
Binary file
Binary file
@@ -0,0 +1,7 @@
1
+ ---
2
+ btnConfirmar:
3
+ type: id
4
+ value: confirm_button
5
+ inputEmail:
6
+ type: xpath
7
+ value: "//android.widget.EditText"
@@ -0,0 +1,4 @@
1
+ ---
2
+ btnLogin:
3
+ type: id
4
+ value: com.app:id/login_button
Binary file
@@ -46,12 +46,41 @@ module AppiumFailureHelper
46
46
  next if file.include?('reports_failure')
47
47
  begin
48
48
  data = YAML.load_file(file)
49
- elements_map.merge!(data) if data.is_a?(Hash)
49
+ if data.is_a?(Hash)
50
+ data.each do |k, v|
51
+ data[k] = normalize_element(v)
52
+ end
53
+ elements_map.merge!(data)
54
+ end
50
55
  rescue => e
51
56
  Utils.logger.warn("Aviso: Erro ao carregar o arquivo YAML #{file}: #{e.message}")
52
57
  end
53
58
  end
54
59
  elements_map
55
60
  end
61
+
62
+ def self.normalize_yaml_hash_keys(obj)
63
+ case obj
64
+ when Hash
65
+ result = {}
66
+ obj.each do |k, v|
67
+ k_s = k.to_s
68
+ v_n = normalize_yaml_hash_keys(v)
69
+ # Se v_n é um Hash com chaves :value ou 'valor' -> faça unificação para 'value'
70
+ if v_n.is_a?(Hash)
71
+ if v_n.key?('valor') && !v_n.key?('value')
72
+ v_n['value'] = v_n.delete('valor')
73
+ end
74
+ # também converte :tipoBusca para 'tipoBusca' (string)
75
+ end
76
+ result[k_s] = v_n
77
+ end
78
+ result
79
+ when Array
80
+ obj.map { |el| normalize_yaml_hash_keys(el) }
81
+ else
82
+ obj
83
+ end
84
+ end
56
85
  end
57
86
  end
@@ -13,5 +13,21 @@ module AppiumFailureHelper
13
13
  return value unless value.is_a?(String)
14
14
  value.size > max_length ? "#{value[0...max_length]}..." : value
15
15
  end
16
+
17
+ def self.normalize_element(el)
18
+ return {} if el.nil?
19
+
20
+ # garante que todas as chaves sejam string
21
+ h = el.transform_keys { |k| k.to_s }
22
+
23
+ # unifica value/valor
24
+ value = h['value'] || h['valor']
25
+ tipo = h['tipoBusca'] || h['type']
26
+
27
+ {
28
+ 'tipoBusca' => tipo,
29
+ 'value' => value
30
+ }
31
+ end
16
32
  end
17
33
  end
@@ -1,3 +1,3 @@
1
1
  module AppiumFailureHelper
2
- VERSION = "1.2.4"
2
+ VERSION = "1.3.0"
3
3
  end
data/release_gem.rb ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+
4
+ # Caminho do arquivo de versão
5
+ VERSION_FILE = 'lib/appium_failure_helper/version.rb'
6
+
7
+ # Lê a versão atual da gem
8
+ def current_version
9
+ content = File.read(VERSION_FILE)
10
+ content.match(/(\d+)\.(\d+)\.(\d+)/).captures.map(&:to_i)
11
+ end
12
+
13
+ # Detecta tipo de alteração via git diff
14
+ def change_type
15
+ diff = `git diff HEAD`
16
+
17
+ # Exemplo simplificado de análise
18
+ if diff =~ /def .*!/ # métodos com ! ou alterações de assinatura podem ser breaking
19
+ :major
20
+ elsif diff =~ /def / # novos métodos
21
+ :minor
22
+ else
23
+ :patch # pequenas alterações
24
+ end
25
+ end
26
+
27
+ # Incrementa a versão
28
+ def increment_version(version, type)
29
+ major, minor, patch = version
30
+ case type
31
+ when :major
32
+ major += 1
33
+ minor = 0
34
+ patch = 0
35
+ when :minor
36
+ minor += 1
37
+ patch = 0
38
+ when :patch
39
+ patch += 1
40
+ end
41
+ [major, minor, patch]
42
+ end
43
+
44
+ # Atualiza arquivo de versão
45
+ def update_version_file(new_version)
46
+ content = File.read(VERSION_FILE)
47
+ new_content = content.gsub(/\d+\.\d+\.\d+/, new_version.join('.'))
48
+ File.write(VERSION_FILE, new_content)
49
+ end
50
+
51
+ # Commit e tag
52
+ def git_commit_and_tag(new_version)
53
+ `git add .`
54
+ `git commit -m "Bump version to #{new_version.join('.')}"`
55
+ `git tag v#{new_version.join('.')}`
56
+ end
57
+
58
+ # Publicar a GEM
59
+ def push_gem
60
+ `gem build appium_failure_helper.gemspec`
61
+ `gem push appium_failure_helper-#{current_version.join('.')}.gem`
62
+ end
63
+
64
+ # Fluxo principal
65
+ version = current_version
66
+ type = change_type
67
+ new_version = increment_version(version, type)
68
+ update_version_file(new_version)
69
+ git_commit_and_tag(new_version)
70
+ push_gem
71
+
72
+ puts "GEM publicada com sucesso! Nova versão: #{new_version.join('.')}"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appium_failure_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.4
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Nascimento
@@ -93,6 +93,11 @@ files:
93
93
  - LICENSE.txt
94
94
  - README.md
95
95
  - Rakefile
96
+ - appium_failure_helper-1.2.3.gem
97
+ - appium_failure_helper-1.2.4.gem
98
+ - elements/cadastro.yaml
99
+ - elements/login.yaml
100
+ - img/fluxo_appium_failure_helper.png
96
101
  - lib/appium_failure_helper.rb
97
102
  - lib/appium_failure_helper/analyzer.rb
98
103
  - lib/appium_failure_helper/code_searcher.rb
@@ -105,6 +110,7 @@ files:
105
110
  - lib/appium_failure_helper/utils.rb
106
111
  - lib/appium_failure_helper/version.rb
107
112
  - lib/appium_failure_helper/xpath_factory.rb
113
+ - release_gem.rb
108
114
  - sig/appium_failure_helper.rbs
109
115
  homepage: https://github.com/David-Nascimento/Appium_failure_helper
110
116
  licenses: