telutils/dialpad/tsrc/dialpadtest/tdriver/tc_dialpad.rb
changeset 48 78df25012fda
equal deleted inserted replaced
46:2fa1fa551b0b 48:78df25012fda
       
     1 ############################################################################
       
     2 ## 
       
     3 ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     4 ## All rights reserved. 
       
     5 ## 
       
     6 ## This file is part of Dialpad. 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_Dialpad < 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     @dtest = @sut.run(:name => "dialpadtest")
       
    24     
       
    25   end
       
    26   
       
    27   def teardown   
       
    28     @dtest.close        
       
    29   end
       
    30   
       
    31   def test_dialpad
       
    32     
       
    33     # tap toolbar to open dialpad
       
    34     @dtest.HbToolBar().tap
       
    35     verify( 5, "Dialpad should be open" ) { @dtest.Dialpad(:objectName => 'dialpad', 
       
    36                                                            :visible => 'true')}
       
    37 
       
    38     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '0,0', 
       
    39                                                                   :primaryLabel => '1', 
       
    40                                                                   :iconName => 'qtg_mono_voice_mailbox') }
       
    41                                                                   
       
    42     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '1,0', 
       
    43                                                                   :primaryLabel => '2', 
       
    44                                                                   :secondaryLabel => 'abc') }
       
    45                                                                   
       
    46     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '2,0', 
       
    47                                                                   :primaryLabel => '3', 
       
    48                                                                   :secondaryLabel => 'def') }
       
    49     
       
    50     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '0,1', 
       
    51                                                                   :primaryLabel => '4', 
       
    52                                                                   :secondaryLabel => 'ghi') }        
       
    53     
       
    54     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '1,1', 
       
    55                                                                   :primaryLabel => '5', 
       
    56                                                                   :secondaryLabel => 'jkl') }    
       
    57 
       
    58     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '2,1', 
       
    59                                                                   :primaryLabel => '6', 
       
    60                                                                   :secondaryLabel => 'mno') }    
       
    61     
       
    62     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '0,2', 
       
    63                                                                   :primaryLabel => '7', 
       
    64                                                                   :secondaryLabel => 'pqrs') }        
       
    65     
       
    66     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '1,2', 
       
    67                                                                   :primaryLabel => '8', 
       
    68                                                                   :secondaryLabel => 'tuv') }    
       
    69 
       
    70     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '2,2', 
       
    71                                                                   :primaryLabel => '9', 
       
    72                                                                   :secondaryLabel => 'wxyz') }    
       
    73     
       
    74     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '0,3', 
       
    75                                                                   :primaryLabel => '*', 
       
    76                                                                   :secondaryLabel => '+') }        
       
    77     
       
    78     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '1,3', 
       
    79                                                                   :primaryLabel => '0', 
       
    80                                                                   :secondaryLabel => '') }    
       
    81 
       
    82     verify { @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '2,3', 
       
    83                                                                   :primaryLabel => '#', 
       
    84                                                                   :secondaryLabel => '') }
       
    85                                                                   
       
    86     verify { @dtest.DialpadButton( :objectName => 'backspaceButton', :iconName => 'qtg_mono_backspace2' ) }
       
    87     
       
    88     verify { @dtest.DialpadButton( :objectName => 'callButton', :iconName => 'qtg_mono_call' ) }
       
    89     
       
    90     # enter 159
       
    91     @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '0,0').tap
       
    92     @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '1,1').tap
       
    93     @dtest.DialpadNumericButtonGrid.DialpadNumericButton(:position => '2,2').tap    
       
    94     
       
    95     verify( 5, "Editor text should be 159" ) { @dtest.HbLineEdit(:objectName => 'numberEdit', :text => "159")}    
       
    96         
       
    97     @dtest.DialpadButton({:objectName => 'backspaceButton'}).tap
       
    98     verify( 5, "Editor text should be 15" ) { @dtest.HbLineEdit(:objectName => "numberEdit", :text => "15")}    
       
    99     
       
   100     @dtest.Dialpad(:objectName => 'dialpad').flick(:Down)
       
   101     verify_not( 5, "Dialpad should be closed" ) { @dtest.Dialpad(:objectName => 'dialpad')}    
       
   102     
       
   103   end  
       
   104   
       
   105 end