summaryrefslogtreecommitdiff
path: root/evolution/create-appointment.py
blob: 52006530cd23bda0f30931c5b539d8d4f4775e63 (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
#
#  Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
#
#  Author:
#     Prem <jpremkumar@novell.com>
#
#  Copyright 2004 Novell, Inc.
#
#  This test script is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Library General Public
#  License as published by the Free Software Foundation; either
#  version 2 of the License, or (at your option) any later version.
#
#  This library is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Library General Public License for more details.
#
#  You should have received a copy of the GNU Library General Public
#  License along with this library; if not, write to the
#  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
#  Boston, MA 02111-1307, USA.
#

#To create an Appointment
from evoutils.calendar import *
from ldtputils import *

#Initialising XML parser with data file
data_object = LdtpDataFileParser (datafilename)

#Extracting imput data from xml file
summary = data_object.gettagvalue ('summary')[0]
location = data_object.gettagvalue ('location')[0]
description = data_object.gettagvalue ('description')[0]
from_date = data_object.gettagvalue ('from_date')[0]
to_date = data_object.gettagvalue ('to_date')[0]
from_time = data_object.gettagvalue ('from_time')[0]
to_time = data_object.gettagvalue ('to_time')[0]
calendar = data_object.gettagvalue ('calendar')[0]
classification = data_object.gettagvalue ('classification')[0]
categories = data_object.gettagvalue ('categories')[0]
#count = data_object.gettagvalue ('count')[0]
#forever = data_object.gettagvalue ('for')[0]
#occurences = data_object.gettagvalue ('occurences')[0]
#exception = data_object.gettagvalue ('exception')

#creation fo appointment
log ('Appointment Creation', 'teststart')

try:
    windowname = 'frmAppointment-*'
    ptlistname = 'ptl0'
    flag = 0
    #selectmenuitem ('frmEvolution-Calendars', 'mnuView;mnuWindow;mnuCalendars')
    selectmenuitem ('frmEvolution-*', 'mnuFile;mnuFile;mnuAppointment')
    time.sleep(2)
    #click ('frmEvolution-Calendars', 'btnNew')
    waittillguiexist (windowname) 
    if guiexist (windowname) == 0:
        log ('Failed to open new appointment window', 'cause')
        raise LdtpExecutionError (0)
    else:
        log ('Insertion of Appointment values', 'teststart')
        #i = insert_appointment (windowname, ptlistname, summary, location, description, from_date,from_time, to_date, to_time, calendar, classification, categories) 
        i = insert_appointment (windowname, summary, location, description, from_date, from_time, to_date, to_time, calendar, 'No') 
        if i == 1:
            flag = 1
        log ('Insertion of Appointment values', 'testend')
        time.sleep (2)
        if i == 0:
            log ('Insertion of recurrence values', 'teststart')
            #i = insert_recurrence (windowname, ptlistname, count, forever, occurences, exception)
			
            if i == 1:
                flag = 1
                log ('Insertion of recurrence values', 'testend')
                time.sleep (2)
        if stateenabled (windowname, 'btnOK') == 1:
            click (windowname , 'btnOK')
        else:
            log ('OK Button is in disabled state!!', 'warning')
            click (windowname , 'btnCancel')
        time.sleep (3)
        if waittillguinotexist ('dlgAppointment-Nosummary') == 0:
            log ('Failed to close appointment dialog' ,'cause')
            raise LdtpExecutionError (0)
        time.sleep (2)
        #releasecontext ()
        if flag == 1:
            log ('Appointment creation succeeded', 'fail')
        else:
            log ('Appointment creation succeeded', 'pass')
except LdtpExecutionError,msg:
    #releasecontext ()
    print 'Creation of appointment failed' + str(msg)
    log ('Creation of appointment failed', 'error')
    log ('Appointment Creation', 'testend')
except error, msg:
    #releasecontext ()
    print 'Creation of appointment failed' + str(msg)
    log ('Creation of appointment failed', 'error')
    log ('Appointment Creation', 'testend')
    raise LdtpExecutionError (0)
    
log ('Appointment Creation', 'testend')