percy-appium-app 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/percy/common/common.rb +8 -5
- data/percy/metadata/metadata.rb +4 -1
- data/percy/version.rb +1 -1
- data/specs/metadata.rb +32 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8894474b866e7988f60b776f782f3c04887b4aa626cf2a384f2c97d983a534fc
|
4
|
+
data.tar.gz: 461ea9e2bf18840893f9b805ea93e8005874b4c9ddbcdf447d71e691051a015f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c91b292ad5b7a2ba6d04a64294d539caf6da3a9da7809663625a07f441563d242e00a37025ef2a96bdeafe3f604af7b286709676debeb18ca0834f22590e790c
|
7
|
+
data.tar.gz: e670e5434e2d4ace31348e736134f6976d8fa2bc1548febe7b7d70faeab6f057b833fc1809c84cf1c3b7b5a21922f41d75df3134b4fc7d2167a9354775da8d86
|
data/percy/common/common.rb
CHANGED
@@ -2,14 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'dotenv/load'
|
4
4
|
|
5
|
-
PERCY_LOGLEVEL = ENV['PERCY_LOGLEVEL']
|
6
|
-
PERCY_DEBUG = PERCY_LOGLEVEL == 'debug'
|
7
|
-
LABEL = "[\e[35m#{PERCY_DEBUG ? 'percy:ruby' : 'percy'}\e[39m]"
|
8
5
|
|
9
6
|
def log(message, on_debug: nil)
|
10
|
-
return unless on_debug.nil? || (on_debug.is_a?(TrueClass) &&
|
7
|
+
return unless on_debug.nil? || (on_debug.is_a?(TrueClass) && percy_debug)
|
11
8
|
|
12
|
-
|
9
|
+
label = "[\e[35m#{percy_debug ? 'percy:ruby' : 'percy'}\e[39m]"
|
10
|
+
|
11
|
+
puts "#{label} #{message}"
|
13
12
|
end
|
14
13
|
|
15
14
|
def hashed(object)
|
@@ -17,3 +16,7 @@ def hashed(object)
|
|
17
16
|
|
18
17
|
object
|
19
18
|
end
|
19
|
+
|
20
|
+
def percy_debug
|
21
|
+
ENV['PERCY_LOGLEVEL'] == 'debug'
|
22
|
+
end
|
data/percy/metadata/metadata.rb
CHANGED
@@ -103,7 +103,10 @@ module Percy
|
|
103
103
|
return @device_info unless @device_info.empty?
|
104
104
|
|
105
105
|
@device_info = DEVICE_INFO[device_name.downcase] || {}
|
106
|
-
|
106
|
+
if @device_info.empty?
|
107
|
+
log("#{device_name.downcase} does not exist in config. Making driver call to get the device info.",
|
108
|
+
on_debug: true)
|
109
|
+
end
|
107
110
|
@device_info
|
108
111
|
end
|
109
112
|
end
|
data/percy/version.rb
CHANGED
data/specs/metadata.rb
CHANGED
@@ -28,11 +28,39 @@ class TestMetadata < Minitest::Test
|
|
28
28
|
ENV['PERCY_LOGLEVEL'] = 'debug'
|
29
29
|
end
|
30
30
|
|
31
|
-
def
|
31
|
+
def test_get_device_info_device_not_present_when_log_level_is_debug
|
32
|
+
# redirecting the standard output temporarily and capture the output in a string.
|
33
|
+
captured_output = StringIO.new
|
34
|
+
$stdout = captured_output
|
35
|
+
ENV['PERCY_LOGLEVEL'] = 'debug'
|
32
36
|
device_name = 'Some Phone 123'
|
33
|
-
|
34
|
-
|
35
|
-
|
37
|
+
@metadata.get_device_info(device_name)
|
38
|
+
# Restore standard output
|
39
|
+
$stdout = STDOUT
|
40
|
+
|
41
|
+
# Get the captured output as a string
|
42
|
+
output = captured_output.string
|
43
|
+
regex_pattern = /#{Regexp.escape(device_name.downcase)} does not exist in config\. Making driver call to get the device info\./
|
44
|
+
|
45
|
+
assert_match(regex_pattern, output)
|
46
|
+
ENV['PERCY_LOGLEVEL'] = nil
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_get_device_info_device_not_present_when_log_level_is_info
|
50
|
+
# redirecting the standard output temporarily and capture the output in a string.
|
51
|
+
captured_output = StringIO.new
|
52
|
+
$stdout = captured_output
|
53
|
+
ENV['PERCY_LOGLEVEL'] = nil
|
54
|
+
device_name = 'Some Phone 123'
|
55
|
+
@metadata.get_device_info(device_name)
|
56
|
+
|
57
|
+
# Restore standard output
|
58
|
+
$stdout = STDOUT
|
59
|
+
|
60
|
+
# Get the captured output as a string
|
61
|
+
output = captured_output.string
|
62
|
+
|
63
|
+
assert_equal(output, '')
|
36
64
|
end
|
37
65
|
|
38
66
|
def test_metadata_get_orientation
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percy-appium-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BroswerStack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appium_lib
|