38 @hourformat_12 = true |
38 @hourformat_12 = true |
39 |
39 |
40 def initialize (args) |
40 def initialize (args) |
41 super(args) |
41 super(args) |
42 # MANDATORY DEFINITION: Define device "suts" which are used in testing, remember defined [ut] name in matti_parameters.xml |
42 # MANDATORY DEFINITION: Define device "suts" which are used in testing, remember defined [ut] name in matti_parameters.xml |
43 @sut = MATTI.sut(:Id => 'sut_s60_qt') |
43 @sut = TDriver.sut(:Id => 'sut_s60_qt') |
44 #to see if there is some widgets on the screen |
44 #to see if there is some widgets on the screen |
45 retry_count = 0 |
45 retry_count = 0 |
46 begin |
46 begin |
47 if @sut.application.test_object_exists?("HbTextItem", {:text => 'Continue', :__timeout => 2}) |
47 if @sut.application.test_object_exists?("HbTextItem", {:text => 'Continue', :__timeout => 2}) |
48 @sut.application( :name => 'ftulanguage' ).HbTextItem(:text => 'Continue').tap |
48 @sut.application( :name => 'ftulanguage' ).HbTextItem(:text => 'Continue').tap |
570 end |
570 end |
571 end |
571 end |
572 |
572 |
573 ######################################################################################################################################## |
573 ######################################################################################################################################## |
574 # |
574 # |
|
575 # set_event_date_via_UI |
|
576 # |
|
577 # description: |
|
578 # This function sets wanted event date via calendar UI |
|
579 # |
|
580 # preconditions: |
|
581 # |
|
582 # parameters: |
|
583 # -app: application needed |
|
584 # -date: date, what is wanted to set |
|
585 # |
|
586 # created: Jarno Mäkelä |
|
587 # creation date: 20-Aug-2010 |
|
588 # |
|
589 ######################################################################################################################################## |
|
590 |
|
591 def set_event_date_via_UI(app,date) |
|
592 #Check,what value there is currently in hour date |
|
593 current_day_value = app.HbDatePickerView(:__index => 0).HbAbstractItemContainer.HbDatePickerViewItem(:__index => 2).HbTextItem.attribute("text") |
|
594 puts "current_day_value = " + current_day_value |
|
595 current_day_value_i = current_day_value.to_i |
|
596 set_date_day_value = date[0..1] |
|
597 puts "set_date_day_value = " + set_date_day_value |
|
598 set_date_day_value_i = set_date_day_value.to_i |
|
599 for i in 0..(set_date_day_value_i - 1 - current_day_value_i) |
|
600 index = 2 + i |
|
601 app.HbDatePickerView(:__index => 0).HbAbstractItemContainer.HbDatePickerViewItem(:__index => index).HbTextItem.gesture(:Up,0.5,53) |
|
602 end |
|
603 current_month_value = app.HbDatePickerView(:__index => 1).HbAbstractItemContainer.HbDatePickerViewItem(:__index => 2).HbTextItem.attribute("text") |
|
604 puts "current_month_value = " + current_month_value |
|
605 current_month_value_i = current_month_value.to_i |
|
606 set_date_month_value = date[3..4] |
|
607 puts "set_date_month_value = " + set_date_month_value |
|
608 set_date_month_value_i = set_date_month_value.to_i |
|
609 for i in 0..(set_date_month_value_i - 1 - current_month_value_i) |
|
610 index = 2 + i |
|
611 app.HbDatePickerView(:__index => 1).HbAbstractItemContainer.HbDatePickerViewItem(:__index => index).HbTextItem.gesture(:Up,0.5,53) |
|
612 end |
|
613 current_year_value = app.HbDatePickerView(:__index => 2).HbAbstractItemContainer.HbDatePickerViewItem(:__index => 2).HbTextItem.attribute("text") |
|
614 puts "current_year_value = " + current_year_value |
|
615 current_year_value_i = current_year_value.to_i |
|
616 set_date_year_value = date[6..9] |
|
617 puts "set_date_year_value = " + set_date_year_value |
|
618 set_date_year_value_i = set_date_year_value.to_i |
|
619 for i in 0..(set_date_year_value_i - 1 - current_year_value_i) |
|
620 index = 2 + i |
|
621 app.HbDatePickerView(:__index => 2).HbAbstractItemContainer.HbDatePickerViewItem(:__index => index).HbTextItem.gesture(:Up,0.5,53) |
|
622 end |
|
623 end |
|
624 |
|
625 ######################################################################################################################################## |
|
626 # |
575 # create_calendar_event !!!FIXTURE NOT WORKING !!! |
627 # create_calendar_event !!!FIXTURE NOT WORKING !!! |
576 # |
628 # |
577 # description: |
629 # description: |
578 # This function creates calendar event via fixture |
630 # This function creates calendar event via fixture |
579 # |
631 # |
728 #cal_app.QGraphicsWidget( :name => 'vkbHandle' ).tap |
780 #cal_app.QGraphicsWidget( :name => 'vkbHandle' ).tap |
729 #Add start time |
781 #Add start time |
730 cal_app.HbPushButton( :name => 'startTime' ).tap |
782 cal_app.HbPushButton( :name => 'startTime' ).tap |
731 set_event_time_via_UI(cal_app,start_time_to_verify) |
783 set_event_time_via_UI(cal_app,start_time_to_verify) |
732 cal_app.HbTextItem( :text => 'OK' ).tap |
784 cal_app.HbTextItem( :text => 'OK' ).tap |
|
785 #cal_app.HbIconItem(:iconName => 'qtg_mono_back').tap |
|
786 start_date = start_time_split[0] |
|
787 #add start date |
|
788 if start_date[0..1].to_i > @day.to_i || start_date[3..4].to_i > @month.to_i || start_date[6..9].to_i > @year.to_i then |
|
789 puts "calendar event is in another day that today in future" |
|
790 #set calendar date |
|
791 cal_app.HbPushButton( :name => 'startDate' ).tap |
|
792 set_event_date_via_UI(cal_app,start_date) |
|
793 cal_app.HbTextItem( :text => 'OK' ).tap |
|
794 end |
733 cal_app.HbIconItem(:iconName => 'qtg_mono_back').tap |
795 cal_app.HbIconItem(:iconName => 'qtg_mono_back').tap |
734 #cal_app.HbIconItem(:iconName => 'qtg_mono_back').tap |
|
735 cal_app.close |
796 cal_app.close |
736 #let's put date if event is in other future day than today |
797 #let's put date if event is in other future day than today |
737 if start_day > @day.to_i then |
798 if start_day > @day.to_i then |
738 start_date = start_time_split[0] |
|
739 month_text = case start_date[3..4] |
799 month_text = case start_date[3..4] |
740 when "01" then "Jan" |
800 when "01" then "Jan" |
741 when "02" then "Feb" |
801 when "02" then "Feb" |
742 when "03" then "Mar" |
802 when "03" then "Mar" |
743 when "04" then "Apr" |
803 when "04" then "Apr" |
778 # none |
838 # none |
779 # |
839 # |
780 ############################################################################################################################################ |
840 ############################################################################################################################################ |
781 |
841 |
782 def test_initialize_calendar_widget_test_env |
842 def test_initialize_calendar_widget_test_env |
783 puts "test_initialize_calendar_widget_test_env start" |
|
784 app = @sut.application(:name => 'hsapplication') |
843 app = @sut.application(:name => 'hsapplication') |
785 #Let's check existing Home screens |
844 #Let's check existing Home screens |
786 #identificator = TestObjectIdentificator.new(:type => :HsPageVisual) |
845 #identificator = TestObjectIdentificator.new(:type => :HsPageVisual) |
787 #xml = app.HsIdleWidget.HbWidget( :__index =>2 ).xml_data |
846 #xml = app.HsIdleWidget.HbWidget( :__index =>2 ).xml_data |
788 #element_set = xml.xpath( xpath = identificator.get_xpath_to_identify( xml ) ) |
847 #element_set = xml.xpath( xpath = identificator.get_xpath_to_identify( xml ) ) |
940 #begin |
999 #begin |
941 #Preconditions: |
1000 #Preconditions: |
942 #Device is in Homescreen |
1001 #Device is in Homescreen |
943 app = @sut.application(:name => 'hsapplication') |
1002 app = @sut.application(:name => 'hsapplication') |
944 verify(){app.HbIconItem(:iconName => 'qtg_mono_applications_all')} |
1003 verify(){app.HbIconItem(:iconName => 'qtg_mono_applications_all')} |
945 navigate_to_first_homescreen |
|
946 #- One event happens few hours after current phone time at today and one event at tomorrow in Calendar. |
1004 #- One event happens few hours after current phone time at today and one event at tomorrow in Calendar. |
947 check_phone_date |
1005 check_phone_date |
948 check_phone_time |
1006 check_phone_time |
949 today_time_for_verification = create_calendar_event_via_calendar("not working",@day.to_i,@month.to_i,@year.to_i,@hour.to_i+2,@minute.to_i,0,1,0) |
1007 today_time_for_verification = create_calendar_event_via_calendar("not working",@day.to_i,@month.to_i,@year.to_i,@hour.to_i+2,@minute.to_i,0,1,0) |
950 tomorrow_time_for_verification = create_calendar_event(app, 'Tomorrow meeting',@day.to_i+1,@month.to_i,@year.to_i,@hour.to_i,@minute.to_i,0,1,0) |
1008 tomorrow_time_for_verification = create_calendar_event_via_calendar("not working",@day.to_i+1,@month.to_i,@year.to_i,@hour.to_i+2,@minute.to_i,0,1,0) |
951 #-Calendar widget is added to Home Screen. |
1009 #-Calendar widget is added to Home Screen. |
952 #Not adding calendar widget, if it already exists there |
1010 #Not adding calendar widget, if it already exists there |
953 if not(app.test_object_exists?("HbWidget",{:name => 'CalendarWidget'})) then |
1011 if not(app.test_object_exists?("HbWidget",{:name => 'CalendarWidget'})) then |
954 #add calendar widget to home screen |
1012 #add calendar widget to home screen |
955 app.HbIconItem(:iconName => 'qtg_mono_applications_all').tap |
1013 app.HbIconItem(:iconName => 'qtg_mono_applications_all').tap |
960 #step 1 Expected: - All icons (widget icon and reminder icon) are shown correctly. |
1018 #step 1 Expected: - All icons (widget icon and reminder icon) are shown correctly. |
961 #- Only today event is shown in widget as two rows: first row shows the event time and second row shows the event title. |
1019 #- Only today event is shown in widget as two rows: first row shows the event time and second row shows the event title. |
962 day_to_verify = @day.to_i |
1020 day_to_verify = @day.to_i |
963 verify(){app.HbTextItem(:text => day_to_verify)} |
1021 verify(){app.HbTextItem(:text => day_to_verify)} |
964 verify(){app.HbLabel( :name => 'upperLabel' ).HbTextItem( :text => today_time_for_verification )} |
1022 verify(){app.HbLabel( :name => 'upperLabel' ).HbTextItem( :text => today_time_for_verification )} |
965 verify(){app.HbLabel( :name => 'lowerLabel' ).HbTextItem( :text => 'Today meeting' )} |
1023 verify(){app.HbLabel( :name => 'lowerLabel' ).HbTextItem( :text => 'Unnamed' )} |
966 #Verify, that reminder icon in widget is shown |
1024 #Verify, that reminder icon in widget is shown |
967 #cannot verify yet, since with calendar fixture only events, that has no reminder, are possible to create |
1025 if not(app.test_object_exists?("HbFrameItem",{:frameGraphicsName => 'qtg_small_reminder'})) then |
968 #if not(app.test_object_exists?("HbIconItem",{:iconName => 'images/bell.PNG'})) then |
1026 raise VerificationError ,"ERROR: There is not reminder icon in calendar widget, when it should be there", caller |
969 # raise VerificationError ,"ERROR: There is not reminder icon in calendar widget, when it should be there", caller |
1027 end |
970 #end |
1028 delete_calendar_events_via_UI |
971 |
|
972 remove_calendar_widget_from_homescreen(0) |
|
973 delete_calendar_events(app) |
|
974 #rescue |
1029 #rescue |
975 # if (running_round < max_running_rounds) then |
1030 # if (running_round < max_running_rounds) then |
976 # running_round = running_round + 1 |
1031 # running_round = running_round + 1 |
977 # puts "Some error came during run. Lets try again" |
1032 # puts "Some error came during run. Lets try again" |
978 # teardown |
1033 # teardown |
1109 # Created by: Jarno Mäkelä |
1164 # Created by: Jarno Mäkelä |
1110 # Reviewed by: |
1165 # Reviewed by: |
1111 # |
1166 # |
1112 # === preconditions |
1167 # === preconditions |
1113 # - Device is in Home Screen. |
1168 # - Device is in Home Screen. |
1114 # - Some events are created in Calendar. |
1169 # - At least one upcoming event created in Calendar. |
1115 # - Calendar widget is added to Home Screen. |
1170 # - Calendar widget is added to Home Screen. |
1116 # |
1171 # |
1117 # === params |
1172 # === params |
1118 # none |
1173 # none |
1119 # |
1174 # |
1120 ############################################################################################################################################ |
1175 ############################################################################################################################################ |
1121 |
1176 |
1122 def _test_calendar_widget_tapping_upcoming_event |
1177 def test_calendar_widget_tapping_upcoming_event |
1123 |
1178 #Preconditions: |
|
1179 # - Device is in Home Screen. |
|
1180 app = @sut.application(:name => 'hsapplication') |
|
1181 # - At least one upcoming event created in Calendar. |
|
1182 check_phone_date |
|
1183 check_phone_time |
|
1184 today_time_for_verification = create_calendar_event_via_calendar("not working",@day.to_i,@month.to_i,@year.to_i,@hour.to_i+2,@minute.to_i,0,0,0) |
|
1185 #-Calendar widget is added to Home Screen. |
|
1186 #Not adding calendar widget, if it already exists there |
|
1187 if not(app.test_object_exists?("HbWidget",{:name => 'CalendarWidget'})) then |
|
1188 #add calendar widget to home screen |
|
1189 app.HbIconItem(:iconName => 'qtg_mono_applications_all').tap |
|
1190 add_calendar_widget_to_homescreen(app,'AppListButton') |
|
1191 end |
|
1192 #Step 1:Tap on the upcoming event in Calendar widget. |
|
1193 app.HbTextItem( :text => today_time_for_verification ).tap |
|
1194 #Step 1 Expected: |
|
1195 #- Calendar agenda view is opened. |
|
1196 #- The date is same as the event date. |
|
1197 cal_app = @sut.application(:name => 'calendar') |
|
1198 verify(){cal_app.CalenAgendaView( :name => 'agendaView' )} |
|
1199 #Error in SW, cannot verify date yet, since shows no date |
|
1200 #postactions |
|
1201 delete_calendar_events_via_UI |
1124 end |
1202 end |
1125 |
1203 |
1126 ############################################################################################################################################## |
1204 ############################################################################################################################################## |
1127 # Calendar widget - no events |
1205 # Calendar widget - no events |
1128 ############################################################################################################################################## |
1206 ############################################################################################################################################## |