Commit 6131f1ec authored by Gabriel L. Oliveira's avatar Gabriel L. Oliveira

Test Change Month, Day, Year of one event should update the event.

Test both start and stop properties of Month, Day and Year.
parent 6a820be3
......@@ -405,6 +405,96 @@ class TestUNGCalendar(UNGTestMixin):
self.failIf(self.selenium.is_text_present("No Results"))
self.assertEqual(event_name, self.selenium.get_text("//div[@class='event-listview']/table/tbody/tr/td[3]"))
def test_modify_day_month_year_of_event(self):
"""test to verify that changing day, month or year of an event
will update it"""
test_time = int(unittest.time.time())
#create an event
self.open_ung_default_page("calendar")
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
#create event of type 'Visit'
event_name = 'Functional UNG Test %d - My Event' % test_time
self.create_calendar_event('Note', name=event_name)
#assert event object is displayed
self.selenium.is_element_present("//div[contains(@title,'Title:%s')]" % event_name)
#change day of event
self.selenium.click("//div[contains(@title,'Title:%s')]" % event_name)
self.selenium.click("//span[@id='bbit-cs-editLink']")
#XXX due to limitation of days in a month
old_event_start_day = int(self.selenium.get_value("start_date_day"))
new_event_start_day = old_event_start_day > 26 and 1 or old_event_start_day + 1
old_event_stop_day = int(self.selenium.get_value("stop_date_day"))
new_event_stop_day = old_event_stop_day > 26 and 1 or old_event_stop_day + 1
self.selenium.type("start_date_day", new_event_start_day)
self.selenium.type("stop_date_day", new_event_stop_day)
self.selenium.click("//div[@aria-labelledby='ui-dialog-title-new_event_dialog']//button")
self.open_ung_default_page("calendar", clear_cache=1, wait_for_activities=1)
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
#"surf" to the event
self.selenium.type("//input[@name='searchable-text']", '\"' + event_name + '\"')
self.selenium.click("//input[@id='submit-search']")
self.selenium.wait_for_condition("selenium.isElementPresent('//td[@id=\"event-date\"]')", "10000")
self.selenium.click("//td[@id='event-date']")
#check new start and stop days on event
self.selenium.wait_for_condition("selenium.isElementPresent('//div[contains(@title,\"Title:%s\")]')" % event_name, "10000")
self.selenium.click("//div[contains(@title,'Title:%s')]" % event_name)
self.selenium.click("//span[@id='bbit-cs-editLink']")
self.assertEqual(new_event_start_day, int(self.selenium.get_value("start_date_day")))
self.assertEqual(new_event_stop_day, int(self.selenium.get_value("stop_date_day")))
self.selenium.click("//a[@class='ui-dialog-titlebar-close ui-corner-all']")
#change month of event
self.selenium.click("//div[contains(@title,'Title:%s')]" % event_name)
self.selenium.click("//span[@id='bbit-cs-editLink']")
#XXX due to limitation of months in a year
old_event_start_month = int(self.selenium.get_value("start_date_month"))
new_event_start_month = old_event_start_month > 11 and 1 or old_event_start_month + 1
old_event_stop_month = int(self.selenium.get_value("stop_date_month"))
new_event_stop_month = old_event_stop_month > 11 and 1 or old_event_stop_month + 1
self.selenium.type("start_date_month", new_event_start_month)
self.selenium.type("stop_date_month", new_event_stop_month)
self.selenium.click("//div[@aria-labelledby='ui-dialog-title-new_event_dialog']//button")
self.open_ung_default_page("calendar", clear_cache=1, wait_for_activities=1)
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
#"surf" to the event
self.selenium.type("//input[@name='searchable-text']", '\"' + event_name + '\"')
self.selenium.click("//input[@id='submit-search']")
self.selenium.wait_for_condition("selenium.isElementPresent('//td[@id=\"event-date\"]')", "10000")
self.selenium.click("//td[@id='event-date']")
#check new start and stop months on event
self.selenium.wait_for_condition("selenium.isElementPresent('//div[contains(@title,\"Title:%s\")]')" % event_name, "10000")
self.selenium.click("//div[contains(@title,'Title:%s')]" % event_name)
self.selenium.click("//span[@id='bbit-cs-editLink']")
self.assertEqual(new_event_start_month, int(self.selenium.get_value("start_date_month")))
self.assertEqual(new_event_stop_month, int(self.selenium.get_value("stop_date_month")))
self.selenium.click("//a[@class='ui-dialog-titlebar-close ui-corner-all']")
#change year of event
self.selenium.click("//div[contains(@title,'Title:%s')]" % event_name)
self.selenium.click("//span[@id='bbit-cs-editLink']")
old_event_start_year = int(self.selenium.get_value("start_date_year"))
new_event_start_year = old_event_start_year + 1
old_event_stop_year = int(self.selenium.get_value("stop_date_year"))
new_event_stop_year = old_event_stop_year + 1
self.selenium.type("start_date_year", new_event_start_year)
self.selenium.type("stop_date_year", new_event_stop_year)
self.selenium.click("//div[@aria-labelledby='ui-dialog-title-new_event_dialog']//button")
self.open_ung_default_page("calendar", clear_cache=1, wait_for_activities=1)
self.selenium.wait_for_condition("selenium.browserbot.findElementOrNull('loadingpannel').style.display == 'none'", "10000");
#"surf" to the event
self.selenium.type("//input[@name='searchable-text']", '\"' + event_name + '\"')
self.selenium.click("//input[@id='submit-search']")
self.selenium.wait_for_condition("selenium.isElementPresent('//td[@id=\"event-date\"]')", "10000")
self.selenium.click("//td[@id='event-date']")
#check new start and stop years on event
self.selenium.wait_for_condition("selenium.isElementPresent('//div[contains(@title,\"Title:%s\")]')" % event_name, "10000")
self.selenium.click("//div[contains(@title,'Title:%s')]" % event_name)
self.selenium.click("//span[@id='bbit-cs-editLink']")
self.assertEqual(new_event_start_year, int(self.selenium.get_value("start_date_year")))
self.assertEqual(new_event_stop_year, int(self.selenium.get_value("stop_date_year")))
self.selenium.click("//a[@class='ui-dialog-titlebar-close ui-corner-all']")
if __name__ == "__main__":
unittest.main()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment