Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 948472 - Test for Bug 938219: "add to an existing contact" activity #16835

Merged
merged 1 commit into from May 27, 2014

Conversation

bebef1987
Copy link
Contributor

No description provided.

def tap_header(self):
self.wait_for_element_displayed(*self._message_header_locator)
self.marionette.find_element(*self._message_header_locator).tap()

from gaiatest.apps.system.regions.activities import Activities
return Activities(self.marionette, switch_frame=False)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's kind of confusing but there's already another Activities region at gaiatest.apps.messages.regions.activities

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove that class and the confusion and use the main system activities class
@zacc ?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it and I thought it was a bit confusing to have one System class that's not actually operating in the system so I think we should reuse the region in messages/region/activities.py

@viorelaioia-zz
Copy link

LGTM now, the test runs nice on device :)

@@ -143,12 +143,13 @@ def __init__(self, marionette):
update = self.wait_for_element_present(*self._update_locator)
self.wait_for_condition(lambda m: update.location['y'] == 0)

def tap_update(self):
def tap_update(self, switch_to_contact_details=True):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that in this class we already have a method that has return_details. Let's make them the same, for consistency.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zacc which method? the only other place we return details is in the tap_cancel method but that's not used in our test

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry my mistake, it's in the parent to this (Contacts class): tap(return_details=False)

I don't like this because switch_to reminds me of switch to frame, but this doesn't do that. so let's use return_details which is more consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@chirarobert
Copy link
Contributor

I ran the test locally and it failed once with the following error:

Traceback (most recent call last):
  File "/home/robertchira/.virtualenvs/gaia/local/lib/python2.7/site-packages/marionette_client-0.7.5-py2.7.egg/marionette/marionette_test.py", line 163, in run
    testMethod()
  File "/home/robertchira/workspace/gaia/tests/python/gaia-ui-tests/gaiatest/tests/functional/messages/test_add_to_an_existing_contact_from_messages.py", line 49, in test_sms_add_number_to_existing_contact
    self.wait_for_condition(lambda m: self.message_thread.header_text == self.contact['name'])
  File "/home/robertchira/workspace/gaia/tests/python/gaia-ui-tests/gaiatest/gaia_test.py", line 1043, in wait_for_condition
    Wait(self.marionette, timeout).until(method, message=message)
  File "/home/robertchira/.virtualenvs/gaia/local/lib/python2.7/site-packages/marionette_client-0.7.5-py2.7.egg/marionette/wait.py", line 143, in until
    cause=last_exc)
TimeoutException: TimeoutException: Timed out after 30.098954916 seconds
TEST-UNEXPECTED-FAIL | test_add_to_an_existing_contact_from_messages.py test_add_to_an_existing_contact_from_messages.TestSmsAddToExistingContact.test_sms_add_number_to_existing_contact | 
----------------------------------------------------------------------
Ran 1 test in 109.417s

I was not watching the device when the error occurred so I'm not sure what happened. Maybe start an adhoc run with the test and see if it is reproduced.

@bebef1987
Copy link
Contributor Author

Updated

def tap_header(self):
self.wait_for_element_displayed(*self._message_header_locator)
self.marionette.find_element(*self._message_header_locator).tap()

from gaiatest.apps.messages.regions.activities import Activities
return Activities(self.marionette)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think tap_call below this should be moved into the activities region if you make this change. but funcitonally it's OK without it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be done in a different task
we don't use this method in my test and moving it would affect other tests

@chirarobert
Copy link
Contributor

lgtm

@@ -35,10 +35,21 @@ def received_messages(self):
def all_messages(self):
return [Message(self.marionette, message) for message in self.marionette.find_elements(*self._all_messages_locator)]

def wait_for_message_header_visible(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we bothering to define a method for this that is only used once in header_text? Why not just put self.wait_for_element_displayed(*self._message_header_locator) as the first line in header_text()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point done

@bobsilverberg
Copy link
Contributor

The test works well. Just a few comments in the PR.

def test_sms_add_number_to_existing_contact(self):

# open the message thread screen
self.message_thread = self.messages.tap_first_received_message()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first message in the list, it can be either the first received message, or the first sent one. We should rename this method to tap_first_message().
But, as it is used in some other test too(https://github.com/mozilla-b2g/gaia/blob/master/tests/python/gaia-ui-tests/gaiatest/tests/functional/messages/test_sms_to_dialer.py#L30), maybe it is better to leave it as it is for now.

@viorelaioia-zz
Copy link

Besides the extra space, lgtm

@AndreiH
Copy link

AndreiH commented May 27, 2014

Test that fails on Travis is not related to this pull

AndreiH pushed a commit that referenced this pull request May 27, 2014
Bug 948472 - Test for Bug 938219: "add to an existing contact" activity
@AndreiH AndreiH merged commit 75bf3cb into mozilla-b2g:master May 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
6 participants