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
|
#!/usr/bin/python
#
# Linux Desktop Testing Project http://ldtp.freedesktop.org
#
# Author:
# Nagashree <mnagashree@novell.com>
# Premkumar <jpremkumar@novell.com>
# Khasim Shaheed <khasim.shaheed@gmail.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.
#
# Forward a Mail in different styles
import time
from ldtp import *
from evoutils.mail import *
from evoutils.mailpreferences import *
# Declare global variables
global style, sentitems
# Section to forward mail
def forward_mail (source_fldr, mail_index, to, body, subject_new, cc, refimg):
try:
# Change the forward style
change_style ('Forward', style)
# forward mail section
selectrowpartialmatch ('frmEvolution-*', 'ttblMailFolderTree', sentitems)
waittillguiexist ('frmEvolution-'+sent_items+'*')
time.sleep (2)
n_sentitems = getrowcount ('frmEvolution-*', 'ttblMessages')
selectrowpartialmatch ('frmEvolution-*', 'ttblMailFolderTree', source_fldr)
waittillguiexist ('frmEvolution-'+source_fldr+'*')
time.sleep (2)
if mail_index == -1:
mail_index = getrowcount ('frmEvolution-*', 'ttblMessages') - 1
selectrowindex ('frmEvolution-*', 'ttblMessages', mail_index)
subject = getcellvalue ('frmEvolution-*', 'ttblMessages', mail_index, 4)
click ('frmEvolution-*','btnForward')
time.sleep (2)
setcontext ('Compose Message', '[Fwd: '+subject+']')
if waittillguiexist ('frmComposeMessage') == 0:
log ('Failed to open forward frame', 'error')
raise LdtpExecutionError(0)
if populate_mail_header (to, subject_new, body, cc) == 0:
log ('Failed to populate mail header', 'error')
raise LdtpExecutionError (0)
else:
if subject_new:
setcontext ('Compose Message', subject_new[0])
click ('frmComposeMessage', 'btnSend')
if waittillguinotexist ('frmComposeMessage') == 0:
log ('Failed to close Compose dialog after sending','error')
raise LdtpExecutionError(0)
releasecontext ()
click ('frmEvolution-*', 'btnSend/Receive')
time.sleep (3)
if verifymailwithimage (sentitems, n_sentitems, refimg) == 1:
log ('Forward message Success', 'pass')
else:
log ('Forward message', 'fail')
except ldtp.error, msg:
log ('Forward messsage Failed ' + str (msg), 'cause')
log ('Forward Mail Failed', 'fail')
if guiexist ('frmComposeMessage'):
selectmenuitem ('frmComposeMessage', 'mnuFile;mnuClose')
raise LdtpExecutionError (0)
# Reading Input from File
data_object = LdtpDataFileParser (datafilename)
to = data_object.gettagvalue ('to')
cc = data_object.gettagvalue ('cc')
style = data_object.gettagvalue ('style')
subject = data_object.gettagvalue ('subject')
source_fldr = data_object.gettagvalue ('source_fldr')
mail_index = data_object.gettagvalue ('mail_index')
body = data_object.gettagvalue ('body')
sentitemsfolder = data_object.gettagvalue ('sentitemsfolder')
refimg = data_object.gettagvalue ('refimg')
# Initialize global variables
if style:
style = style[0]
else:
style = 'Attachment'
if sentitemsfolder:
sentitems = sentitemsfolder[0]
else:
sentitems = 'Sent Items'
# Call the function
if source_fldr and mail_index:
forward_mail (source_fldr[0], int (mail_index[0]), to, body, subject, cc, refimg)
else:
if not (source_fldr):
log ('source_fldr is not provided in data xml file', 'error')
if not (mail_index):
log ('mail_index is not provided in data xml file', 'error')
log ('forward mail', 'fail')
|