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

Commit

Permalink
Merge pull request #15603 from bebef1987/fix_calendar
Browse files Browse the repository at this point in the history
Bug 960744 - Intermittent test_calendar_new_event_appears_on_all_calenda...
  • Loading branch information
Zac committed Feb 7, 2014
2 parents 4d85572 + cbd7961 commit 427b1ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Expand Up @@ -2,6 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from datetime import datetime
from marionette.by import By
from gaiatest.apps.calendar.app import Calendar

Expand All @@ -11,6 +12,8 @@ class NewEvent(Calendar):
_modify_event_view_locator = (By.ID, 'modify-event-view')
_event_title_input_locator = (By.XPATH, "//input[@data-l10n-id='event-title']")
_event_location_input_locator = (By.XPATH, "//input[@data-l10n-id='event-location']")
_event_start_time_value_locator = (By.ID, "start-time-locale")
_event_start_date_value_locator = (By.ID, "start-date-locale")
_edit_event_button_locator = (By.CSS_SELECTOR, 'button.edit')
_save_event_button_locator = (By.CSS_SELECTOR, 'button.save')

Expand All @@ -28,5 +31,8 @@ def fill_event_location(self, location):
self.keyboard.dismiss()

def tap_save_event(self):
event_start_time = self.marionette.find_element(*self._event_start_time_value_locator).text
event_start_date = self.marionette.find_element(*self._event_start_date_value_locator).text
self.marionette.find_element(*self._save_event_button_locator).tap()
self.wait_for_element_not_displayed(*self._modify_event_view_locator)
return datetime.strptime(event_start_time + event_start_date, '%I:%M %p%m/%d/%Y')
Expand Up @@ -17,11 +17,8 @@ def test_that_new_event_appears_on_all_calendar_views(self):
_seconds_since_epoch = self.marionette.execute_script("return Date.now();")
now = datetime.fromtimestamp(_seconds_since_epoch / 1000)

# We know that the default event time will be rounded up 1 hour
event_start_date_time = now + timedelta(hours=1)

event_title = 'Event Title %s' % str(event_start_date_time.time())
event_location = 'Event Location %s' % str(event_start_date_time.time())
event_title = 'Event Title %s' % str(now.time())
event_location = 'Event Location %s' % str(now.time())

calendar = Calendar(self.marionette)
calendar.launch()
Expand All @@ -31,7 +28,7 @@ def test_that_new_event_appears_on_all_calendar_views(self):
new_event.fill_event_title(event_title)
new_event.fill_event_location(event_location)

new_event.tap_save_event()
event_start_date_time = new_event.tap_save_event()

# assert that the event is displayed as expected in month view
self.assertIn(event_title, calendar.displayed_events_in_month_view(event_start_date_time))
Expand Down

0 comments on commit 427b1ed

Please sign in to comment.