本文整理汇总了Python中gaiatest.apps.phone.app.Phone类的典型用法代码示例。如果您正苦于以下问题:Python Phone类的具体用法?Python Phone怎么用?Python Phone使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Phone类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dialer_make_call
def test_dialer_make_call(self):
"""https://moztrap.mozilla.org/manage/case/1298/"""
test_phone_number = self.testvars['remote_phone_number']
phone = Phone(self.marionette)
phone.launch()
self.assertEqual('normal', self.data_layer.current_audio_channel)
call_screen = phone.keypad.call_number(test_phone_number)
# Wait for call screen to be dialing
call_screen.wait_for_outgoing_call()
self.assertEqual('telephony', self.data_layer.current_audio_channel)
call_screen.switch_to_call_screen_frame()
# Wait for the state to get to at least 'dialing'
active_states = ('dialing', 'alerting', 'connecting', 'connected')
call_screen.wait_for_condition(
lambda m: self.data_layer.active_telephony_state in active_states,
timeout=30)
if len(test_phone_number) <= 12:
# Check the number displayed is the one we dialed
self.assertEqual(test_phone_number, call_screen.outgoing_calling_contact)
else:
self.assertEqual(test_phone_number[:2], call_screen.outgoing_calling_contact[:2])
示例2: test_dialer_airplane_mode
def test_dialer_airplane_mode(self):
# https://moztrap.mozilla.org/manage/case/2282/
# Disable the device radio, enable Airplane mode
self.data_layer.set_setting('airplaneMode.enabled', True)
# Check that we are in Airplane mode
self.assertTrue(self.data_layer.get_setting('airplaneMode.enabled'))
# Launch the device dialer
phone = Phone(self.marionette)
phone.launch()
# Make a call
test_phone_number = self.testvars['remote_phone_number']
phone.keypad.dial_phone_number(test_phone_number)
phone.keypad.tap_call_button(switch_to_call_screen=False)
# Check for the Airplane mode dialog
phone.wait_for_confirmation_dialog()
# Verify the correct dialog text for the case
self.assertEqual("Airplane mode activated", phone.confirmation_dialog_text)
# Verify that there is no active telephony state; window.navigator.mozTelephony.active is null
self.assertRaises(JavascriptException, self.marionette.execute_script,
"return window.navigator.mozTelephony.active.state;")
示例3: TestDuplicatePhoneNumber
class TestDuplicatePhoneNumber(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact(givenName='Test', tel=None)
self.contact2 = MockContact(givenName=self.contact['givenName'], tel={
'type': 'Mobile',
'value': '123456789'})
self.data_layer.insert_contact(self.contact)
self.data_layer.insert_contact(self.contact2)
def test_duplicate_phone_number(self):
self.phone = Phone(self.marionette)
self.phone.launch()
number_to_add = self.contact2['tel']['value']
self.phone.keypad.dial_phone_number(number_to_add)
add_number = self.phone.keypad.tap_add_contact()
contacts_app = add_number.tap_add_to_existing_contact()
contacts_app.wait_for_contacts(2)
edit_contact = contacts_app.contacts[0].tap(return_class='EditContact')
duplicate_contact_found = edit_contact.tap_update(return_class='Merge')
merge_contact = duplicate_contact_found.tap_on_merge()
self.device.touch_home_button()
contacts = Contacts(self.marionette)
contacts.launch()
contacts.wait_for_contacts(1)
self.assertEqual(contacts_app.contacts[0].name, self.contact['givenName'])
示例4: test_set_up_conference_call
def test_set_up_conference_call(self):
"""Set up a conference between the remote phone and Plivo."""
test_phone_number = self.testvars['remote_phone_number']
from gaiatest.utils.plivo.plivo_util import PlivoUtil
PLIVO_TIMEOUT = 30
self.plivo = PlivoUtil(
self.testvars['plivo']['auth_id'],
self.testvars['plivo']['auth_token'],
self.testvars['plivo']['phone_number']
)
phone = Phone(self.marionette)
phone.launch()
call_screen = phone.keypad.call_number(test_phone_number)
call_screen.wait_for_outgoing_call()
call_screen.wait_for_condition(lambda m: self.data_layer.active_telephony_state == 'connected')
call_uuid = self.plivo.make_call(
to_number=self.testvars['carrier']['phone_number'].replace('+', ''),
timeout=PLIVO_TIMEOUT)
call_screen = CallScreen(self.marionette)
call_screen.wait_for_incoming_call_while_on_call()
call_screen.answer_call_while_on_call()
# Wait for Plivo to report the call as connected
Wait(self.plivo, timeout=PLIVO_TIMEOUT).until(
lambda p: p.is_call_connected(call_uuid),
message='The call was not connected.')
call_screen.merge_calls()
self.assertEqual(call_screen.conference_label, 'Conference (2)')
示例5: TestAccessibilityPhoneKeypad
class TestAccessibilityPhoneKeypad(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
self.phone = Phone(self.marionette)
self.phone.launch()
def test_phone_keypad(self):
# Delete is hidden from the screen reader.
self.assertTrue(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone.keypad._keypad_delete_locator)))
# Add contact button is disabled for the screen reader.
self.assertTrue(self.accessibility.is_disabled(self.marionette.find_element(
*self.phone.keypad._add_new_contact_button_locator)))
number_to_verify = self.contact['tel']['value']
# Screen reader dial number
self.phone.keypad.a11y_dial_phone_number(number_to_verify)
# Check that the number was entered correctly.
self.assertEqual(self.phone.keypad.phone_number, number_to_verify)
# Delete is visible to the screen reader.
self.assertFalse(self.accessibility.is_hidden(self.marionette.find_element(
*self.phone.keypad._keypad_delete_locator)))
# Call button is enabled for the screen reader.
self.assertFalse(self.accessibility.is_disabled(self.marionette.find_element(
*self.phone.keypad._call_bar_locator)))
# Add contact button is enabled for the screen reader.
self.assertFalse(self.accessibility.is_disabled(self.marionette.find_element(
*self.phone.keypad._add_new_contact_button_locator)))
示例6: test_dialer_make_call
def test_dialer_make_call(self):
"""https://moztrap.mozilla.org/manage/case/1298/"""
test_phone_number = self.testvars['remote_phone_number']
phone = Phone(self.marionette)
phone.launch()
# FIXME: Bug 1011000: will need to switch it on
# Assert that the channel has been switched to telephony
# channel_change_call = self.data_layer.wait_for_audio_channel_changed()
call_screen = phone.keypad.call_number(test_phone_number)
# Wait for call screen to be dialing
call_screen.wait_for_outgoing_call()
# FIXME: Bug 1011000: will need to switch it on
# Assert that the channel has been switched back to normal
# channel_change_hang = self.data_layer.wait_for_audio_channel_changed()
# Wait for the state to get to at least 'dialing'
active_states = ('dialing', 'alerting', 'connecting', 'connected')
call_screen.wait_for_condition(
lambda m: self.data_layer.active_telephony_state in active_states,
timeout=30)
if len(test_phone_number) <= 12:
# Check the number displayed is the one we dialed
self.assertEqual(test_phone_number, call_screen.outgoing_calling_contact)
else:
self.assertEqual(test_phone_number[:2], call_screen.outgoing_calling_contact[:2])
示例7: test_dialer_make_call
def test_dialer_make_call(self):
"""https://moztrap.mozilla.org/manage/case/1298/"""
test_phone_number = '0956820097'
phone = Phone(self.marionette)
phone.launch()
call_screen = phone.keypad.call_number(test_phone_number)
示例8: __init__
def __init__(self, marionette):
Phone.__init__(self, marionette)
self.marionette.switch_to_frame()
self.wait_for_element_present(*self._call_screen_locator, timeout=30)
call_screen = self.marionette.find_element(*self._call_screen_locator)
self.marionette.switch_to_frame(call_screen)
示例9: test_MMI_code_IMEI
def test_MMI_code_IMEI(self):
phone = Phone(self.marionette)
phone.launch()
# Dial the code
phone.keypad.dial_phone_number(IMEI_CODE)
attention_screen = AttentionScreen(self.marionette)
self.assertEqual(attention_screen.message, self.testvars['imei'])
示例10: TestDialerFindContact
class TestDialerFindContact(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
# Seed the contact with the remote phone number so we don't call random people
self.contact = MockContact(tel={
'type': 'Mobile',
'value': "%s" % self.testvars['remote_phone_number']})
self.data_layer.insert_contact(self.contact)
# launch the Phone app
self.phone = Phone(self.marionette)
self.phone.launch()
def test_dialer_find_contact(self):
number_to_verify = self.contact['tel']['value']
# Dial number
self.phone.keypad.dial_phone_number(number_to_verify[:5])
# Assert search popup is displayed
self.phone.keypad.wait_for_search_popup_visible()
# Assert name and phone number are the ones in the saved contact
self.assertEqual(self.phone.keypad.suggested_name, self.contact['name'])
self.assertEqual(self.phone.keypad.suggested_phone_number, number_to_verify)
# Tap search popup suggestion
call_screen = self.phone.keypad.tap_search_popup()
# Wait for call screen to be dialing
call_screen.wait_for_outgoing_call()
# Wait for the state to get to at least 'dialing'
active_states = ('dialing', 'alerting', 'connecting', 'connected')
call_screen.wait_for_condition(
lambda m: self.data_layer.active_telephony_state in active_states,
timeout=30)
if len(number_to_verify) <= 12:
# Check the number displayed is the one we dialed
self.assertEqual(number_to_verify, call_screen.calling_contact_information.split(', ')[1])
else:
self.assertEqual(number_to_verify[:2], call_screen.calling_contact_information.split(', ')[1][:2])
def tearDown(self):
# Switch back to main frame before Marionette loses track bug #840931
self.marionette.switch_to_frame()
# In case the assertion fails this will still kill the call
# An open call creates problems for future tests
self.data_layer.kill_active_call()
GaiaTestCase.tearDown(self)
示例11: test_clear_phone_number
def test_clear_phone_number(self):
"""
https://moztrap.mozilla.org/manage/case/2191/
"""
test_phone_number = '5551234567'
phone = Phone(self.marionette)
phone.launch()
phone.keypad.dial_phone_number(test_phone_number)
self.assertEquals(phone.keypad.phone_number, test_phone_number)
phone.keypad.clear_phone_number()
self.assertEquals(phone.keypad.phone_number, '')
示例12: TestDialerAddContact
class TestDialerAddContact(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
# launch the Phone app
self.phone = Phone(self.marionette)
self.phone.launch()
def test_dialer_add_contact(self):
number_to_verify = self.contact['tel'][0]['value']
# Dial number
self.phone.keypad.dial_phone_number(number_to_verify)
# Assert that the number was entered correctly.
self.assertEqual(self.phone.keypad.phone_number, number_to_verify)
# Click Add contact button
add_new_number = self.phone.keypad.tap_add_contact()
# Tap on "Create New Contact"
new_contact = add_new_number.tap_create_new_contact()
# Enter data into fields
new_contact.type_given_name(self.contact['givenName'][0])
new_contact.type_family_name(self.contact['familyName'][0])
# Click Done button
new_contact.tap_done()
# Switch back to keypad-view
self.wait_for_condition(lambda m: self.apps.displayed_app.name == self.phone.name)
self.apps.switch_to_displayed_app()
#Go to Contact list and Verify result
contacts = self.phone.tap_contacts()
# Check only one contact is created
self.assertEqual(1, len(contacts.contacts))
# Tap on the new contact
contact_details = contacts.contacts[0].tap()
# Verify full name
full_name = self.contact['givenName'][0] + " " + self.contact['familyName'][0]
self.assertEqual(contact_details.full_name, full_name)
# Verify phone number
self.assertEqual(contact_details.phone_number, number_to_verify)
示例13: test_MMI_code_IMEI
def test_MMI_code_IMEI(self):
phone = Phone(self.marionette)
phone.launch()
# Dial the code
phone.keypad.dial_phone_number(IMEI_CODE)
attention_screen = AttentionScreen(self.marionette)
# Go through all expected IMEIs and check they are in the message
for imei in self.environment.imei_numbers:
self.assertIn(imei, attention_screen.message)
示例14: test_dialer_dsds_make_phone_call_with_default_sim
def test_dialer_dsds_make_phone_call_with_default_sim(self, default_sim):
"""
Place a phone call with the default SIM.
"""
self.data_layer.set_setting('ril.telephony.defaultServiceId', default_sim - 1)
remote_phone_number = self.testvars['remote_phone_number']
phone = Phone(self.marionette)
phone.launch()
call_screen = phone.keypad.call_number(remote_phone_number)
call_screen.wait_for_outgoing_call()
self.assertIn(str(default_sim), call_screen.via_sim)
call_screen.hang_up()
示例15: TestDialerAddContact
class TestDialerAddContact(GaiaTestCase):
def setUp(self):
GaiaTestCase.setUp(self)
self.contact = MockContact()
# launch the Phone app
self.phone = Phone(self.marionette)
self.phone.launch()
def test_dialer_add_contact(self):
number_to_verify = self.contact['tel']['value']
# Dial number
self.phone.keypad.dial_phone_number(number_to_verify)
# Assert that the number was entered correctly.
self.assertEqual(self.phone.keypad.phone_number, number_to_verify)
# Click Add contact button
add_new_number = self.phone.keypad.tap_add_contact()
# Tap on "Create New Contact"
new_contact = add_new_number.tap_create_new_contact()
# Enter data into fields
new_contact.type_given_name(self.contact['givenName'])
new_contact.type_family_name(self.contact['familyName'])
# Click Done button, don't return Contacts because we return to Dialer
new_contact.tap_done(return_contacts=False)
#Go to Contact list and Verify result
contacts = self.phone.tap_contacts()
# Check only one contact is created
contacts.wait_for_contacts(1)
# Tap on the new contact
contact_details = contacts.contacts[0].tap()
# Verify full name
full_name = self.contact['givenName'] + " " + self.contact['familyName']
self.assertEqual(contact_details.full_name, full_name)
# Verify phone number
self.assertEqual(contact_details.phone_number, number_to_verify)