percy-appium-app 0.0.7 → 0.0.9.beta0
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 +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +2 -2
- data/.github/workflows/release.yml +1 -1
- data/.github/workflows/test.yml +1 -1
- data/README.md +1 -1
- data/percy/lib/app_percy.rb +18 -0
- data/percy/lib/cli_wrapper.rb +9 -4
- data/percy/metadata/android_metadata.rb +7 -2
- data/percy/providers/generic_provider.rb +22 -4
- data/percy/version.rb +1 -1
- data/specs/android_metadata.rb +20 -0
- data/specs/cli_wrapper.rb +12 -3
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc4c4c4f66c3a7ecfe019e07eef6a8dfdffd17d57935c12780b441388703a5af
|
4
|
+
data.tar.gz: 7ee0cd5c07b82d25a5718894fee9891bc612c02ed665cb34cf7f1e46d1fa95d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6e82f7ada4e367c5e74f24a8e9652619b581c3ec00076212ffbeced9e3f203928ad77cf067d0be3270fee228c734963bfbbf8ac5a3c0e6e9d7ad3fe6041aeed
|
7
|
+
data.tar.gz: f991caac478c3035ae723faf96fb0cc0010631de9832eb5976e6beb325861c52aaf5caa6db658e9d716fcfea2fd9199203fd15c894028e7526b79b8bfd107c11
|
@@ -11,7 +11,7 @@ assignees: ''
|
|
11
11
|
|
12
12
|
There are common setup gotchas that happen with Percy's SDKs, it would be worth reading
|
13
13
|
the debugging document, which might already answer your question:
|
14
|
-
https://
|
14
|
+
https://www.browserstack.com/docs/percy/integrate/percy-sdk-workflow#debugging-sdks
|
15
15
|
|
16
16
|
## Reach out to Percy support instead?
|
17
17
|
|
@@ -43,7 +43,7 @@ If necessary, describe the problem you have been experiencing in more detail.
|
|
43
43
|
## Debug logs
|
44
44
|
|
45
45
|
If you are reporting a bug, _always_ include logs! [Give the "Debugging SDKs"
|
46
|
-
document a quick read for how to gather logs](https://
|
46
|
+
document a quick read for how to gather logs](https://www.browserstack.com/docs/percy/integrate/percy-sdk-workflow#debugging-sdks)
|
47
47
|
|
48
48
|
Please do not trim or edit these logs, often times there are hints in the full
|
49
49
|
logs that help debug what is going on.
|
data/.github/workflows/test.yml
CHANGED
data/README.md
CHANGED
@@ -181,7 +181,7 @@ $ percy exec -- [ruby test command]
|
|
181
181
|
[percy] Done!
|
182
182
|
```
|
183
183
|
|
184
|
-
Refer to docs here: [Percy on Automate](https://
|
184
|
+
Refer to docs here: [Percy on Automate](https://www.browserstack.com/docs/percy/integrate/functional-and-visual)
|
185
185
|
|
186
186
|
### Migrating Config
|
187
187
|
|
data/percy/lib/app_percy.rb
CHANGED
@@ -48,6 +48,24 @@ module Percy
|
|
48
48
|
'Argument orientation should be a String and portrait/landscape'
|
49
49
|
end
|
50
50
|
|
51
|
+
test_case = kwargs[:test_case]
|
52
|
+
if test_case && !test_case.is_a?(String)
|
53
|
+
raise TypeError,
|
54
|
+
'Argument test_case should be a String'
|
55
|
+
end
|
56
|
+
|
57
|
+
labels = kwargs[:labels]
|
58
|
+
if labels && !labels.is_a?(String)
|
59
|
+
raise TypeError,
|
60
|
+
'Argument labels should be a String'
|
61
|
+
end
|
62
|
+
|
63
|
+
th_test_case_execution_id = kwargs[:th_test_case_execution_id]
|
64
|
+
if th_test_case_execution_id && !th_test_case_execution_id.is_a?(String)
|
65
|
+
raise TypeError,
|
66
|
+
'Argument th_test_case_execution_id should be a String'
|
67
|
+
end
|
68
|
+
|
51
69
|
@provider.screenshot(name, **kwargs)
|
52
70
|
end
|
53
71
|
|
data/percy/lib/cli_wrapper.rb
CHANGED
@@ -49,8 +49,9 @@ module Percy
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def post_screenshots(name, tag, tiles, external_debug_url = nil, ignored_elements_data = nil,
|
52
|
-
|
53
|
-
body = request_body(name, tag, tiles, external_debug_url, ignored_elements_data,
|
52
|
+
considered_elements_data = nil, sync = nil, test_case = nil, labels = nil, th_test_case_execution_id = nil)
|
53
|
+
body = request_body(name, tag, tiles, external_debug_url, ignored_elements_data,
|
54
|
+
considered_elements_data, sync, test_case, labels, th_test_case_execution_id)
|
54
55
|
body['client_info'] = Percy::Environment.get_client_info
|
55
56
|
body['environment_info'] = Percy::Environment.get_env_info
|
56
57
|
|
@@ -124,7 +125,8 @@ module Percy
|
|
124
125
|
data
|
125
126
|
end
|
126
127
|
|
127
|
-
def request_body(name, tag, tiles, external_debug_url, ignored_elements_data, considered_elements_data, sync
|
128
|
+
def request_body(name, tag, tiles, external_debug_url, ignored_elements_data, considered_elements_data, sync,
|
129
|
+
test_case, labels, th_test_case_execution_id)
|
128
130
|
tiles = tiles.map(&:to_h)
|
129
131
|
{
|
130
132
|
'name' => name,
|
@@ -133,7 +135,10 @@ module Percy
|
|
133
135
|
'ignored_elements_data' => ignored_elements_data,
|
134
136
|
'external_debug_url' => external_debug_url,
|
135
137
|
'considered_elements_data' => considered_elements_data,
|
136
|
-
'sync' => sync
|
138
|
+
'sync' => sync,
|
139
|
+
'test_case' => test_case,
|
140
|
+
'labels' => labels,
|
141
|
+
'th_test_case_execution_id' => th_test_case_execution_id
|
137
142
|
}
|
138
143
|
end
|
139
144
|
end
|
@@ -15,8 +15,13 @@ module Percy
|
|
15
15
|
def device_screen_size
|
16
16
|
caps = capabilities
|
17
17
|
caps = caps.as_json unless caps.is_a?(Hash)
|
18
|
-
|
19
|
-
|
18
|
+
if caps['deviceScreenSize'].nil?
|
19
|
+
size = driver.window_size
|
20
|
+
{ width: size.width.to_i, height: size.height.to_i }
|
21
|
+
else
|
22
|
+
width, height = caps['deviceScreenSize'].split('x')
|
23
|
+
{ width: width.to_i, height: height.to_i }
|
24
|
+
end
|
20
25
|
end
|
21
26
|
|
22
27
|
def get_system_bars
|
@@ -43,8 +43,12 @@ module Percy
|
|
43
43
|
)
|
44
44
|
}
|
45
45
|
sync = kwargs.fetch(:sync, nil)
|
46
|
+
test_case = kwargs.fetch(:test_case, nil)
|
47
|
+
labels = kwargs.fetch(:labels, nil)
|
48
|
+
th_test_case_execution_id = kwargs.fetch(:th_test_case_execution_id, nil)
|
46
49
|
|
47
|
-
_post_screenshots(name, tag, tiles, get_debug_url, ignore_regions, consider_regions,
|
50
|
+
_post_screenshots(name, tag, tiles, get_debug_url, ignore_regions, consider_regions,
|
51
|
+
sync, test_case, labels, th_test_case_execution_id)
|
48
52
|
end
|
49
53
|
|
50
54
|
def _get_tag(**kwargs)
|
@@ -81,7 +85,8 @@ module Percy
|
|
81
85
|
header_height = 0
|
82
86
|
footer_height = 0
|
83
87
|
[
|
84
|
-
Percy::Tile.new(status_bar_height, nav_bar_height, header_height, footer_height, filepath: path,
|
88
|
+
Percy::Tile.new(status_bar_height, nav_bar_height, header_height, footer_height, filepath: path,
|
89
|
+
fullscreen: fullscreen)
|
85
90
|
]
|
86
91
|
end
|
87
92
|
|
@@ -94,8 +99,21 @@ module Percy
|
|
94
99
|
elements_array
|
95
100
|
end
|
96
101
|
|
97
|
-
def _post_screenshots(
|
98
|
-
|
102
|
+
def _post_screenshots(
|
103
|
+
name,
|
104
|
+
tag,
|
105
|
+
tiles,
|
106
|
+
debug_url,
|
107
|
+
ignored_regions,
|
108
|
+
considered_regions,
|
109
|
+
sync,
|
110
|
+
test_case,
|
111
|
+
labels,
|
112
|
+
th_test_case_execution_id
|
113
|
+
)
|
114
|
+
Percy::CLIWrapper.new.post_screenshots(
|
115
|
+
name, tag, tiles, debug_url, ignored_regions, considered_regions, sync, test_case, labels, th_test_case_execution_id
|
116
|
+
)
|
99
117
|
end
|
100
118
|
|
101
119
|
def _write_screenshot(png_bytes, directory)
|
data/percy/version.rb
CHANGED
data/specs/android_metadata.rb
CHANGED
@@ -29,7 +29,27 @@ class TestAndroidMetadata < Minitest::Test
|
|
29
29
|
@mock_webdriver.expect(:capabilities, android_capabilities.merge('viewportRect' => viewport))
|
30
30
|
|
31
31
|
assert(viewport, @android_metadata.viewport)
|
32
|
+
@mock_webdriver.verify
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_device_screen_size_when_device_screen_size_is_nil
|
36
|
+
# Mock capabilities to return a hash without 'deviceScreenSize'
|
37
|
+
android_capabilities = get_android_capabilities
|
38
|
+
android_capabilities.delete('deviceScreenSize')
|
39
|
+
@mock_webdriver.expect(:capabilities, android_capabilities)
|
40
|
+
|
41
|
+
# Mock driver.window_size to return a double with width and height
|
42
|
+
mock_window_size = Minitest::Mock.new
|
43
|
+
mock_window_size.expect(:width, 1080)
|
44
|
+
mock_window_size.expect(:height, 1920)
|
45
|
+
@mock_webdriver.expect(:window_size, mock_window_size)
|
46
|
+
|
47
|
+
# Call the method and assert the result
|
48
|
+
result = @android_metadata.device_screen_size
|
49
|
+
assert_equal({ width: 1080, height: 1920 }, result)
|
32
50
|
|
51
|
+
# Verify mocks
|
52
|
+
mock_window_size.verify
|
33
53
|
@mock_webdriver.verify
|
34
54
|
end
|
35
55
|
|
data/specs/cli_wrapper.rb
CHANGED
@@ -105,8 +105,11 @@ class TestCLIWrapper < Minitest::Test
|
|
105
105
|
name = 'some-name'
|
106
106
|
debug_url = 'debug-url'
|
107
107
|
sync = false
|
108
|
+
test_case = 'test-case-1'
|
109
|
+
labels = 'app;testing'
|
110
|
+
th_test_case_execution_id = 'uuid-1231231'
|
108
111
|
response = @cli_wrapper.request_body(name, tag, [tile], debug_url, @ignored_elements_data,
|
109
|
-
@considered_elements_data, sync)
|
112
|
+
@considered_elements_data, sync, test_case, labels, th_test_case_execution_id)
|
110
113
|
assert_equal response['name'], name
|
111
114
|
assert_equal response['external_debug_url'], debug_url
|
112
115
|
assert_equal response['tag'], tag
|
@@ -114,6 +117,9 @@ class TestCLIWrapper < Minitest::Test
|
|
114
117
|
assert_equal response['ignored_elements_data'], @ignored_elements_data
|
115
118
|
assert_equal response['considered_elements_data'], @considered_elements_data
|
116
119
|
assert_equal response['sync'], sync
|
120
|
+
assert_equal response['test_case'], test_case
|
121
|
+
assert_equal response['labels'], labels
|
122
|
+
assert_equal response['th_test_case_execution_id'], th_test_case_execution_id
|
117
123
|
end
|
118
124
|
|
119
125
|
def test_request_body_when_optional_values_are_null
|
@@ -125,13 +131,16 @@ class TestCLIWrapper < Minitest::Test
|
|
125
131
|
considered_elements_data = nil
|
126
132
|
sync = nil
|
127
133
|
response = @cli_wrapper.send(:request_body, name, tag, [tile], debug_url, ignored_elements_data,
|
128
|
-
considered_elements_data, sync)
|
134
|
+
considered_elements_data, sync, nil, nil, nil)
|
129
135
|
assert_equal response['name'], name
|
130
|
-
|
136
|
+
assert_nil response['external_debug_url']
|
131
137
|
assert_equal response['tag'], tag
|
132
138
|
assert_equal response['tiles'], [tile.to_h]
|
133
139
|
assert_nil response['ignored_elements_data']
|
134
140
|
assert_nil response['considered_elements_data']
|
135
141
|
assert_nil response['sync']
|
142
|
+
assert_nil response['test_case']
|
143
|
+
assert_nil response['labels']
|
144
|
+
assert_nil response['th_test_case_execution_id']
|
136
145
|
end
|
137
146
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
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.9.beta0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- BroswerStack
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: appium_lib
|
@@ -187,7 +186,6 @@ licenses:
|
|
187
186
|
metadata:
|
188
187
|
bug_tracker_uri: https://github.com/percy/percy-appium-ruby/issues
|
189
188
|
source_code_uri: https://github.com/percy/percy-appium-ruby
|
190
|
-
post_install_message:
|
191
189
|
rdoc_options: []
|
192
190
|
require_paths:
|
193
191
|
- percy
|
@@ -202,8 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
200
|
- !ruby/object:Gem::Version
|
203
201
|
version: '0'
|
204
202
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
206
|
-
signing_key:
|
203
|
+
rubygems_version: 3.6.7
|
207
204
|
specification_version: 4
|
208
205
|
summary: Percy visual testing for Ruby Appium Mobile Apps
|
209
206
|
test_files: []
|