appium_failure_helper 1.12.0 → 1.13.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 28303c5b227b98d8c4d3ace598ada0f314bfb0506c1b83c91c581f2c91f758ec
|
|
4
|
+
data.tar.gz: cd8a27134421f9f1f0491124eeee51c3610e582efd8fcf6ab3a4f4917820deb6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c528dbf20a0234c0e64413b4f532bf97a077330a54547bc74517e06d44b8135269bb7c35ed7e5bdd8fdd07420a57877fe9f2f5cf6931655e8d7ccb80ed19b4f1
|
|
7
|
+
data.tar.gz: 468e0209d8dd6318571bd9ffc36fa3c53bdcca929648775d55bd1b187ea4c6bf4ae063923a7b87ca9da0fb9ed1af7e5cd797c75add7d75f88234f2ad660dc662
|
|
@@ -1,22 +1,60 @@
|
|
|
1
|
-
# lib/appium_failure_helper/source_code_analyzer.rb
|
|
2
1
|
module AppiumFailureHelper
|
|
3
2
|
module SourceCodeAnalyzer
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
# VERSÃO 4.0: Padrões de Regex corrigidos e muito mais robustos
|
|
4
|
+
PATTERNS = [
|
|
5
|
+
# Padrão 1: find_element(id: 'valor') ou find_element(:id => 'valor')
|
|
6
|
+
{ type: 'id', regex: /(?:\$driver\.)?find_element\((?:id:\s*|:id\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
7
|
+
{ type: 'xpath', regex: /(?:\$driver\.)?find_element\((?:xpath:\s*|:xpath\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
8
|
+
{ type: 'accessibility_id', regex: /(?:\$driver\.)?find_element\((?:accessibility_id:\s*|:accessibility_id\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
9
|
+
{ type: 'class_name', regex: /(?:\$driver\.)?find_element\((?:class_name:\s*|:class_name\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
10
|
+
|
|
11
|
+
# Padrão 2: find_element(:xpath, 'valor') — forma comum em Appium
|
|
12
|
+
{ type: 'xpath', regex: /(?:\$driver\.)?find_element\(:xpath,\s*['"]([^'"]+)['"]\)/ },
|
|
13
|
+
{ type: 'id', regex: /(?:\$driver\.)?find_element\(:id,\s*['"]([^'"]+)['"]\)/ },
|
|
14
|
+
|
|
15
|
+
# Padrão 3: Helpers customizados — id('valor'), xpath('valor')
|
|
16
|
+
{ type: 'id', regex: /(?:\$driver\.)?\s*id\s*\(?['"]([^'"]+)['"]\)?/ },
|
|
17
|
+
{ type: 'xpath', regex: /(?:\$driver\.)?\s*xpath\s*\(?['"]([^'"]+)['"]\)?/ },
|
|
18
|
+
|
|
19
|
+
# Padrão 4: find_elements(...) — capturar listas de elementos
|
|
20
|
+
{ type: 'id', regex: /(?:\$driver\.)?find_elements\((?:id:\s*|:id\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
21
|
+
{ type: 'xpath', regex: /(?:\$driver\.)?find_elements\((?:xpath:\s*|:xpath\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
22
|
+
{ type: 'class_name', regex: /(?:\$driver\.)?find_elements\((?:class_name:\s*|:class_name\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
23
|
+
|
|
24
|
+
# Padrão 5: Uso direto do Appium::TouchAction (muito comum em mobile)
|
|
25
|
+
{ type: 'tap', regex: /Appium::TouchAction\.new\.tap\(.*['"]([^'"]+)['"].*\)\.perform/ },
|
|
26
|
+
|
|
27
|
+
# Padrão 6: Elementos obtidos antes e usados depois
|
|
28
|
+
# Ex: el = $driver.find_element(:id, 'btn_ok')
|
|
29
|
+
{ type: 'id', regex: /(\w+)\s*=\s*(?:\$driver\.)?find_element\(:id,\s*['"]([^'"]+)['"]\)/ },
|
|
30
|
+
{ type: 'xpath', regex: /(\w+)\s*=\s*(?:\$driver\.)?find_element\(:xpath,\s*['"]([^'"]+)['"]\)/ },
|
|
31
|
+
|
|
32
|
+
# Padrão 7: Métodos customizados de Page Object
|
|
33
|
+
# Ex: login_button.click / campo_email.set 'valor'
|
|
34
|
+
{ type: 'page_object', regex: /(\w+)\.(?:click|text|set|send_keys)\b/ },
|
|
35
|
+
|
|
36
|
+
# Padrão 8: Capybara (comum em projetos híbridos)
|
|
37
|
+
{ type: 'capybara_css', regex: /find\(['"]([^'"]+)['"]\)/ },
|
|
38
|
+
{ type: 'capybara_xpath', regex: /find\(:xpath,\s*['"]([^'"]+)['"]\)/ },
|
|
39
|
+
{ type: 'capybara_id', regex: /find_by_id\(['"]([^'"]+)['"]\)/ },
|
|
40
|
+
|
|
41
|
+
# Padrão 9: By.new(:id, 'valor') — estilo Selenium puro
|
|
42
|
+
{ type: 'id', regex: /By\.new\(:id,\s*['"]([^'"]+)['"]\)/ },
|
|
43
|
+
{ type: 'xpath', regex: /By\.new\(:xpath,\s*['"]([^'"]+)['"]\)/ },
|
|
44
|
+
|
|
45
|
+
# Padrão 10: wait.until { ...find_element... }
|
|
46
|
+
{ type: 'wait_id', regex: /wait\.until\s*\{.*find_element\(:id,\s*['"]([^'"]+)['"]\).*?\}/ },
|
|
47
|
+
{ type: 'wait_xpath', regex: /wait\.until\s*\{.*find_element\(:xpath,\s*['"]([^'"]+)['"]\).*?\}/ },
|
|
48
|
+
|
|
49
|
+
# Padrão 11: find_element com variáveis dinâmicas
|
|
50
|
+
# Ex: find_element(:xpath, "//button[text()='#{btn_text}']")
|
|
51
|
+
{ type: 'xpath_dynamic', regex: /find_element\(:xpath,\s*["'].*#\{[^}]+\}.*["']\)/ },
|
|
52
|
+
|
|
53
|
+
# Padrão 12: chamadas via helper no módulo ScreenObject
|
|
54
|
+
# Ex: element(:btn_login) { id 'login_button' }
|
|
55
|
+
{ type: 'screenobject', regex: /element\(\s*:[^)]+\)\s*\{\s*(id|xpath)\s+['"]([^'"]+)['"]\s*\}/ }
|
|
56
|
+
].freeze
|
|
57
|
+
|
|
20
58
|
|
|
21
59
|
def self.extract_from_exception(exception)
|
|
22
60
|
# Busca a primeira linha do backtrace que seja um arquivo .rb do projeto
|