File tree 2 files changed +34
-1
lines changed
2 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -39,9 +39,36 @@ def test_set_immediate_value
39
39
end
40
40
41
41
def test_page_source
42
+ require 'rexml/document'
43
+
44
+ expected = %w(
45
+ hierarchy
46
+ android.widget.FrameLayout
47
+ android.view.ViewGroup
48
+ android.widget.FrameLayout
49
+ android.view.ViewGroup
50
+ android.widget.TextView
51
+ android.widget.FrameLayout
52
+ android.widget.ListView
53
+ android.widget.TextView
54
+ android.widget.TextView
55
+ android.widget.TextView
56
+ android.widget.TextView
57
+ android.widget.TextView
58
+ android.widget.TextView
59
+ android.widget.TextView
60
+ android.widget.TextView
61
+ android.widget.TextView
62
+ android.widget.TextView
63
+ android.widget.TextView
64
+ android.widget.TextView
65
+ )
66
+
42
67
s_source = @driver . page_source
68
+ xml = REXML ::Document . new s_source
43
69
44
- assert s_source . include? ( 'o.appium.android.apis' )
70
+ assert s_source . include? ( 'io.appium.android.apis' )
71
+ assert_equal expected , xml [ 1 ] . elements . each ( '//*' ) { |v | v } . map { |v | v . name }
45
72
end
46
73
47
74
# def test_location
Original file line number Diff line number Diff line change @@ -48,16 +48,22 @@ def by_predicate(value)
48
48
49
49
def test_page_source
50
50
require 'json'
51
+ require 'rexml/document'
52
+
51
53
response = Net ::HTTP . get ( URI ( 'http://localhost:8100/source' ) )
52
54
source = JSON . parse ( response ) [ 'value' ]
55
+ xml = REXML ::Document . new source
53
56
54
57
assert !source . include? ( 'AppiumAUT' )
55
58
assert source . include? ( 'XCUIElementTypeApplication type' )
59
+ assert xml [ 2 ] . elements . each ( '//*' ) { |v | v } . map { |v | v . name } == 77
56
60
57
61
s_source = @@driver . page_source
62
+ s_xml = REXML ::Document . new s_source
58
63
59
64
assert s_source . include? ( 'AppiumAUT' )
60
65
assert s_source . include? ( 'XCUIElementTypeApplication type' )
66
+ assert s_xml [ 2 ] . elements . each ( '//*' ) { |v | v } . map { |v | v . name } == 81
61
67
end
62
68
63
69
def test_location
You can’t perform that action at this time.
0 commit comments