summaryrefslogtreecommitdiffstats
path: root/tests/systemtests/sys_qmlcontacts/sys_qmlcontacts.qtt
blob: b58b8ce18cd11e508ef504e7f1a7283ab0cfca59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/****************************************************************************
**
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

//TESTED_COMPONENT=src/contacts

// make it simple to change the name of test application later on
function startTestApp()
{
    startApplication('qmlcontacts');
}

// create a re-usable contact set
function exampleContactSet()
{
    return [
          {name:'Mr. Andy Clark',
          firstName:'Andy',
          title:'Engineer',
          organization:'Example',
          department:'',
          phone:'07-2342322',
          email:'andy@example.com',
          address:'',
          birthday:'1/01/4500',
          avatar:'http://qt.nokia.com/logo.png'},
          {name:'Mr. Bob Green',
          firstName:'Bob',
          title:'Engineer',
          organization:'Example',
          phone:'07-3242325',
          email:'bob@example.com',
          address:'',
          birthday:'1/01/4500',
          },
          {
          name:'Mr. Charles Brows',
          firstName:'Charles',
          title:'Engineer',
          organization:'Example',
          department:'',
          phone:'32324534233',
          email:'charles@example.com',
          address:'',
          birthday:'1/01/4500'
          },
          {
          name:'Mr. David Edie',
          firstName:'David',
          title:'Manager',
          organization:'Example',
          department:'',
          phone:'(07) 3245-2323',
          email:'david@example.com',
          address:'',
          birthday:'1/01/4500'
          },
          {
          name:'Mrs. Carol Eden',
          firstName:'Carol',
          title:'Manager',
          organization:'Example',
          department:'',
          phone:'2323242',
          email:'carol@example.com',
          address:'',
          birthday:'1/01/4500'
          },
          {
          name:'Mr. Bill Chilton',
          firstName:'Bill',
          title:'Manager',
          organization:'Example',
          department:'',
          phone:'564412232',
          email:'bill@example.com',
          address:'',
          birthday:'1/01/4500'
          },
          {
          name:'Ms. Aaron Gates',
          firstName:'Aaron',
          title:'Engineer',
          organization:'Example',
          department:'',
          phone:'33333',
          email:'aaron@example.com',
          address:'',
          birthday:'1/01/4500'
          },
          {
          name:'Mr. Jason Black',
          firstName:'Jason',
          title:'Engineer',
          organization:'Example',
          department:'',
          phone:'33333333333',
          email:'jason@example.com',
          address:'',
          birthday:'1/01/4500'
          },
          {
          name:'Mr. Alexander Mcdonald',
          firstName:'Alexander',
          title:'Engineer',
          organization:'Example',
          department:'',
          phone:'111111111',
          email:'alex@example.com',
          address:'',
          birthday:'1/01/4500'
          }
      ]
}

// given a contact object check its details
function checkContact(contact)
{
    select(contact.firstName);
    select('More..');
    compare('Contact', getText('Type'));
    compare(contact.name, getText('DisplayLabel'));
    compare(contact.email, getText('EmailAddress'));
    compare(contact.name, getText('Name'));
    compare(contact.department, getText('Department'));
    compare(contact.phone, getText('PhoneNumber'));
    compare(contact.avatar, getText('Avatar'));
    select('Back');
}

testcase = {

    // prove that the test application starts before anything else is tested.
    /* commit this function as it doesn't use at this moment.
    run_test_application: function()
    {
        // Test meta data
        testTitle = "Contacts - Run test application";
        testBinary = "Qmlcontact";
        testSource = "$MOBILITYDIR/demos/qmlcontacts";
        testGoal = "Verify test application run without any error";
        testPreconditions = "None";
        testGroups = " ";
        testRequirements = "";

        // Test Steps       
        startTestApp();
        if (!runAsManualTest()){
            // ensure we have a widget to work with, dump its details
            print('Focus widget is' + focusWidget());
        }else{
            prompt('Verify test application started and closed without issue');
        }
    },
    */

    check_contact_list_data : {
        ContactSet : [ exampleContactSet() ]
    },

    // verify that overview of contact names is correct
    check_contact_list: function(contactSet)
    {
        // Test meta data
        testTitle = "Contacts - Run test application";
        testBinary = "Qmlcontact";
        testSource = "$MOBILITYDIR/demos/qmlcontacts";
        testGoal = "Verify that overview of contact names is correct";
        testPreconditions = "There are some contact examples";
        testGroups = "BAT_MOBILITY";
        testRequirements = "";

        // Test Steps
        startTestApp();
        for (var index=0; index < contactSet.length; index++){
            // note the contact list should be the focus widget
            select(contactSet[index].firstName);
        }
        prompt("Verify that overview of contact names is correct");
    },


    expand_a_contact_data : {
        ContactSet : [ exampleContactSet() ]
    },

    // verify that when selecting a contact its summary is shown
    expand_a_contact: function(contactSet)
    {
        // Test meta data
        testTitle = "Contacts - Run test application";
        testBinary = "Qmlcontact";
        testSource = "$MOBILITYDIR/demos/qmlcontacts";
        testGoal = "Verify that when selecting a contact its summary is shown";
        testPreconditions = "None";
        testGroups = " ";
        testRequirements = "";

        // Test Steps 
        startTestApp();
        for (var index = 0; index < 3; index++){
            prompt("Verify that no details for " + contactSet[index].firstName  +' is seen');
            select(contactSet[index].firstName);
            verify(getValue().contains(contactSet[index].name), 'Verify contact summary for ' + contactSet[index].name);
            verify(getLabels().contains('More...'), 'Verify \'More..\' button is present');
        }
    },

    show_all_contact_detail_data : {
        ContactSet : [ exampleContactSet() ]
    },

    // verify that the details page for contacts can be seen
    show_all_contact_detail : function(contactSet)
    {
        // Test meta data
        testTitle = "Contacts - Run test application";
        testBinary = "Qmlcontact";
        testSource = "$MOBILITYDIR/demos/qmlcontacts";
        testGoal = "Verify that the details page for contacts can be seen";
        testPreconditions = "None";
        testGroups = " ";
        testRequirements = "";

        // Test Steps 
        startTestApp();
        for (var index = 0; index < 3; index++){
            select(contactSet[index].firstName);
            select('More..')
            verify(getLabels().contains('DisplayLabel'), 'Verify contact details are shown for ' + contactSet[index].name);
            select('Back');
        }
    },
    
    check_contact_details_data :{
        ContactSet : [ exampleContactSet() ]
    },

    // check that each contact has the details expec
    check_contact_details: function(contactSet)
    {
        // Test meta data
        testTitle = "Contacts - Run test application";
        testBinary = "Qmlcontact";
        testSource = "$MOBILITYDIR/demos/qmlcontacts";
        testGoal = "Verify that each contact has the details expec";
        testPreconditions = "None";
        testGroups = " ";
        testRequirements = "";

        // Test Steps 
        startTestApp();
        for (var index=0; index < contactSet.length; index++){
            checkContact(contactSet[index]);
        }
    }

}  // end of testcase