|
1 require 'CommonFunctions.rb' |
|
2 |
|
3 class TC_OptionsMenu < CommonFunctions |
|
4 |
|
5 ## Initializes the Application. Log events are created and application is started. |
|
6 def initializeOptionsMenu(caseName) |
|
7 initializeTest(caseName) |
|
8 end |
|
9 |
|
10 ## Test that event list can be cleaned in recent view |
|
11 def clear_event_list_recent_view |
|
12 initializeOptionsMenu("case8") |
|
13 @log.debug('Tapping the options menu') |
|
14 @mainWindow.HbTitlePane.tap |
|
15 @log.debug('Selecting "Clear list" options menu') |
|
16 @optionsMenu = @mainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer |
|
17 @optionsMenu.HbMenuItem(:row=>'1').HbTextItem(:text=>'Clear list').tap |
|
18 begin |
|
19 @log.debug('Verify that there are no event items anymore left') |
|
20 @eventContainer.HbListViewItem(:row=>"0") |
|
21 rescue |
|
22 #Expected, case passed as no items left anymore |
|
23 result = 0 |
|
24 @appControl.closeApplication() |
|
25 return result |
|
26 end |
|
27 @log.fatal('There are still event items left!') |
|
28 return -2 |
|
29 end |
|
30 |
|
31 ## Test that event list can be cleaned in recent view |
|
32 def clear_event_list_missed_view |
|
33 return clear_event_list("Missed") |
|
34 end |
|
35 |
|
36 ## Test that event list can be cleaned in recent view |
|
37 def clear_event_list_dialled_view |
|
38 return clear_event_list("Dialled") |
|
39 end |
|
40 |
|
41 ## Test that event list can be cleaned in recent view |
|
42 def clear_event_list_received_view |
|
43 return clear_event_list("Received") |
|
44 end |
|
45 |
|
46 def clear_event_list(view) |
|
47 initializeOptionsMenu("case8") |
|
48 selectView("Recent", view) |
|
49 @log.debug('Tapping the options menu') |
|
50 @mainWindow.HbTitlePane.tap |
|
51 @log.debug('Selecting "Clear list" options menu') |
|
52 @optionsMenu = @mainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer |
|
53 @optionsMenu.HbMenuItem(:row=>'1').HbTextItem(:text=>'Clear list').tap |
|
54 begin |
|
55 @log.debug('Verify that there are no event items anymore left') |
|
56 @eventContainer.HbListViewItem(:row=>"0") |
|
57 rescue |
|
58 #Expected, no items left in selected view view |
|
59 @log.debug("No event items anymore left in #{view} view") |
|
60 @log.debug('Verify Recent view, all other event items should be still there') |
|
61 if(view == "Missed") |
|
62 selectView("Missed", "Recent") |
|
63 verify_event("0", "880123456789", DirInIcon_Const, VoiceIcon_Const) |
|
64 verify_event("3", "+358012345678910", DirOutIcon_Const, VoiceIcon_Const) |
|
65 elsif(view == "Dialled") |
|
66 selectView("Dialled", "Recent") |
|
67 verify_event("0", "088012345678911", DirMissedIcon_Const, VoiceIcon_Const) |
|
68 verify_event("3", "88012345678910", DirInIcon_Const, VoiceIcon_Const) |
|
69 else |
|
70 selectView("Received", "Recent") |
|
71 verify_event("0", "088012345678911", DirMissedIcon_Const, VoiceIcon_Const) |
|
72 verify_event("3", "+358012345678910", DirOutIcon_Const, VoiceIcon_Const) |
|
73 end |
|
74 result = 0 |
|
75 @appControl.closeApplication() |
|
76 return result |
|
77 end |
|
78 @log.fatal('There are still event items left in #{view} view!') |
|
79 return -2 |
|
80 end |
|
81 |
|
82 ## Test that logs application is closed when tapping on back |
|
83 def exit_logs_by_selecting_back |
|
84 initializeOptionsMenu("case8") |
|
85 @log.debug('Tapping the Back button') |
|
86 @my_app.LogsMainWindow.HbSoftKey({:visibleOnScreen => 'true'}).tap |
|
87 if(@my_sut.application.attribute("FullName") == "Z:\sys\bin\logs.exe") |
|
88 log.fatal("Error in closing logs application from Exit options menu. Logs still running!") |
|
89 appControl.closeApplication() |
|
90 result = -2 |
|
91 else |
|
92 result = 0 |
|
93 end |
|
94 return result |
|
95 end |
|
96 |
|
97 ## Test that logs application is closed when selecting exit from options menu |
|
98 def exit_logs_by_selecting_exit_from_options_menu |
|
99 initializeOptionsMenu("case8") |
|
100 @log.debug('Tapping the options menu') |
|
101 @my_app.LogsMainWindow.HbTitlePane.tap |
|
102 @log.debug('Selecting "Exit" options menu') |
|
103 @my_app.LogsMainWindow.HbMenu.HbMenuListView.HbAbstractItemContainer.HbMenuItem(:row=>'3').HbTextItem(:text=>'Exit').tap |
|
104 if(@my_sut.application.attribute("FullName") == "Z:\sys\bin\logs.exe") |
|
105 log.fatal("Error in closing logs application from Exit options menu. Logs still running!") |
|
106 appControl.closeApplication() |
|
107 result = -2 |
|
108 else |
|
109 result = 0 |
|
110 end |
|
111 return result |
|
112 end |
|
113 |
|
114 |
|
115 |
|
116 end |
|
117 |
|
118 |
|
119 #@my_sut.capture_screen(:Filename => 'c:/temp/live.png') |
|
120 #puts @my_sut.application.attribute("FullName") |
|
121 #f = File.new('c:\temp\decorator.xml', "w") |
|
122 #xml = @my_sut.get_ui_dump() |
|
123 #f.puts xml |