appium_failure_helper 1.11.2 → 1.12.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: b6b283db967a4490c24e0ade301e6208c68ddb52a3d7193f3ec0cbc195b6b7f7
|
|
4
|
+
data.tar.gz: d6e310dbd4764348b4906c734e7e46b7a08149aee8047e89bf9a422c7494f36a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d9452cac6dafeb72445772d791bc5da79596ebaee7530aabd5339fb0548a64b718c020ae7c285f3846b042d6beb8eadc3631652b8f0e0c996663927aff8fe1e
|
|
7
|
+
data.tar.gz: e249e9b3a468193c689e26cac719bd9e81a720fdea7a13bbfa5cc5e9e2cbbcc1da10363adbd51f9ff8bcdab3611d59f274b5984597db4dc76fa0ce0a859ef162
|
|
@@ -1,21 +1,37 @@
|
|
|
1
1
|
# lib/appium_failure_helper/source_code_analyzer.rb
|
|
2
2
|
module AppiumFailureHelper
|
|
3
3
|
module SourceCodeAnalyzer
|
|
4
|
+
# VERSÃO 4.0: Padrões de Regex corrigidos e muito mais robustos
|
|
4
5
|
PATTERNS = [
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
# Padrão 1: find_element(id: 'valor') ou find_element(:id => 'valor')
|
|
7
|
+
# A correção chave é o \s* (espaço opcional) depois do nome do atributo.
|
|
8
|
+
{ type: 'id', regex: /(?:\$driver\.)?find_element\((?:id:\s*|:id\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
9
|
+
{ type: 'xpath', regex: /(?:\$driver\.)?find_element\((?:xpath:\s*|:xpath\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
10
|
+
{ type: 'accessibility_id', regex: /(?:\$driver\.)?find_element\((?:accessibility_id:\s*|:accessibility_id\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
11
|
+
{ type: 'class_name', regex: /(?:\$driver\.)?find_element\((?:class_name:\s*|:class_name\s*=>\s*)['"]([^'"]+)['"]\)/ },
|
|
12
|
+
|
|
13
|
+
# Padrão 2: find_element(:xpath, 'valor')
|
|
14
|
+
{ type: 'xpath', regex: /(?:\$driver\.)?find_element\(:xpath,\s*['"]([^'"]+)['"]\)/ },
|
|
15
|
+
|
|
16
|
+
# Padrão 3: Helpers customizados como id('valor') ou xpath('valor')
|
|
7
17
|
{ type: 'id', regex: /(?:\$driver\.)?\s*id\s*\(?['"]([^'"]+)['"]\)?/ },
|
|
8
18
|
{ type: 'xpath', regex: /(?:\$driver\.)?\s*xpath\s*\(?['"]([^'"]+)['"]\)?/ }
|
|
9
19
|
].freeze
|
|
10
20
|
|
|
11
21
|
def self.extract_from_exception(exception)
|
|
22
|
+
# Busca a primeira linha do backtrace que seja um arquivo .rb do projeto
|
|
12
23
|
location = exception.backtrace.find { |line| line.include?('.rb') && !line.include?('gems') }
|
|
13
24
|
return {} unless location
|
|
25
|
+
|
|
26
|
+
# Usa o Regex que funciona em Windows e Unix para extrair caminho e linha
|
|
14
27
|
path_match = location.match(/^(.*?):(\d+)(?::in.*)?$/)
|
|
15
28
|
return {} unless path_match
|
|
29
|
+
|
|
16
30
|
file_path, line_number = path_match.captures
|
|
17
31
|
return {} unless File.exist?(file_path)
|
|
32
|
+
|
|
18
33
|
begin
|
|
34
|
+
# Lê a linha exata onde o erro ocorreu
|
|
19
35
|
error_line = File.readlines(file_path)[line_number.to_i - 1]
|
|
20
36
|
return parse_line_for_locator(error_line)
|
|
21
37
|
rescue
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appium_failure_helper
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.12.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Nascimento
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|