phoneuis/bubblemanager2/tsrc/bubbletest2/tdriver/tc_bubblemanager2.rb
changeset 65 2a5d4ab426d3
equal deleted inserted replaced
60:1eef62f5c541 65:2a5d4ab426d3
       
     1 ############################################################################
       
     2 ## 
       
     3 ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     4 ## All rights reserved. 
       
     5 ## 
       
     6 ## This file is part of BubbleManager2. Reference TDriver test script. 
       
     7 ## 
       
     8 ## 
       
     9 ############################################################################
       
    10 
       
    11 require 'matti'
       
    12 require 'orbitbehaviours.rb'
       
    13 include MattiVerify
       
    14 
       
    15 require 'test/unit'
       
    16 
       
    17 class TC_BubbleManager2 < Test::Unit::TestCase
       
    18   
       
    19   # setup and teardown methods are always executed before each and after each test case method
       
    20   def setup
       
    21     # get the calculator app running 
       
    22     @sut = MATTI.sut(:Id => "sut_qt")    
       
    23     @testapp = @sut.run(:name => "bubbletest2")
       
    24     
       
    25   end
       
    26   
       
    27   def teardown   
       
    28     @testapp.close        
       
    29   end
       
    30   
       
    31   def test_mobile_terminated_call
       
    32     
       
    33     # create incoming call
       
    34     @testapp.BubbleTestView.press_key(:kC) # ciphering
       
    35     @testapp.BubbleTestView.press_key(:kD) # divert    
       
    36     @testapp.BubbleTestView.press_key(:k1)
       
    37     
       
    38     verify( 5, "Incoming bubble shown" ) { @testapp.BubbleContainerWidget(:objectName => 'expandedBubble' )}
       
    39     # check heading
       
    40     verify { @testapp.BubbleHeadingWidget(:objectName => 'eb:bubbleHeading',
       
    41                                           :textLine1 => '+35850123456789',
       
    42                                           :textLine2 => 'calling',
       
    43                                           :indicator1 => 'qtg_mono_ciphering_off',
       
    44                                           :indicator2 => 'qtg_mono_call_diverted' ) }
       
    45     # check image
       
    46     verify { @testapp.BubbleImageWidget(:objectName => 'eb:callImage', 
       
    47                                         :imageName => 'qtg_large_avatar' ) }
       
    48                                         
       
    49     # answer the call
       
    50     @testapp.BubbleButton(:objectName => 'eb:leftButton').tap
       
    51     
       
    52     # check heading
       
    53     verify { @testapp.BubbleHeadingWidget(:objectName => 'eb:bubbleHeading',
       
    54                                           :textLine1 => '+35850123456789',
       
    55                                           :textLine2 => '',
       
    56                                           :indicator1 => 'qtg_mono_ciphering_off',
       
    57                                           :indicator2 => '' ) }
       
    58                                           
       
    59     # test mute
       
    60     verify_not { @testapp.HbLabel(:objectName => 'mutedIcon' ) }    
       
    61     @testapp.BubbleButton(:objectName => 'eb:leftButton').tap
       
    62     verify { @testapp.HbLabel(:objectName => 'mutedIcon' ) }
       
    63     @testapp.BubbleButton(:objectName => 'eb:leftButton').tap
       
    64     verify_not { @testapp.HbLabel(:objectName => 'mutedIcon' ) }
       
    65                                           
       
    66     # end the call
       
    67     @testapp.BubbleButton(:objectName => 'eb:rightButton').tap
       
    68     verify_not { @testapp.BubbleContainerWidget(:objectName => 'expandedBubble')}
       
    69                                                                                                                                                                                               
       
    70   end  
       
    71   
       
    72   def test_mobile_terminated_call_with_contact
       
    73     
       
    74     # create incoming call
       
    75     @testapp.BubbleTestView.press_key(:kI) # image
       
    76     @testapp.BubbleTestView.press_key(:kN) # name
       
    77     @testapp.BubbleTestView.press_key(:k1)
       
    78     
       
    79     verify( 5, "Incoming bubble shown" ) { @testapp.BubbleContainerWidget(:objectName => 'expandedBubble' )}
       
    80     # check heading
       
    81     verify { @testapp.BubbleHeadingWidget(:objectName => 'eb:bubbleHeading',
       
    82                                           :textLine1 => 'Gloria Andersson',
       
    83                                           :textLine2 => '+35850123456789',
       
    84                                           :textLine3 => 'calling',
       
    85                                           :indicator1 => '',
       
    86                                           :indicator2 => '' ) }
       
    87     # check image
       
    88     verify { @testapp.BubbleImageWidget(:objectName => 'eb:callImage', 
       
    89                                         :imageName => ':resources/contactpic.jpg' ) }
       
    90                                         
       
    91     # reject the call
       
    92     @testapp.BubbleButton(:objectName => 'eb:rightButton').tap
       
    93     
       
    94     verify_not { @testapp.BubbleContainerWidget(:objectName => 'expandedBubble')}
       
    95                                                                                                                                                                                               
       
    96   end  
       
    97   
       
    98   def test_waiting_call
       
    99     
       
   100     # create active call
       
   101     @testapp.BubbleTestView.press_key(:k1)
       
   102     @testapp.BubbleTestView.press_key(:k3)
       
   103     
       
   104     # waiting call
       
   105     @testapp.BubbleTestView.press_key(:k1)
       
   106     
       
   107     verify( 5, "Active bubble shown" ) { @testapp.BubbleContainerWidget(:objectName => 'collapsedBubble' )}
       
   108     verify( 5, "Waiting bubble shown" ) { @testapp.BubbleContainerWidget(:objectName => 'expandedBubble' )}
       
   109     
       
   110     # check ongoing call heading
       
   111     verify { @testapp.BubbleHeadingWidget(:objectName => 'cb:bubbleHeading',
       
   112                                           :textLine1 => '+35850123456789',
       
   113                                           :textLine2 => '' ) }    
       
   114     
       
   115     # check waiting call heading
       
   116     verify { @testapp.BubbleHeadingWidget(:objectName => 'eb:bubbleHeading',
       
   117                                           :textLine1 => '+35840987654321',
       
   118                                           :textLine2 => 'waiting' ) }
       
   119                                           
       
   120     # check image
       
   121     verify { @testapp.BubbleImageWidget(:objectName => 'eb:callImage', 
       
   122                                         :imageName => 'qtg_large_avatar' ) }
       
   123                                         
       
   124                                         
       
   125     # answer the call
       
   126     @testapp.BubbleButton(:objectName => 'eb:leftButton').tap
       
   127     
       
   128     # check held call heading
       
   129     verify { @testapp.BubbleHeadingWidget(:objectName => 'cb:bubbleHeading',
       
   130                                           :textLine1 => '+35850123456789',
       
   131                                           :textLine2 => 'on hold' ) }     
       
   132     
       
   133     # check active call heading
       
   134     verify { @testapp.BubbleHeadingWidget(:objectName => 'eb:bubbleHeading',
       
   135                                           :textLine1 => '+35840987654321',
       
   136                                           :textLine2 => '' ) }                                            
       
   137     
       
   138   end  
       
   139   
       
   140   def test_conference_call
       
   141     
       
   142     # create conference call
       
   143     @testapp.BubbleTestView.press_key(:kT)
       
   144     @testapp.BubbleTestView.press_key(:k1)
       
   145     @testapp.BubbleTestView.press_key(:k3)
       
   146     @testapp.BubbleTestView.press_key(:k1)
       
   147     @testapp.BubbleTestView.press_key(:k3)
       
   148     @testapp.BubbleTestView.press_key(:k7) # join
       
   149     
       
   150     verify( 5, "Active bubble shown" ) { @testapp.BubbleContainerWidget(:objectName => 'expandedBubble' )}
       
   151     verify { @testapp.BubbleHeadingWidget(:objectName => 'eb:bubbleHeading',
       
   152                                           :textLine1 => 'Conference call',
       
   153                                           :textLine2 => '00:00:00' ) }    
       
   154                                           
       
   155     # check that calls are present in participant list
       
   156     verify { @testapp.HbGroupBox(:heading => '+35850123456789' ) }
       
   157     verify { @testapp.HbGroupBox(:heading => '+35840987654321' ) }
       
   158 
       
   159     # reject the call
       
   160     @testapp.BubbleButton(:objectName => 'eb:rightButton').tap    
       
   161     verify_not { @testapp.BubbleContainerWidget(:objectName => 'expandedBubble')}
       
   162                                                 
       
   163   end
       
   164   
       
   165 end