~canonical-platform-qa/ubuntu-system-tests/fixes_dependendies_already_installed

« back to all changes in this revision

Viewing changes to ubuntu_system_tests/helpers/addressbook/__init__.py

Fix for the test test_add_contact_with_name_and_number.

There were two problems around this failure:
1. The expand_contact method was waiting for an state that never happens.
2. The class ABContactListPage was used to dig in the contact details view page instead of using the class ABContactViewPage.

Approved by Brendan Donegan, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
        """
32
32
        contact_delegate = self._get_contact_delegate(index)
33
33
        self.pointing_device.click_object(contact_delegate)
34
 
        contact_delegate.state.wait_for('expanded')
35
 
 
36
 
    def get_contact_mobile_phone_number(self, index):
37
 
        # XXX this needs to be implemented as a general get_data method, in
38
 
        # the address book branch with object names. --elopio - 2015-02-19
39
 
        contact_delegate = self._get_contact_delegate(index)
40
 
        return contact_delegate.select_single(
41
 
            'SubtitledWithColors').select_many('Label')[1].text
 
34
        contact_delegate.visible.wait_for(False)
 
35
 
 
36
 
 
37
class ABContactViewPage(pages.ABContactViewPage):
 
38
 
 
39
    def get_contact_mobile_phone_number(self):
 
40
        """Return the first mobile phone listed for the contact"""
 
41
        mobile_fields = self.select_many('BasicFieldView',
 
42
                                         typeLabel='Mobile')
 
43
        if not mobile_fields:
 
44
            raise Exception("Mobile fields not found")
 
45
 
 
46
        return mobile_fields[0].\
 
47
            select_single('Label', objectName='label_phoneNumber_0.0').text