Skip to content

Commit 92712d4

Browse files
committed
add chrome option into helper
1 parent 2bfc6b5 commit 92712d4

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

test/functional/android/android/device_test.rb

+5
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,19 @@ def test_context_related
8686

8787
@@core.wait { assert_equal 'NATIVE_APP', @driver.current_context }
8888

89+
native_page = @driver.page_source
90+
8991
contexts = @driver.available_contexts
9092
webview_context = contexts.detect { |e| e.start_with?('WEBVIEW') }
9193

9294
@driver.set_context webview_context
9395
@@core.wait { assert @driver.current_context.start_with? 'WEBVIEW' }
9496

97+
webview_page = @driver.page_source
98+
9599
@driver.switch_to_default_context
96100
@@core.wait { assert_equal 'NATIVE_APP', @driver.current_context }
101+
assert native_page != webview_page
97102
end
98103

99104
def test_app_string

test/test_helper.rb

+13-3
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ def self.android
4646
new.android
4747
end
4848

49+
def self.android_web
50+
new.android_web
51+
end
52+
4953
# Require a simulator which OS version is 11.4, for example.
5054
def ios
5155
wda_local_port = get_wda_local_port
@@ -95,6 +99,12 @@ def android
9599
language: 'en',
96100
locale: 'US',
97101
adbExecTimeout: 5_000, # 5 sec
102+
# An emulator 8.1 has Chrome/61.0.3163.98
103+
# Download a chrome driver from https://chromedriver.storage.googleapis.com/index.html?path=2.34/
104+
# chromedriverExecutable: "#{Dir.pwd}/test/functional/app/chromedriver_2.34",
105+
chromeOptions: {
106+
args: ['--disable-popup-blocking']
107+
}
98108
},
99109
appium_lib: {
100110
export_session: true,
@@ -113,9 +123,9 @@ def android_web
113123
automationName: ENV['AUTOMATION_NAME'] || 'uiautomator2',
114124
chromeOptions: { androidPackage: 'com.android.chrome', args: ['--disable-popup-blocking'] },
115125
# refer: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md
116-
# chromedriverExecutable: "#{Dir.pwd}/test/functional/app/chromedriver",
117-
# autoWebviewTimeout: 10000,
118-
chromedriverUseSystemExecutable: true,
126+
# An emulator 8.1 has Chrome/61.0.3163.98
127+
# Download a chrome driver from https://chromedriver.storage.googleapis.com/index.html?path=2.34/
128+
# chromedriverExecutable: "#{Dir.pwd}/test/functional/app/chromedriver_2.34",
119129
udid: get_udid_name,
120130
deviceName: 'Android Emulator',
121131
someCapability: 'some_capability',

0 commit comments

Comments
 (0)