def startTest(self): appView = self.app_ns.itsView # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) #create an event to export self.logger.startAction('Create event to export') event = QAUITestAppLib.UITestItem("Event", self.logger) event_UUID = event.item.itsUUID #write some stuff in the event to make it unique event.SetAttr(displayName=uw("Original Event"), startDate="01/01/2001", startTime="12:00 AM", body=uw("This is the original event")) self.logger.addComment("Created Event to Export") #export the event path = os.path.join(Globals.chandlerDirectory, "tools/cats/DataFiles") filename = 'tempOverwriteTest.ics' fullpath = os.path.join(path, filename) if os.path.exists(fullpath): os.remove(fullpath) #Upcast path to unicode since Sharing requires a unicode path fullpath = unicode(fullpath, sys.getfilesystemencoding()) collection = pim.ListCollection(itsView=appView) # exporting all Events is VERY expensive, it doesn't seem like a good # way to test if events can be exported successfully. Instead, just # export one event. #for tmpEvent in Calendar.EventStamp.getCollection(appView): #collection.add(tmpEvent) collection.add(event.item) sharing.exportFile(appView, fullpath, collection) application = wx.GetApp() application.Yield(True) self.logger.addComment("Exported event") #change the event after exporting event.SetAttr(displayName=uw("Changed Event"), body=uw("This event has been changed")) self.logger.addComment("event changed after export") #import the original event sharing.importFile(appView, fullpath) application.Yield(True) self.logger.addComment("Imported exported event") #check if changed attributes have reverted to original values #find imported event by UUID self.logger.startAction("Verify event overwritten") found = self.app_ns.view.findUUID(event_UUID) if found.body == uw('This is the original event') and \ found.displayName == uw('Original Event'): self.logger.endAction(True, "Event overwriten") else: self.logger.endAction(False, 'Event not overwriten')
def startTest(self): def testEnabled(event, calendarBlock): # Test that the detail view does display the timezone event.CheckDisplayedValues(EditTimeZone=(True, )) # Test that the calendar view does display the timezone widget self.logger.startAction( "Test that the calendar view does display the timezone widget") if calendarBlock.widget.tzChoice.IsShown(): self.logger.endAction( True, "Timezone widget found when timezones enabled") else: self.logger.endAction( False, "Timezone widget not found even though timezones are enabled" ) def testDisabled(event, calendarBlock): # Test that the detail view does not display the timezone self.logger.startAction( "Test that timezone hidden when not enabled") event.CheckDisplayedValues(EditTimeZone=(False, )) # Test that the calendar view does not displays the timezone widget if calendarBlock.widget.tzChoice.IsShown(): self.logger.endAction( False, "Timezone widget shown incorrectly when timezones not enabled" ) else: self.logger.endAction( True, "Timezone widget correctly hidden when timezones not enabled" ) # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) # switch to calendar view testView = QAUITestAppLib.UITestView(self.logger) testView.SwitchToCalView() calendarBlock = getattr(self.app_ns, "MainCalendarControl") # Before timezones are enabled, create an event floatingEvent = QAUITestAppLib.UITestItem("Event", self.logger) testDisabled(floatingEvent, calendarBlock) # Enable timezones self.app_ns.root.EnableTimezones() testEnabled(floatingEvent, calendarBlock) # Disable timezones again self.app_ns.root.EnableTimezones() testDisabled(floatingEvent, calendarBlock)
def startTest(self): START_DATE = 0 START_TIME = 1 END_DATE = 2 END_TIME = 3 TIMEZONE = 4 # tests that need to be added: # week to week transistions # non-pacific time zones # other locales dateValues = { 'us': [ # year end transistion ('12/31/04', '11:30 PM', '1/1/05', '12:30 AM', 'America/Chicago'), # leap year (feb has 29 days) ('2/28/04', '11:30 PM', '2/29/04', '12:30 AM', 'America/Chicago'), # leap year (feb has 29 days) ('2/29/04', '11:30 PM', '3/1/04', '12:30 AM', 'America/Chicago' ), # Daylight savings time start ('4/2/06', '1:00 AM', '4/2/06', '3:00 AM', 'America/Chicago'), # Daylight savings time end ('10/29/06', '2:00 AM', '10/29/06', '1:00 AM', 'America/Chicago'), ], } # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) # creation event = QAUITestAppLib.UITestItem("Event", self.logger) for locale in dateValues: testItems = dateValues[locale] for test in testItems: s = uw('%s %s :: %s %s :: %s' % test) event.SetAttr(displayName=uw("Test"), startDate=test[START_DATE], startTime=test[START_TIME], body=s, timeZone=test[TIMEZONE]) event.Check_DetailView({ "displayName": uw("Test"), "startDate": test[START_DATE], "endDate": test[END_DATE], "startTime": test[START_TIME], "endTime": test[END_TIME], "body": s, })
def startTest(self): # action col = QAUITestAppLib.UITestItem("Collection", self.logger) # verification col.Check_CollectionExistence("Untitled") # action col.SetDisplayName(uw("Meeting")) # verification col.Check_CollectionExistence(uw("Meeting")) # action note = QAUITestAppLib.UITestItem("Note", self.logger) note.AddCollection(uw("Meeting")) # verification note.Check_ItemInCollection(uw("Meeting")) # Bug 5803, make sure items in collections that change to not mine # are really not in the All collection, and similarly that events # created after the collection becomes not mine are truly not mine sidebar = QAUITestAppLib.App_ns.sidebar # select the Meeting collection scripting.User.emulate_sidebarClick(sidebar, uw('Meeting')) # Switch to the Calendar View QAUITestAppLib.App_ns.appbar.press("ApplicationBarEventButton") # ... idle() so the app can handle changes QAUITestAppLib.scripting.User.idle() beforeChangeEvent = QAUITestAppLib.UITestItem("Event", self.logger) beforeChangeEvent.AddCollection(uw("Meeting")) beforeChangeEvent.Check_ItemInCollection(uw("Meeting"), expectedResult=True) beforeChangeEvent.Check_ItemInCollection("Dashboard", expectedResult=True) # Change Meeting to stop being in mine sidebar.onToggleMineEvent( QAUITestAppLib.App_ns.SidebarToggleMineItem.event) afterChangeEvent = QAUITestAppLib.UITestItem("Event", self.logger) afterChangeEvent.AddCollection(uw("Meeting")) # both events should be in Meeting and not in All beforeChangeEvent.Check_ItemInCollection(uw("Meeting"), expectedResult=True) beforeChangeEvent.Check_ItemInCollection("Dashboard", expectedResult=False) afterChangeEvent.Check_ItemInCollection(uw("Meeting"), expectedResult=True) afterChangeEvent.Check_ItemInCollection("Dashboard", expectedResult=False)
def startTest(self): QAUITestAppLib.startTestInCalView(self.logger) path = os.path.join(Globals.chandlerDirectory, "tools/cats/DataFiles", "TestRecurrence.ics") # Upcast path to unicode since Sharing requires a unicode path path = unicode(path, sys.getfilesystemencoding()) self.logger.startAction("Importing TestRecurrence.ics") collection = sharing.importFile(self.app_ns.itsView, path) self.app_ns.sidebarCollection.add(collection) # select the collection sidebar = self.app_ns.sidebar QAUITestAppLib.scripting.User.emulate_sidebarClick(sidebar, collection.displayName) scripting.User.idle() self.logger.endAction(True, "Importing calendar") def VerifyEventCreation(title): self.logger.startAction("Verify event titled %s exists" % title) testEvent = self.app_ns.item_named(pim.EventStamp, title) if testEvent is not None: self.logger.endAction(True, " '%s' exists" % title) else: self.logger.endAction(False, "'%s' not created" % title) scripting.User.idle() VerifyEventCreation("Yearly Never End") VerifyEventCreation("Monthly Meeting") VerifyEventCreation("Multi-All Day") VerifyEventCreation("All-day never end") # bug 5593, set an end date for the "Weekly Never End" event sidebar = self.app_ns.sidebar scripting.User.emulate_sidebarClick(sidebar, "TestRecurrence") view = QAUITestAppLib.UITestView(self.logger) # Need to format date the same way the detail view does uiView = wx.GetApp().UIRepositoryView goto = datetime.date(2006, 5, 1) value = datetime.datetime.combine(goto, datetime.time(0, tzinfo=uiView.tzinfo.default)) dateStr = pim.shortDateFormat.format(uiView, value) view.GoToDate(dateStr) event = QAUITestAppLib.GetOccurrence("Weekly Never End", goto) QAUITestAppLib.UITestItem(event, self.logger).SetAttr(recurrenceEnd=dateStr) # event has been deleted by changing recurrence, get a new one event = QAUITestAppLib.GetOccurrence("Weekly Never End", goto) testItem = QAUITestAppLib.UITestItem(event, self.logger) testItem.SelectItem(catchException=True) # Make sure this occurrence exists and was able to be selected testItem.Check_ItemSelected()
def startTest(self): # switch to the all view testView = QAUITestAppLib.UITestView(self.logger) # We need to look at the all view testView.SwitchToAllView() # can't do the next two steps because modal dialogs don't work # with emulate_typing # app_ns().root.NewFlickrCollectionByTag() # User.emulate_typing("oscon2005") # this is what we do instead view = self.app_ns.itsView # get a collection of photos from the oscon2005 tag fc = flickr.PhotoCollection(itsView = view) fc.tag = flickr.Tag.getTag(view, "oscon2005") fc.displayName = uw("oscon2005") self.logger.startAction('Get a flickr collection by tag') try: fc.fillCollectionFromFlickr(view, 10, '831f4f96fa5bf41fb9ed1317174ebbbe') except socket.timeout: self.logger.endAction(True, "Flickr timed out; skipping test") except IOError, e: self.logger.endAction(True, "IOError (%s); skipping test" % str(e))
def startTest(self): # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) QAUITestAppLib.UITestView(self.logger).SwitchToCalView() # creation testView = QAUITestAppLib.UITestView(self.logger) # action # switch to all view testView.SwitchToAllView() # switch to tasks view testView.SwitchToTaskView() # switch to calendar view testView.SwitchToCalView()
def startTest(self): note = QAUITestAppLib.UITestItem("Note", self.logger) # action note.SetAttr(displayName=uw("A note to myself about filing taxes"), body=uw("FILE TAXES!")) # verification note.Check_DetailView({"displayName":uw("A note to myself about filing taxes"),"body":uw("FILE TAXES!")})
def startTest(self): QAUITestAppLib.startTestInCalView(self.logger) path = os.path.join(Globals.chandlerDirectory, "tools/cats/DataFiles", "TestRecurrence.ics") # Upcast path to unicode since Sharing requires a unicode path path = unicode(path, sys.getfilesystemencoding()) self.logger.startAction('Importing TestRecurrence.ics') collection = sharing.importFile(self.app_ns.itsView, path) self.app_ns.sidebarCollection.add(collection) # select the collection sidebar = self.app_ns.sidebar QAUITestAppLib.scripting.User.emulate_sidebarClick( sidebar, collection.displayName) scripting.User.idle() self.logger.endAction(True, "Importing calendar") def VerifyEventCreation(title): self.logger.startAction("Verify event titled %s exists" % title) testEvent = self.app_ns.item_named(pim.EventStamp, title) if testEvent is not None: self.logger.endAction(True, " '%s' exists" % title) else: self.logger.endAction(False, "'%s' not created" % title) scripting.User.idle() VerifyEventCreation("Yearly Never End") VerifyEventCreation("Monthly Meeting") VerifyEventCreation("Multi-All Day") VerifyEventCreation("All-day never end") # bug 5593, set an end date for the "Weekly Never End" event sidebar = self.app_ns.sidebar scripting.User.emulate_sidebarClick(sidebar, 'TestRecurrence') view = QAUITestAppLib.UITestView(self.logger) # Need to format date the same way the detail view does uiView = wx.GetApp().UIRepositoryView goto = datetime.date(2006, 5, 1) value = datetime.datetime.combine( goto, datetime.time(0, tzinfo=uiView.tzinfo.default)) dateStr = pim.shortDateFormat.format(uiView, value) view.GoToDate(dateStr) event = QAUITestAppLib.GetOccurrence('Weekly Never End', goto) QAUITestAppLib.UITestItem(event, self.logger).SetAttr(recurrenceEnd=dateStr) # event has been deleted by changing recurrence, get a new one event = QAUITestAppLib.GetOccurrence('Weekly Never End', goto) testItem = QAUITestAppLib.UITestItem(event, self.logger) testItem.SelectItem(catchException=True) # Make sure this occurrence exists and was able to be selected testItem.Check_ItemSelected()
def startTest(self): # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) # switch to calendar view testView = QAUITestAppLib.UITestView(self.logger) testView.SwitchToCalView() calendarBlock = getattr(self.app_ns, "MainCalendarControl") # Find the "canonical timezone" to use in test comparisons view = self.app_ns.itsView info = TimeZoneInfo.get(view) originalTz = info.canonicalTimeZone(view.tzinfo.default).tzid switchTz = "Pacific/Honolulu" # Enable timezones so that we can switch from the UI self.app_ns.root.EnableTimezones() # Create a new event, which should inherit the default tz timezoneEvent = QAUITestAppLib.UITestItem("Event", self.logger) # Test that the new event has indeed inherited the default tz timezoneEvent.CheckDisplayedValues(EditTimeZone=(True, originalTz)) # Change the timezone to Pacific/Honolulu QAUITestAppLib.SetChoice(calendarBlock.widget.tzChoice, switchTz) # Test that the event timezone hasn't changed timezoneEvent.CheckDisplayedValues(EditTimeZone=(True, originalTz)) # Test that the default timezone has switched self.logger.startAction("Verify timezone switched") if view.tzinfo.setDefault(view.tzinfo.getInstance(switchTz)): self.logger.endAction(True, "Timezone switched") else: self.logger.endAction(False, "Timezone failed to switch") # @@@ More interesting tests could be added here # Switch back to original timezone QAUITestAppLib.SetChoice(calendarBlock.widget.tzChoice, originalTz)
def startTest(self): appView = self.app_ns.itsView today = strftime('%m/%d/%Y', localtime()) colName = "deleteThenImport" eventName = "eventToTest" #create a collection collection = QAUITestAppLib.UITestItem("Collection", self.logger) collection.SetDisplayName(colName) sb = self.app_ns.sidebar scripting.User.emulate_sidebarClick(sb, colName) #create an event ev = QAUITestAppLib.UITestItem('Event', self.logger) ev.SetAttr(displayName=eventName, startDate=today, startTime="12:00 PM") #create a path to export to reportDir = Globals.options.profileDir fullpath = os.path.join(reportDir, 'deleteThenImport.ics') if os.path.exists(fullpath): os.remove(fullpath) fullpath = unicode(fullpath, sys.getfilesystemencoding()) #export sharing.exportFile(appView, fullpath, collection.item) #delete collection scripting.User.emulate_sidebarClick(sb, colName) collection.DeleteCollection() #import event back in collection = sharing.importFile(appView, fullpath) self.app_ns.sidebarCollection.add(collection) scripting.User.idle() #verify ev.Check_ItemInCollection("Trash", expectedResult=False) ev.Check_ItemInCollection(colName, expectedResult=True)
def startTest(self): #make sure we start in the calendar view QAUITestAppLib.UITestItem("Collection", self.logger) QAUITestAppLib.UITestView(self.logger).SwitchToCalView() # creation col = QAUITestAppLib.UITestItem("Collection", self.logger) col.SetDisplayName(uw("ToBeDeleted")) # action sb = self.app_ns.sidebar # move focus from collection name text to collection. This # requires 2 clicks scripting.User.emulate_sidebarClick(sb, uw("ToBeDeleted")) scripting.User.emulate_sidebarClick(sb, uw("ToBeDeleted")) col.DeleteCollection() # verification col.Check_CollectionExistence(expectedResult=False)
def startTest(self): today = strftime('%m/%d/%Y', localtime()) view = QAUITestAppLib.UITestView(self.logger) #Create a collection and select it collection = QAUITestAppLib.UITestItem("Collection", self.logger) collection.SetDisplayName(uw("stacked")) sidebar = self.app_ns.sidebar QAUITestAppLib.scripting.User.emulate_sidebarClick( sidebar, uw("stacked")) # Make sure we are in calendar view, need to do this AFTER creating a # collection, or we might be in the dashboard view.SwitchToCalView() #make sure we are on current week view.GoToToday() # creation for i in range(10): eventName = uw('Stacked Event %d' % i) event = QAUITestAppLib.UITestItem("Event", self.logger) #action event.SetAttr(displayName=eventName, startDate=today, startTime="12:00 PM", body=uw("Stacked event test")) #verification event.Check_DetailView({ "displayName": eventName, "startDate": today, "endDate": today, "startTime": "12:00 PM", "body": uw("Stacked event test") })
def startTest(self): filename = "TestAllDayEvent.log" #print 'test3' #logger = QAUITestAppLib.QALogger(fileName,"TestAllDayEvent") #logger = TestLogger.TestOutput(logname=filename) #logger.startSuite('TestAllDayEvent') #logger.startTest('TestAllDayEvent') # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) # creation event = QAUITestAppLib.UITestItem("Event", self.logger) # action event.SetAllDay(True) # verification event.Check_DetailView({"allDay": True}) event.Check_Object({"allDay": True})
def startTest(self): # creation testView = QAUITestAppLib.UITestView(self.logger) # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) #name and then select collection col.SetDisplayName(uw("testCalView")) sb = QAUITestAppLib.App_ns.sidebar User.emulate_sidebarClick(sb, uw('testCalView')) # action # switch to calendar view testView.SwitchToCalView() # double click in the calendar view => event creation or selection ev = testView.DoubleClickInCalView() QAUITestAppLib.scripting.User.emulate_typing(uw("Writing tests")) QAUITestAppLib.scripting.User.emulate_return() # verification # check the detail view of the created event ev.Check_DetailView({"displayName":uw("Writing tests")})
def startTest(self): # test edit on enter for collection names # creation testCollection = QAUITestAppLib.UITestItem("Collection", self.logger) # action 1 test collection name # use enter to shift to edit mode testCollection.SelectItem() QAUITestAppLib.scripting.User.emulate_return() QAUITestAppLib.scripting.User.emulate_typing(uw("NoLongerUntitled")) # use enter to leave edit mode #except it doesn't work, focus somewhere else for the time being #QAUITestAppLib.scripting.User.emulate_return() testCollection.FocusInDetailView() #verification 1 testCollection.Check_CollectionExistence(uw("NoLongerUntitled")) # switch to summary view QAUITestAppLib.UITestView(self.logger).SwitchToAllView() # test edit on enter for summary view rows # creation 2 testEvent = QAUITestAppLib.UITestItem("Event", self.logger) # action 2 testEvent.SelectItem() QAUITestAppLib.scripting.User.emulate_return() #QAUITestAppLib.scripting.User.emulate_return() #until bug 5744 resolved 2 returns needed QAUITestAppLib.scripting.User.emulate_typing(uw("Your title here")) #QAUITestAppLib.scripting.User.emulate_return()#emulate_return doesn't work here either at svn r9900 testCollection.FocusInDetailView() # verification 2 # check the detail view of the created event testEvent.Check_DetailView({"displayName":uw("Your title here")})
def startTest(self): # creation task = QAUITestAppLib.UITestItem("Task", self.logger) # action task.SetAttr(displayName=uw("Task of sending birthday invites"), body=uw("Send birthday invitations")) # verification task.Check_DetailView({ "displayName": uw("Task of sending birthday invites"), "body": uw("Send birthday invitations") })
def startTest(self): # Creating a collection switches us to calendar view where we # do the actual test QAUITestAppLib.UITestItem("Collection", self.logger) # Find all the children of the Visible Hours menu eventsToTest = list( block.event for block in QAUITestAppLib.App_ns.VisibleHoursMenu.childBlocks if block.hasLocalAttributeValue('event') # ... exclude separators and block.event.visibleHours > 0 # ... and the "auto" item ) for event in eventsToTest: name = event.blockName self.logger.startAction(name) # Post the visible hours event... doesn't seem to be # a straightforward way to do this QAUITestAppLib.App_ns.MainView.onVisibleHoursEvent(event) # Allow the UI to refresh QAUITestAppLib.scripting.User.idle() # Figure out how many hours the TimedEvents widget is # displaying widget = QAUITestAppLib.App_ns.TimedEvents.widget rect = widget.GetClientRect() if event.visibleHours == 24: import pdb pdb.set_trace() relativeTime = widget.getRelativeTimeFromPosition( None, wx.Point(0, rect.height)) widgetHours = int( float(relativeTime.seconds) / 3600.0 + 24.0 * relativeTime.days + 0.5) # ... and double-check it's working if widgetHours != event.visibleHours: self.logger.endAction( False, "Expected %s visible hours, got %s" % (event.visibleHours, widgetHours)) else: self.logger.endAction(True, "Number of hours is correct")
def startTest(self): note = QAUITestAppLib.UITestItem("Note", self.logger) # action # stamp as a mail note.StampAsMailMessage(True) # verification note.Check_DetailView({ "stampMail": True, "stampTask": False, "stampEvent": False }) # stamp as a task note.StampAsTask(True) # stamp as an event note.StampAsCalendarEvent(True) # verification note.Check_DetailView({ "stampMail": True, "stampTask": True, "stampEvent": True }) # remove all stamps self.logger.startAction("Remove all stamps") note.StampAsCalendarEvent(False, timeInfo=False) note.StampAsTask(False, timeInfo=False) note.StampAsMailMessage(False, timeInfo=False) self.logger.endAction(True) # verification note.Check_DetailView({ "stampMail": False, "stampTask": False, "stampEvent": False })
def startTest(self): # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) # creation dailyEvent = QAUITestAppLib.UITestItem("Event", self.logger) # action dailyEvent.SetAttr( displayName=uw("Daily Exercise"), startDate="01/01/2006", startTime="6:00 AM", location=uw("Gym"), status="FYI", body=uw("Resolution: exercise daily for optimal health"), timeZone="America/Chicago", recurrence="Daily", recurrenceEnd="03/01/2006") # verification dailyEvent.Check_DetailView({ "displayName": uw("Daily Exercise"), "startDate": "1/1/2006", "endDate": "1/1/2006", "startTime": "6:00 AM", "endTime": "7:00 AM", "location": uw("Gym"), "status": "FYI", "body": uw("Resolution: exercise daily for optimal health"), "timeZone": "America/Chicago", "recurrence": "Daily", "recurrenceEnd": "3/1/2006" }) dailyEvent.Check_Object({ "displayName": uw("Daily Exercise"), "startDate": "1/1/2006", "endDate": "1/1/2006", "startTime": "6:00 AM", "endTime": "7:00 AM", "location": uw("Gym"), "status": "FYI", "body": uw("Resolution: exercise daily for optimal health"), "timeZone": "America/Chicago" }) # Weekly Event Test # creation weeklyEvent = QAUITestAppLib.UITestItem("Event", self.logger) # action weeklyEvent.SetAttr( displayName=uw("Weekly call home"), startDate="01/07/2006", startTime="5:00 PM", location=uw("Phone"), status="FYI", body=uw("Resolution: call home weekly for good family relations"), timeZone="America/Chicago", recurrence="Weekly", recurrenceEnd="03/25/2006") # verification weeklyEvent.Check_DetailView({ "displayName": uw("Weekly call home"), "startDate": "1/7/2006", "endDate": "1/7/2006", "startTime": "5:00 PM", "endTime": "6:00 PM", "location": uw("Phone"), "status": "FYI", "body": uw("Resolution: call home weekly for good family relations"), "timeZone": "America/Chicago", "recurrence": "Weekly", "recurrenceEnd": "3/25/2006" }) weeklyEvent.Check_Object({ "displayName": uw("Weekly call home"), "startDate": "1/7/2006", "endDate": "1/7/2006", "startTime": "5:00 PM", "endTime": "6:00 PM", "location": uw("Phone"), "status": "FYI", "body": uw("Resolution: call home weekly for good family relations"), "timeZone": "America/Chicago" }) # Monthly Event Test # creation monthlyEvent = QAUITestAppLib.UITestItem("Event", self.logger) # action monthlyEvent.SetAttr( displayName=uw("Monthly book club"), startDate="01/01/2006", startTime="7:00 PM", endTime="9:00 PM", location=uw("My house"), status="CONFIRMED", body=uw("Resolution: host book club once a month"), timeZone="America/Chicago", recurrence="Monthly", recurrenceEnd="12/31/2006") # verification monthlyEvent.Check_DetailView({ "displayName": uw("Monthly book club"), "startDate": "1/1/2006", "endDate": "1/1/2006", "startTime": "7:00 PM", "endTime": "9:00 PM", "location": uw("My house"), "status": "Confirmed", "body": uw("Resolution: host book club once a month"), "timeZone": "America/Chicago", "recurrence": "Monthly", "recurrenceEnd": "12/31/2006" }) monthlyEvent.Check_Object({ "displayName": uw("Monthly book club"), "startDate": "1/1/2006", "endDate": "1/1/2006", "startTime": "7:00 PM", "endTime": "9:00 PM", "location": uw("My house"), "status": "CONFIRMED", "body": uw("Resolution: host book club once a month"), "timeZone": "America/Chicago" }) # Yearly Event Test # creation yearlyEvent = QAUITestAppLib.UITestItem("Event", self.logger) # action yearlyEvent.SetAttr( displayName=uw("Yearly dentist appointment"), startDate="02/06/2004", startTime="10:00 AM", location=uw("Downtown"), status="CONFIRMED", body=uw("Resolution: get teeth cleaned once a year"), timeZone="America/Los_Angeles", recurrence="Yearly", recurrenceEnd="02/07/2050") # verification yearlyEvent.Check_DetailView({ "displayName": uw("Yearly dentist appointment"), "startDate": "2/6/2004", "endDate": "2/6/2004", "startTime": "10:00 AM", "endTime": "11:00 AM", "location": uw("Downtown"), "status": "Confirmed", "body": uw("Resolution: get teeth cleaned once a year"), "timeZone": "America/Los_Angeles", "recurrence": "Yearly", "recurrenceEnd": "2/7/2050" }) yearlyEvent.Check_Object({ "displayName": uw("Yearly dentist appointment"), "startDate": "2/6/2004", "endDate": "2/6/2004", "startTime": "10:00 AM", "endTime": "11:00 AM", "location": uw("Downtown"), "status": "CONFIRMED", "body": uw("Resolution: get teeth cleaned once a year"), "timeZone": "America/Los_Angeles" }) # Test stamping of recurring events # @@@ unstamping eventness on recurring events is hard to define # Test that the communication stamp applies to all yearlyEvent.StampAsMailMessage(True) self.logger.startAction( "Check communication stamp applies to all occurrences") firstOccurrence = pim.EventStamp(yearlyEvent.item).getFirstOccurrence() secondOccurrence = firstOccurrence.getNextOccurrence() if not pim.has_stamp(secondOccurrence, pim.MailStamp): self.logger.endAction( False, "The second occurrence didn't get the MailStamp") yearlyEvent.StampAsMailMessage(False) if pim.has_stamp(secondOccurrence, pim.MailStamp): self.logger.endAction( False, "The second occurrence didn't lose the MailStamp") # switch to the table view, make sure there are appropriate triageStatus # modifications. These tests will fail if run before Feb. 2006 or after # Feb. 2050. view = QAUITestAppLib.UITestView(self.logger) view.SwitchToAllView() dashboardBlock = self.app_ns.DashboardSummaryView def getTriageStatusDict(title): """ Get a dictionary mapping triage status to lists of items with the given title. """ dictionary = dict() for status in pim.TriageEnum.constants: dictionary[status] = [] for item in dashboardBlock.contents: if item.displayName == title: dictionary[item.triageStatus].append(item) return dictionary def checkDictNumbers(done, later, now): statuses = getTriageStatusDict(uw("Yearly dentist appointment")) if len(statuses[pim.TriageEnum.done]) != done: self.logger.endAction( False, 'Wrong number of Done items, %s instead of %s' % (len(statuses[pim.TriageEnum.done]), done)) elif len(statuses[pim.TriageEnum.later]) != later: self.logger.endAction( False, 'Wrong number of Later items, %s instead of %s' % (len(statuses[pim.TriageEnum.later]), later)) elif len(statuses[pim.TriageEnum.now]) != now: self.logger.endAction( False, 'Wrong number of Now items, %s instead of %s' % (len(statuses[pim.TriageEnum.now]), now)) self.logger.startAction("Check initial modification states.") checkDictNumbers(1, 1, 0) self.logger.endAction(True) statuses = getTriageStatusDict(uw("Yearly dentist appointment")) changing_item = statuses[pim.TriageEnum.done][0] self.logger.startAction("Change a Done to Now.") # moved the Done to Now, created a new Done changing_item.setTriageStatus(pim.TriageEnum.now) checkDictNumbers(0, 1, 1) pim.EventStamp(changing_item).updateTriageStatus() # triage changes need to be purged to generate a new Done checkDictNumbers(1, 1, 1) self.logger.endAction(True) self.logger.startAction("Change the now back to Done.") changing_item.setTriageStatus(pim.TriageEnum.done) checkDictNumbers(2, 1, 0) pim.EventStamp(changing_item).updateTriageStatus() checkDictNumbers(1, 1, 0) self.logger.endAction(True)
def startTest(self): ap = QAUITestAppLib.UITestAccounts(self.logger) pSMTP = uw("Personal SMTP") pIMAP = uw("Personal IMAP") pPOP = uw("Personal POP") pEMAIL = "*****@*****.**" pNAME = uw("Demo One") # action ap.Open() # first, open the accounts dialog window ap.GetDefaultAccount("OUTGOING") ap.TypeValue("displayName", pSMTP) # type the following values into their apporpriate fields ap.TypeValue("host","smtp.osafoundation.org") ap.SelectValue("security", 'TLS') # select the TLS radio button ap.ToggleValue("authentication", True) # turn on the authentication checkbox ap.TypeValue("port", '587') ap.TypeValue("email", pEMAIL) ap.TypeValue("name", pNAME) ap.TypeValue('username', 'demo1') ap.TypeValue('password', 'ad3leib5') ap.GetDefaultAccount("INCOMING") ap.TypeValue("displayName", pIMAP) ap.TypeValue("email", pEMAIL) ap.TypeValue("name", pNAME) ap.TypeValue("host", "imap.osafoundation.org") ap.TypeValue("username", "demo1") ap.TypeValue("password", "ad3leib5") ap.SelectValue("security", "SSL") ap.SelectValue("protocol", "IMAP") ap.CreateAccount("INCOMING") ap.TypeValue("displayName", pPOP) ap.TypeValue("email", pEMAIL) ap.TypeValue("name", pNAME) ap.TypeValue("host", "pop.osafoundation.org") ap.TypeValue("username", "demo1") ap.TypeValue("password", "ad3leib5") ap.SelectValue("security", "SSL") ap.SelectValue("protocol", "POP") ap.Ok() # verification self.logger.startAction("Verifying Account Values") ap.VerifyValues("SMTP", pSMTP, host= "smtp.osafoundation.org", connectionSecurity = "TLS", useAuth = True, port = 587, username = '******', password = '******' ) ap.VerifyValues("IMAP", pIMAP, host = "imap.osafoundation.org", connectionSecurity = "SSL", username = "******", password = "******") ap.VerifyValues("POP", pPOP, host = "pop.osafoundation.org", connectionSecurity = "SSL", username = "******", password = "******") self.logger.endAction(True, "Verifying Account Values") # creation mail = QAUITestAppLib.UITestItem("MailMessage", self.logger) # action mail.SetAttr(displayName=uw("Invitation Mail"), toAddress="*****@*****.**", body=uw("This is an email to invite you")) mail.SendMail() # verification mail.Check_DetailView({"displayName":uw("Invitation Mail"),"toAddress":"*****@*****.**","body":uw("This is an email to invite you")})
def startTest(self): # setup # create a collection and select it in the sidebar view = QAUITestAppLib.UITestView(self.logger) view.SwitchToAllView() col = QAUITestAppLib.UITestItem("Collection", self.logger) col.SetDisplayName("TestTriageSectioning") self.scripting.User.emulate_sidebarClick(self.app_ns.sidebar, "TestTriageSectioning") items = [] for status in pim.TriageEnum.constants: item = QAUITestAppLib.UITestItem("Note", self.logger) item.item.setTriageStatus(status) items.append(item) # Let the display catch up to the items self.scripting.User.idle() self.scripting.User.idle() # Get ready to bang on the dashboard dashboardBlock = self.app_ns.DashboardSummaryView dashboard = dashboardBlock.widget rowHeight = dashboard.GetDefaultRowSize() rowMiddle = rowHeight/2 header_widget = dashboard.GetGridColLabelWindow() # sort by triage status (already sorted that way) #self.scripting.User.emulate_click(header_widget, header_widget.GetSize()[0] - 15, 3) self.scripting.User.idle() # Check the data structures: see that we're sectioned properly # for a table with three items of different status: # (The sectioning values are the row index, the number of visible items # in the section, and the total number of items in the section) goodDefaultSectioning = [(0, 1, 1), (2, 1, 1), (4, 1, 1)] sectionRows = getattr(dashboard, 'sectionRows', None) self.logger.startAction('Check Sectioning') if not sectionRows: self.logger.endAction(False, "Dashboard not sectioned") else: self.logger.endAction(True) self.logger.startAction('Check section expansion') if sectionRows != goodDefaultSectioning: self.logger.endAction(False, "Dashboard not sectioned properly: %r != %r" % (sectionRows, goodDefaultSectioning)) else: self.logger.endAction(True) # Check that contraction and expansion work. for row in (4, 2): self.scripting.User.emulate_click(dashboard, 12, row*rowHeight + rowMiddle) self.scripting.User.idle() onlyNowSectioning = [(0, 1, 1), (2, 0, 1), (3, 0, 1)] self.logger.startAction('Check changed section expansion') if dashboard.sectionRows != onlyNowSectioning: self.logger.endAction(False, "Dashboard not sectioned properly: %r != %r" % (sectionRows, onlyNowSectioning)) else: self.logger.endAction(True) # Check that contraction and expansion work. for row in (3, 2, 0): self.scripting.User.emulate_click(dashboard, 12, row*rowHeight + rowMiddle) self.scripting.User.idle() self.logger.startAction('Check toggling') goodToggledSectioning = [(0, 0, 1), (1, 1, 1), (3, 1, 1)] if dashboard.sectionRows != goodToggledSectioning: self.logger.endAction(False, "Dashboard didn't toggle properly: %r != %r" % (sectionRows, goodToggledSectioning)) else: self.logger.endAction(True)
def startTest(self): view = QAUITestAppLib.UITestView(self.logger) view.SwitchToAllView() self.logger.startAction("Testing reminder processing") repoView = self.app_ns.itsView reminderDialog = wx.FindWindowByName(u'ReminderDialog') if reminderDialog is not None: self.logger.endAction(False, "Reminder dialog presented too soon?!") return self.collection = QAUITestAppLib.UITestItem("Collection", self.logger) colName = uw("TestReminderProcessing") self.collection.SetDisplayName(colName) self.scripting.User.emulate_sidebarClick(self.app_ns.sidebar, colName) # We'll create a few items with interesting times coming up testTime = datetime.now(tz=repoView.tzinfo.default).replace(microsecond=0) \ + timedelta(seconds=1) nearFutureDelta = timedelta(seconds=nearFutureSeconds) nearFutureReminderDelta = timedelta(seconds=nearFutureSeconds / -2) nearFuture = testTime + nearFutureDelta nearFutureReminder = nearFuture + nearFutureReminderDelta logger.critical("testTime=%s, nearFutureReminder=%s, nearFuture=%s", testTime, nearFutureReminder, nearFuture) # An ordinary event with relative and triageStatus reminders simpleEvent = self._makeEvent("Simple Event", nearFuture) simpleEvent.userReminderInterval = nearFutureReminderDelta self._checkRemindersOn(simpleEvent, userTime=nearFutureReminderDelta, userExpired=False, triageStatusTime=nearFuture, triageStatus=pim.TriageEnum.later) # A recurring event that hasn't started yet. We start with # an event with an absolute reminder just before its startTime. futureRecurrerNormal = self._makeEvent("Recurrer: Future", nearFuture) futureRecurrerNormal.itsItem.userReminderTime = nearFutureReminder self._checkRemindersOn(futureRecurrerNormal, userTime=nearFutureReminder, userExpired=False, triageStatusTime=nearFuture) # Making it recur should: convert the absolute reminder to a relative # one, leaving the relative reminder on the master's 'expired' list # but pending on the first occurrence. It should also get rid of the # triageStatus reminder. nextOccurrence = self._makeRecur(futureRecurrerNormal, testTime) # Let the app pick up any reminder firing changes scripting.User.idle() # Individual occurrences don't get their own reminders (unless you # make a change). self.failunless( futureRecurrerNormal.itsItem.reminders is nextOccurrence.itsItem.reminders, "occurrence shouldn't have its own reminders reflist") self._checkRemindersOn(futureRecurrerNormal, userTime=nearFutureReminderDelta, userExpired=False, triageStatusTime=nearFuture) # A recurring event that started in the past, so the second occurrence # is in the near future pastTime = testTime - (timedelta(days=7) - nearFutureDelta) pastRecurrerNormal = self._makeEvent("Recurrer: Past", pastTime) pastRecurrerNormal.userReminderInterval = timedelta(0) scripting.User.idle() self._checkRemindersOn(pastRecurrerNormal, userTime=timedelta(0), userExpired=True, triageStatusTime=None) secondOccurrence = self._makeRecur(pastRecurrerNormal, testTime) firstOccurrence = pastRecurrerNormal.getFirstOccurrence() self.failunlessequal(firstOccurrence.getNextOccurrence(), secondOccurrence, "2nd occurrence isn't the one after first") self._checkRemindersOn(firstOccurrence, userTime=timedelta(0), userExpired=True, triageStatusTime=None) self._checkRemindersOn(secondOccurrence, userTime=timedelta(0), userExpired=False, triageStatusTime=None) # Iterate until all the processing is complete, or we hit our timeout timeOut = nearFuture + timedelta(seconds=nearFutureSeconds * 2) state = "Waiting for reminder dialog" # @@@ [grant] Is this actually right ... ? allFutureReminders = schema.ns('osaf.pim', repoView).allFutureReminders testReminderItems = list( event.itsItem for event in (simpleEvent, futureRecurrerNormal, nextOccurrence, pastRecurrerNormal, firstOccurrence, secondOccurrence)) logger.critical(state) clicked = False while True: now = datetime.now(tz=repoView.tzinfo.default) repoView.dispatchQueuedNotifications() scripting.User.idle() if now > timeOut: self.logger.endAction( False, "Reminder processing didn't complete (%s)" % state) return reminderDialog = wx.FindWindowByName(u'ReminderDialog') if state == "Waiting for reminder dialog": if reminderDialog is not None: state = "Dismissing reminders" logger.critical(state) continue if reminderDialog is not None: # The reminder dialog is up. Hit its dismiss button. dismissWidget = reminderDialog.reminderControls['dismiss'] self.failunless( dismissWidget.IsEnabled(), "Reminder dialog up, but dismiss button disabled? That's just wrong." ) scripting.User.emulate_click(dismissWidget) clicked = True continue # The reminder dialog isn't up. Skip out when none of our items have # pending reminders if clicked and now > nearFuture + timedelta(seconds=1): foundPending = False for pending in pim.PendingReminderEntry.getKind( repoView).iterItems(): if pending.item in testReminderItems: break else: state = "Reminders done" logger.critical(state) break self.failunlessequal(state, "Reminders done", "Reminder-processing timeout") # Check each reminder logger.critical("Checking reminders, post-dismissal") self._checkRemindersOn(simpleEvent, userTime=nearFutureReminderDelta, userExpired=True, triageStatusTime=None, triageStatus=pim.TriageEnum.now) self._checkRemindersOn(firstOccurrence, userTime=timedelta(0), userExpired=True, triageStatusTime=None) self._checkRemindersOn(secondOccurrence, userTime=timedelta(0), userExpired=True, triageStatusTime=None) thirdOccurrence = secondOccurrence.getNextOccurrence() self._checkRemindersOn(thirdOccurrence, userTime=timedelta(0), userExpired=False, triageStatusTime=None) self.logger.endAction(True)
def startTest(self): def mondayPlus(inc=0): """return a m/d/yy date string equal to this Monday plus inc days""" today = datetime.date.today() daysUntilMonday = today.weekday() if daysUntilMonday == 6: daysUntilMonday = -1 #sunday is special case monday = today - datetime.timedelta(days=daysUntilMonday) incDay = monday + datetime.timedelta(days=inc) view = wx.GetApp().UIRepositoryView value = datetime.datetime.combine( incDay, datetime.time(0, tzinfo=view.tzinfo.default)) dateStr = shortDateFormat.format(view, value) return dateStr # resize the Chandler window to (1024,720): this test sort of crumble if the window is too small frame = wx.GetApp().mainFrame frame.SetSize((1024, 720)) # switch to calendar view testView = QAUITestAppLib.UITestView(self.logger) testView.SwitchToCalView() # make user collection, since only user # collections can be displayed as a calendar col = QAUITestAppLib.UITestItem("Collection", self.logger) evtDate = mondayPlus() evtSecondDate = mondayPlus(1) evtThirdDate = mondayPlus(2) evtRecurrenceEnd = mondayPlus(365) evtNextWeek = mondayPlus(7) # Make sure we're not showing timezones now (we'll put it back below) tzPrefs = schema.ns('osaf.pim', QAUITestAppLib.App_ns.itsView).TimezonePrefs oldTZPref = tzPrefs.showUI tzPrefs.showUI = False # Create a vanilla event; leave the timezone alone so we can make sure # it's floating. event = QAUITestAppLib.UITestItem("Event", self.logger) event.SetAttr(displayName=uw("Birthday Party"), startDate=evtDate, startTime="6:00 PM", location=uw("Club101"), status="FYI", body=uw("This is a birthday party invitation")) # Check a few things: that those attributes got set right, plus # a few defaulty things worked (timezone, endtime) event.CheckDisplayedValues( "Checking initial setup", HeadlineBlock=(True, uw("Birthday Party")), EditAllDay=(True, False), EditCalendarStartDate=(True, evtDate), CalendarStartAtLabel=(True, ), EditCalendarStartTime=(True, "6:00 PM"), EditCalendarEndDate=(True, evtDate), CalendarEndAtLabel=(True, ), EditCalendarEndTime=(True, "7:00 PM"), CalendarLocation=(True, uw("Club101")), EditTransparency=(True, "FYI"), NotesBlock=(True, uw("This is a birthday party invitation")), EditTimeZone=(False, "None")) # Not visible with timezones off # Toggle allday, then make sure the right changes happened. event.SetAttr("Setting allDay", allDay=True) event.CheckDisplayedValues( "Checking allday", HeadlineBlock=(True, uw("Birthday Party")), EditAllDay=(True, True), EditCalendarStartDate=(True, evtDate), CalendarStartAtLabel=(False, ), EditCalendarStartTime=(False, ), EditCalendarEndDate=(True, evtDate), CalendarEndAtLabel=(False, ), EditCalendarEndTime=(False, ), ) # Turn on timezones, turn off alldayness, and make sure the popup appears tzPrefs.showUI = True event.SetAttr("Setting explicit timezone", allDay=False, timeZone='America/Denver') event.CheckDisplayedValues( "Changed Timezone", HeadlineBlock=(True, uw("Birthday Party")), EditTimeZone=(True, 'America/Denver'), EditCalendarStartDate=(True, evtDate), EditCalendarEndDate=(True, evtDate), EditCalendarStartTime=( True, ), # could check the time here if I knew the local tz EditCalendarEndTime=(True, ), CalendarStartAtLabel=(True, ), CalendarEndAtLabel=(True, )) # Make it recur event.SetAttr("Making it recur", recurrence="Daily", recurrenceEnd=evtRecurrenceEnd) scripting.User.idle() event.CheckDisplayedValues("Checking recurrence", EditRecurrence=(True, "Daily"), EditRecurrenceEnd=(True, evtRecurrenceEnd)) # Select the second occurrence and delete it masterEvent = EventStamp(event.item) secondEvent = QAUITestAppLib.UITestItem( masterEvent.getFirstOccurrence().getNextOccurrence(), self.logger) secondEvent.SelectItem() secondEvent.CheckDisplayedValues( "Checking 2nd occurrence", EditCalendarStartDate=(True, evtSecondDate), ) secondEvent.MoveToTrash() scripting.User.idle() # Answer the recurrence question with "just this item" self.logger.startAction('Test recurrence dialog') recurrenceDialog = wx.FindWindowByName(u'RecurrenceDialog') if recurrenceDialog is None: self.logger.endAction( False, "Didn't see the recurrence dialog when deleting a recurrence instance" ) else: scripting.User.emulate_click(recurrenceDialog.thisButton) scripting.User.idle() self.logger.endAction(True) # Make sure the new second occurrence starts on the right date thirdEvent = QAUITestAppLib.UITestItem( masterEvent.getFirstOccurrence().getNextOccurrence(), self.logger) thirdEvent.SelectItem() thirdEvent.CheckDisplayedValues( "After deleting second occurrence", HeadlineBlock=(True, uw("Birthday Party")), EditCalendarStartDate=(True, evtThirdDate), ) # Create an event in a future week futureEvent = QAUITestAppLib.UITestItem("Event", self.logger) futureEvent.SetAttr(displayName=uw("Future Weekly"), startDate=evtNextWeek, startTime="6:00 PM", recurrence="Weekly", body=uw("This is an event in the future")) futureEvent.CheckDisplayedValues( "Checking future recurring event", HeadlineBlock=(True, uw("Future Weekly")), EditAllDay=(True, False), EditCalendarStartDate=(True, evtNextWeek), CalendarStartAtLabel=(True, ), EditCalendarStartTime=(True, "6:00 PM"), EditCalendarEndDate=(True, evtNextWeek), CalendarEndAtLabel=(True, ), EditCalendarEndTime=(True, "7:00 PM"), NotesBlock=(True, uw("This is an event in the future"))) #leave Chandler with timezones turned off tzPrefs.showUI = False
def startTest(self): # If we don't have this there'll be a mysterious error: # AttributeError: 'Panel' object has no attribute 'GetValue' QAUITestAppLib.UITestItem("Collection", self.logger) QAUITestAppLib.publishSubscribe(self)
def startTest(self): # resize the Chandler window to (1024,720): this test sort of crumble if the window is too small frame = wx.GetApp().mainFrame frame.SetSize((1024, 720)) #Create a collection and select it collection = QAUITestAppLib.UITestItem("Collection", self.logger) collection.SetDisplayName(uw("Delete and Remove")) sidebar = self.app_ns.sidebar QAUITestAppLib.scripting.User.emulate_sidebarClick( sidebar, uw("Delete and Remove")) # creation note = QAUITestAppLib.UITestItem("Note", self.logger) # actions note.SetAttr(displayName=uw("A note to move to Trash"), body=uw("TO MOVE TO TRASH")) # Work around nasty bug in QAUITestAppLib caused by not propagating notificatons correctly application = wx.GetApp() application.propagateAsynchronousNotifications() application.Yield(True) note.RemoveFromCollection() note.Check_ItemInCollection(uw("Delete and Remove"), expectedResult=False) note.Check_ItemInCollection("Trash", expectedResult=False) note.Check_ItemInCollection("Dashboard") note.AddCollection(uw("Delete and Remove")) note.Check_ItemInCollection(uw("Delete and Remove")) note.MoveToTrash() # verification note.Check_ItemInCollection("Trash") note.Check_ItemInCollection("Dashboard", expectedResult=False) today = strftime('%m/%d/%Y', localtime()) view = QAUITestAppLib.UITestView(self.logger) view.SwitchToCalView() view.GoToToday() sidebar = QAUITestAppLib.App_ns.sidebar col = QAUITestAppLib.UITestItem("Collection", self.logger) col.SetDisplayName(uw("Trash testing")) scripting.User.emulate_sidebarClick(sidebar, uw('Trash testing')) event = QAUITestAppLib.UITestItem("Event", self.logger) event.SetAttr(startDate=today, startTime="12:00 PM", displayName=uw("Ephemeral event")) event.SelectItem() event.Check_ItemInCollection("Dashboard", expectedResult=True) event.Check_ItemSelected() event.MoveToTrash() # This is perhaps not necessary for the test, but it used to # be here. It cannot be enabled until bug XXX is fixed. #scripting.User.emulate_sidebarClick(sidebar, 'Dashboard') event.SelectItem(catchException=True) event.Check_ItemInCollection("Trash") event.Check_ItemInCollection("Dashboard", expectedResult=False) event.Check_ItemSelected(expectedResult=False)
fc.displayName = uw("oscon2005") self.logger.startAction('Get a flickr collection by tag') try: fc.fillCollectionFromFlickr(view, 10, '831f4f96fa5bf41fb9ed1317174ebbbe') except socket.timeout: self.logger.endAction(True, "Flickr timed out; skipping test") except IOError, e: self.logger.endAction(True, "IOError (%s); skipping test" % str(e)) except flickr.flickr.FlickrNotFoundError: self.logger.endAction(True, "Flickr search returned nothing; skipping test") except (flickr.flickr.FlickrError, httplib.HTTPException), e: self.logger.endAction(True, "Flickr service error (%s); skipping test" % str(e)) else: # Add the channel to the sidebar self.app_ns.sidebarCollection.add(fc) # force sidebar to update self.scripting.User.idle() # check results col = QAUITestAppLib.sidebarCollectionNamed(uw("oscon2005")) if not col: self.logger.endAction(False, "Flickr Collection wasn't created") if col and len(col) != 10: self.logger.endAction(False, "Flickr Collection had the wrong number of elements: %d, expected %d" % (len(col.item), 10)) self.logger.endAction(True, "Flickr collection of correct size created")
def startTest(self): # Make sure we start with the calendar view self.app_ns.appbar.press("ApplicationBarEventButton") application = wx.GetApp() application.Yield(True) # 1. Add certstore to sidebar self.app_ns.root.addCertificateToSidebarEvent() # force sidebar to update self.scripting.User.idle() # confirm that exactly one entry in the sidebar exists def exactlyOneSidebarCollectionNamed(name): """ Look for a sidebar collection with name, otherwise return False """ self.logger.startAction( "Checking that we have exactly one collection named %s" % name) entries = [] sidebar = self.app_ns.sidebar for i, collection in enumerate(sidebar.contents): if collection.displayName == name: entries.append(collection) lenEntries = len(entries) if lenEntries != 1: self.logger.endAction( False, "%s in sidebar %d times, expected 1" % (name, lenEntries)) else: self.logger.endAction(True) exactlyOneSidebarCollectionNamed("Certificate Store") # 2. confirm that the view is the All view self.logger.startAction("Check view is All") if not self.app_ns.appbar.pressed('ApplicationBarAllButton'): self.logger.endAction(False, "Did not switch to All view as expected") else: self.logger.endAction(True) # 3. confirm that the first certificate in the summary view is selected self.logger.startAction("Check first certificate selected") if self.app_ns.summary.contents.getFirstSelectedItem( ).displayName != 'Go Daddy Class 2 CA': self.logger.endAction( False, "Go Daddy certificate not first selected certificate in summary list" ) else: self.logger.endAction(True) # Get a reference to the detail view that we'll use in later tests cert = QAUITestAppLib.UITestItem("Certificate", self.logger) # Since UITestItem does not know about certificate, we need to set # the variables ourselves cert.logger = self.logger cert.allDay = cert.recurring = False cert.view = self.app_ns.itsView cert.item = self.app_ns.summary.contents.getFirstSelectedItem( ) # Dunno how to get it from detail # Check_DetailView has hardcoded values so we can't use it :( cert.CheckEditableBlock( 'PurposeAttribute', 'purpose', '%s' % (constants.PURPOSE_CA | constants.PURPOSE_SERVER)) cert.CheckEditableBlock( 'TrustAttribute', 'trust', '%s' % (constants.TRUST_AUTHENTICITY | constants.TRUST_SERVER)) cert.CheckEditableBlock('FingerprintLabel', 'fingerprint', '0x2796bae63f1801e277261ba0d77770028f20eee4L') cert.CheckEditableBlock('FingerprintAlgLabel', 'algorithm', 'sha1') cert.CheckEditableBlock( 'AsTextAttribute', 'certificate', """Certificate: Data: Version: 3 (0x2) Serial Number: 0 (0x0) Signature Algorithm: sha1WithRSAEncryption Issuer: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority Validity Not Before: Jun 29 17:06:20 2004 GMT Not After : Jun 29 17:06:20 2034 GMT Subject: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority Subject Public Key Info: Public Key Algorithm: rsaEncryption RSA Public Key: (2048 bit) Modulus (2048 bit): 00:de:9d:d7:ea:57:18:49:a1:5b:eb:d7:5f:48:86: ea:be:dd:ff:e4:ef:67:1c:f4:65:68:b3:57:71:a0: 5e:77:bb:ed:9b:49:e9:70:80:3d:56:18:63:08:6f: da:f2:cc:d0:3f:7f:02:54:22:54:10:d8:b2:81:d4: c0:75:3d:4b:7f:c7:77:c3:3e:78:ab:1a:03:b5:20: 6b:2f:6a:2b:b1:c5:88:7e:c4:bb:1e:b0:c1:d8:45: 27:6f:aa:37:58:f7:87:26:d7:d8:2d:f6:a9:17:b7: 1f:72:36:4e:a6:17:3f:65:98:92:db:2a:6e:5d:a2: fe:88:e0:0b:de:7f:e5:8d:15:e1:eb:cb:3a:d5:e2: 12:a2:13:2d:d8:8e:af:5f:12:3d:a0:08:05:08:b6: 5c:a5:65:38:04:45:99:1e:a3:60:60:74:c5:41:a5: 72:62:1b:62:c5:1f:6f:5f:1a:42:be:02:51:65:a8: ae:23:18:6a:fc:78:03:a9:4d:7f:80:c3:fa:ab:5a: fc:a1:40:a4:ca:19:16:fe:b2:c8:ef:5e:73:0d:ee: 77:bd:9a:f6:79:98:bc:b1:07:67:a2:15:0d:dd:a0: 58:c6:44:7b:0a:3e:62:28:5f:ba:41:07:53:58:cf: 11:7e:38:74:c5:f8:ff:b5:69:90:8f:84:74:ea:97: 1b:af Exponent: 3 (0x3) X509v3 extensions: X509v3 Subject Key Identifier: D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 X509v3 Authority Key Identifier: keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority serial:00 X509v3 Basic Constraints: CA:TRUE Signature Algorithm: sha1WithRSAEncryption 32:4b:f3:b2:ca:3e:91:fc:12:c6:a1:07:8c:8e:77:a0:33:06: 14:5c:90:1e:18:f7:08:a6:3d:0a:19:f9:87:80:11:6e:69:e4: 96:17:30:ff:34:91:63:72:38:ee:cc:1c:01:a3:1d:94:28:a4: 31:f6:7a:c4:54:d7:f6:e5:31:58:03:a2:cc:ce:62:db:94:45: 73:b5:bf:45:c9:24:b5:d5:82:02:ad:23:79:69:8d:b8:b6:4d: ce:cf:4c:ca:33:23:e8:1c:88:aa:9d:8b:41:6e:16:c9:20:e5: 89:9e:cd:3b:da:70:f7:7e:99:26:20:14:54:25:ab:6e:73:85: e6:9b:21:9d:0a:6c:82:0e:a8:f8:c2:0c:fa:10:1e:6c:96:ef: 87:0d:c4:0f:61:8b:ad:ee:83:2b:95:f8:8e:92:84:72:39:eb: 20:ea:83:ed:83:cd:97:6e:08:bc:eb:4e:26:b6:73:2b:e4:d3: f6:4c:fe:26:71:e2:61:11:74:4a:ff:57:1a:87:0f:75:48:2e: cf:51:69:17:a0:02:12:61:95:d5:d1:40:b2:10:4c:ee:c4:ac: 10:43:a6:a5:9e:0a:d5:95:62:9a:0d:cf:88:82:c5:32:0c:e4: 2b:9f:45:e6:0d:9f:28:9c:b1:b9:2a:5a:57:ad:37:0f:af:1d: 7f:db:bd:9f """) # 5. Change certificate trust # SetAttr has hardcode values :( cert.SetEditableBlock('TrustAttribute', 'trust', '0', False) self.scripting.User.idle() cert.CheckEditableBlock('TrustAttribute', 'trust', '0') # Switch back to calendar view self.app_ns.appbar.press("ApplicationBarEventButton") application.Yield(True) # Add certstore to sidebar again self.app_ns.root.addCertificateToSidebarEvent() # force sidebar to update self.scripting.User.idle() # 6. Check that we still have just one certificate store in the sidebar exactlyOneSidebarCollectionNamed("Certificate Store") # 7. Check that we still have the same first cert and the changed value # was persisted cert.CheckEditableBlock('FingerprintLabel', 'fingerprint', '0x2796bae63f1801e277261ba0d77770028f20eee4L') cert.CheckEditableBlock('TrustAttribute', 'trust', '0') # Switch to calendar view self.app_ns.appbar.press("ApplicationBarEventButton") application.Yield(True)
def startTest(self): # action -- Setup mail accounts #execfile(os.path.join(functional_dir,"TestCreateAccounts.py")) ## Create Accounts for Mail ap = QAUITestAppLib.UITestAccounts(self.logger) # action self.logger.startAction("Setup email account") ap.Open() # first, open the accounts dialog window ap.GetDefaultAccount("OUTGOING") # get the default SMTP account ap.TypeValue( "displayName", uw("Personal SMTP") ) # type the following values into their apporpriate fields ap.TypeValue("host", "smtp.osafoundation.org") ap.SelectValue("security", 'TLS') # select the TLS radio button ap.ToggleValue("authentication", True) # turn on the authentication checkbox ap.TypeValue("port", '587') ap.TypeValue('username', 'demo1') ap.TypeValue('password', 'ad3leib5') ap.GetDefaultAccount("INCOMING") ap.TypeValue("displayName", uw("Personal IMAP")) ap.TypeValue("email", "*****@*****.**") ap.TypeValue("name", uw("Demo One")) ap.TypeValue("host", "imap.osafoundation.org") ap.TypeValue("username", "demo1") ap.TypeValue("password", "ad3leib5") ap.SelectValue("security", "SSL") ap.SelectValue("protocol", "IMAP") ap.Ok() self.logger.endAction(True) # verification ap.VerifyValues("SMTP", uw("Personal SMTP"), host="smtp.osafoundation.org", connectionSecurity="TLS", useAuth=True, port=587, username='******', password='******') ap.VerifyValues("IMAP", uw("Personal IMAP"), host="imap.osafoundation.org", connectionSecurity="SSL", username="******", password="******") ## End Create accounts for Mail # action -- Create new Collection col = QAUITestAppLib.UITestItem("Collection", self.logger) # action -- Set the Display name for new Collection col.SetDisplayName(uw("TestCollection")) # verification -- Initial Existense of Collection col.Check_CollectionExistence(uw("TestCollection")) # creation note = QAUITestAppLib.UITestItem("Note", self.logger) # action -- Add to TestCollection note.AddCollection(uw("TestCollection")) # action -- Stamp as Mail message note.StampAsMailMessage(True) # action -- Set Note attributes #XXX Moving the attribute setting after stamping # fixes an issue where the displayName was not getting set. # I am not sure of the reasoning of why this was # failing but believe it has to do # with either the CATS or CPIA layers note.SetAttr( displayName=uw("Test Note in TestCollection"), body=uw("This is the body, can i give it \n for new line.")) # action -- Set attributes for mail sending note.SetAttr(toAddress="*****@*****.**") # action -- Send the Mail message note.SendMail() # action -- Stamp as Calendar message note.StampAsCalendarEvent(True) # action -- Set Event attributes note.SetAttr(startDate="09/12/2006", startTime="6:00 PM", location=uw("Club101"), status="FYI", timeZone="America/Chicago", recurrence="Daily", recurrenceEnd="10/14/2006") # adding recurrence will have caused UITestItem to have the master # as its item. That doesn't work very well for selection, since the # last occurrence is the only row that will be displayed in the # Dashboard, so set note's item to the (single) modification #note.item = pim.EventStamp(note.item).modifications.first() # verification -- Collection Display col.Check_CollectionExistence(uw("TestCollection")) # verification -- note object in TestCollection note.Check_ItemInCollection(uw("TestCollection"))
def startTest(self): ITEM_COUNT = 12 # create a collection and some test items col = QAUITestAppLib.UITestItem("Collection", self.logger) view = QAUITestAppLib.UITestView(self.logger) col.SetDisplayName("TestTableSelection") self.scripting.User.emulate_sidebarClick(self.app_ns.sidebar, "TestTableSelection") alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" items = [] for i in xrange(ITEM_COUNT): mail = QAUITestAppLib.UITestItem("MailMessage", self.logger) # make sure the sorting is different for To vs. Subject, # and that the sort by Subject will be the order we're adding them. mail.SetAttr(displayName="%s Mail Message" % alpha[i], toAddress="*****@*****.**" % (ITEM_COUNT - i)) items.append(mail.item) # action self.logger.startAction("Test summary view") dashboardBlock = self.app_ns.DashboardSummaryView dashboard = dashboardBlock.widget header_widget = dashboard.GetGridColLabelWindow() # Select the About column aboutMiddle = sum(dashboard.GetColSize(i) for i in range(3)) + \ dashboard.GetColSize(3) / 2 self.scripting.User.emulate_click(header_widget, aboutMiddle, 3) self.scripting.User.idle() rowsToSelect = [1, 3, 4, 9, 11] rowHeight = dashboard.GetDefaultRowSize() rowMiddle = rowHeight / 2 # select the first row self.scripting.User.emulate_click( dashboard, 100, rowsToSelect[0] * rowHeight + rowMiddle) # select 3 more rows, with control key down for multi selection # except for mac which wants the meta key held down if sys.platform == 'darwin': for row in rowsToSelect[1:]: self.scripting.User.idle() self.scripting.User.emulate_click(dashboard, 100, rowHeight * row + rowMiddle, meta=True) else: for row in rowsToSelect[1:]: self.scripting.User.idle() self.scripting.User.emulate_click(dashboard, 100, rowHeight * row + rowMiddle, control=True) self.logger.endAction(True) # verification # check selection indexes expectedIndexes = [(1, 1), (3, 4), (9, 9), (11, 11)] view.Check_Equality(expectedIndexes, list(dashboardBlock.contents.getSelectionRanges()), "Table Selection Ranges") # check selected items by collection indexes expectedItems = [items[row] for row in rowsToSelect] expectedItems.sort(key=lambda x: x.itsUUID) selectionByUUID = list(dashboardBlock.contents.iterSelection()) selectionByUUID.sort(key=lambda x: x.itsUUID) view.Check_Equality(expectedItems, selectionByUUID, "Table Selection by Item") # check the grid widget itself to make sure the right rows are # selected visually. expectedRows = [(i, i) for i in rowsToSelect] topLeft = [i for i, j in dashboard.GetSelectionBlockTopLeft()] bottomRight = [i for i, j in dashboard.GetSelectionBlockBottomRight()] gridSelectedRows = zip(topLeft, bottomRight) view.Check_Equality(expectedRows, gridSelectedRows, "Table grid selection") # # reverse the table, and make sure we're still selecting the same items # self.scripting.User.emulate_click(header_widget, aboutMiddle, 3) self.scripting.User.idle() newSelectedItems = list(dashboardBlock.contents.iterSelection()) newSelectedItems.sort(key=lambda x: x.itsUUID) view.Check_Equality(expectedItems, newSelectedItems, "Selection by item after reversing") # now sort by Who and check again whoMiddle = sum(map(lambda c: c.width, dashboardBlock.columns[0:2])) + \ (dashboardBlock.columns[2].width / 2) self.scripting.User.emulate_click(header_widget, whoMiddle, 3) newSelectedItems = list(dashboardBlock.contents.iterSelection()) newSelectedItems.sort(key=lambda x: x.itsUUID) view.Check_Equality(expectedItems, newSelectedItems, "Selection by item after sorting by Who") # now sort by triage status (which uses sectioning) and check again triageStatusMiddle = sum(map(lambda c: c.width, dashboardBlock.columns)) - \ (dashboardBlock.columns[-1].width / 2) self.scripting.User.emulate_click(header_widget, triageStatusMiddle, 3) newSelectedItems = list(dashboardBlock.contents.iterSelection()) newSelectedItems.sort(key=lambda x: x.itsUUID) view.Check_Equality( expectedItems, newSelectedItems, "Selection by item after sorting by Triage Status")