mirror of
https://github.com/appium/appium.git
synced 2026-10-18 13:41:26 +08:00
974a8c3891
* docs: tweak platform-support in readme and platform-support page * add you.i and flutter * add section, tweak gecko, review * test: update ruby sample * fix android * update readme * remove unused gem
42 lines
1.4 KiB
Ruby
42 lines
1.4 KiB
Ruby
require 'spec_helper'
|
|
require 'appium_lib'
|
|
|
|
describe 'Basic Android interactions' do
|
|
|
|
before(:all) do
|
|
caps = android_caps
|
|
caps[:caps][:appActivity] = '.app.SearchInvoke'
|
|
@driver = Appium::Driver.new(caps, false).start_driver
|
|
end
|
|
|
|
after(:all) do
|
|
@driver&.quit
|
|
end
|
|
|
|
it 'should send keys to search box and then check the value' do
|
|
search_box_element = @driver.find_element :id, 'txt_query_prefill'
|
|
search_box_element.send_keys 'Hello world!'
|
|
|
|
on_search_requested_button = @driver.find_element :id, 'btn_start_search'
|
|
on_search_requested_button.click
|
|
|
|
search_text = @driver.find_element :id, 'android:id/search_src_text'
|
|
search_text_value = search_text.text
|
|
expect(search_text_value).to eql 'Hello world!'
|
|
end
|
|
|
|
it 'should click a button that opens an alert and then dismisses it' do
|
|
@driver.start_activity app_package: ANDROID_PACKAGE, app_activity: '.app.AlertDialogSamples'
|
|
|
|
open_dialog_button = @driver.find_element :id, 'io.appium.android.apis:id/two_buttons'
|
|
open_dialog_button.click
|
|
|
|
alert_element = @driver.find_element :id, 'android:id/alertTitle'
|
|
alert_text = alert_element.text
|
|
expect(alert_text).to eql "Lorem ipsum dolor sit aie consectetur adipiscing\nPlloaso mako nuto siwuf cakso dodtos anr koop."
|
|
close_dialog_button = @driver.find_element :id, 'android:id/button1'
|
|
|
|
close_dialog_button.click
|
|
end
|
|
end
|