How to use selectrowpartialmatch method in pyatom

Best Python code snippet using pyatom_python

menu_reorganization.py

Source:menu_reorganization.py Github

copy

Full Screen

1#!/usr/bin/env python2#3# Linux Desktop Testing Project http://ldtp.freedesktop.org4#5# Author:6# Venkateswaran S <wenkat.s@gmail.com>7# Prashanth Mohan <prashmohan@gmail.com>8#9# Copyright 2004 Novell, Inc.10#11# This test script is free software; you can redistribute it and/or12# modify it under the terms of the GNU Library General Public13# License as published by the Free Software Foundation; either14# version 2 of the License, or (at your option) any later version.15#16# This library is distributed in the hope that it will be useful,17# but WITHOUT ANY WARRANTY; without even the implied warranty of18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU19# Library General Public License for more details.20#21# You should have received a copy of the GNU Library General Public22# License along with this library; if not, write to the23# Free Software Foundation, Inc., 59 Temple Place - Suite 330,24# Boston, MA 02111-1307, USA.25#26from ldtp import *27from ldtputils import *28from evoutils import *29def selectfolder(windowname,fldr,dest=''):30 try:31 log('Selecting a given folder','teststart')32 if waittillguiexist(windowname) == 1:33 if gettreetablerowindex (windowname, 'ttblMailFolderTree', fldr) == -1:34 click(windowname,'btnNew')35 time.sleep(3)36 waittillguiexist ('dlgCreatefolder') 37 settextvalue('dlgCreatefolder','txtFoldername',fldr)38 selectrowpartialmatch ('dlgCreatefolder', 'ttblMailFolderTree',dest)39 click('dlgCreatefolder','btnCreate')40 time.sleep(2)41 if guiexist('dlgEvolutionError'):42 click('dlgEvolutionError','btnOK')43 time.sleep(2)44 click('dlgCreatefolder','btnCancel')45 print 'Folder Name already exist'46 log('Folder Already exists','error')47 48 selectrowpartialmatch (windowname, 'ttblMailFolderTree',fldr)49 waittillguiexist ('frmEvolution-'+fldr+'*')50 log('Required folder selected','info')51 log('Selecting a given folder','testend')52 return 153 else:54 log('Unable to find the window','error')55 log('Selecting a given folder','testend')56 except: 57 log('Unable to select the folder/create it','error')58 log('Selecting a given folder','testend')59 60def verify_folder_exist(Folder_name):61 try:62 #log('Verify Folder Exists','teststart')63 #remap('evolution','frmEvolution-Mail')64 if selectrowpartialmatch ('frmEvolution-*','ttblMailFolderTree',Folder_name) == 1:65 waittillguiexist ('frmEvolution-'+Folder_name+'*')66 log('Verify succeeded')67 #undoremap('evolution','frmEvolution-Mail')68 #log('Verify Folder Exists','testend')69 return 170 except:71 log('verify Failed','error')72 #log('Verify Folder Exists','testend')73 raise LdtpExecutionError (0)74def create_folder(Folder_name, location=''):75 try:76 log('Create a new folder','teststart')77 windowname = 'dlgCreatefolder'78 waittillguiexist (windowname) 79 settextvalue(windowname,'txtFoldername',Folder_name)80 selectrowpartialmatch ('dlgCreatefolder', 'ttblMailFolderTree',location)81 log('User Value Entered','info')82 click(windowname,'btnCreate')83 time.sleep(3)84 if guiexist('dlgEvolutionError') == 1:85 click('dlgEvolutionError','btnOK')86 time.sleep(3)87 click(windowname,'btnCancel')88 print 'Folder Name \''+Folder_name+'\' already exist'89 log('Folder Already exists','cause')90 log('Create a new folder','testend')91 return 092 else:93 log('Folder created','info')94 print 'Folder with the name \''+Folder_name+'\' created'95 if verify_folder_exist(Folder_name) != 1:96 print 'Folder Creatation Verify failed'97 log('Verification failed','error')98 log ('Create a new folder','fail')99 log('Create a new folder','testend')100 return 0101 else:102 print 'Folder Creation verified'103 log('Folder Verified','info')104 log ('Create a new folder','pass')105 log('Create a new folder','testend')106 return 1107 except :108 log('Cannot create a folder','error')109 log ('Create a new folder','fail')110 log('Create a new folder','testend')111 print 'Cannot create a folder'112 raise LdtpExecutionError (0)113 log('Create a new folder','testend')114def copy_to (from_fldr,to_fldr):115 try:116 log('Copy a folder','teststart')117 windowname = 'dlgSelectfolder'118 #remap('evolution','frmEvolution-Mail')119 if selectrowpartialmatch ('frmEvolution-*','ttblMailFolderTree',from_fldr) == 1:120 waittillguiexist ('frmEvolution-'+from_fldr+'*')121 log('From folder selected','info')122 selectmenuitem('frmEvolution-*','mnuFolder;mnuCopyFolderTo*')123 time.sleep(3)124 if selectfolder(windowname,to_fldr) == 1:125 log('Destionation folder selected')126 else:127 log('Unable to get hold of destination folder','error')128 log('Copy a folder','testend')129 return 0130 time.sleep(2)131 click(windowname,'btnCopy')132 if guiexist ('dlgEvolutionError') == 1:133 log ('Evolution is offline','cause')134 click('dlgEvolutionError','btnOK')135 log('Copy a folder','testend')136 raise LdtpExecutionError (0)137 else:138 print 'Unable to find the source folder'139 log('Unable to find the source folder','cause')140 log('Copy a folder','testend')141 return 0142 #undoremap('evolution','frmEvolution-Mail') 143 print from_fldr+ ' has been copied to '+ to_fldr144 log('folder copied','info')145 log('Copy a folder','testend')146 return 1147 except :148 149 log('Cannot copy the folder','error')150 log('Copy a folder','testend')151 raise LdtpExecutionError (0)152def move_to (from_fldr,to_fldr):153 try:154 log('move a folder','teststart')155 windowname = 'dlgSelectfolder'156 #remap('evolution','frmEvolution-Mail')157 if selectrowpartialmatch ('frmEvolution-*','ttblMailFolderTree',from_fldr) == 1:158 waittillguiexist ('frmEvolution-'+from_fldr+'*')159 log('From folder selected','info')160 selectmenuitem('frmEvolution-*','mnuFolder;mnuMoveFolderTo')161 time.sleep(3)162 if selectfolder(windowname,to_fldr) == 1:163 log('Destionation folder selected')164 else:165 log('Unable to get hold of destination folder','error')166 log('Move a folder','testend')167 return 0168 time.sleep(2)169 #remap('evolution',windowname)170 click(windowname,'btnMove')171 time.sleep (1)172 if guiexist ('dlgEvolutionError') == 1:173 log ('Evolution is offline','cause')174 #undoremap('evolution',windowname)175 click('dlgEvolutionError','btnOK')176 log('Move a folder','testend')177 raise LdtpExecutionError (0)178 #undoremap('evolution',windowname)179 else:180 print 'Unable to find the source folder'181 log('Unable to find the source folder','cause')182 log('Move a folder','testend')183 return 0184 #undoremap('evolution',windowname)185 log('Move a folder','testend')186 return 1187 except :188 log('Cannot copy the folder','error')189 log('Move a folder','testend')190 raise LdtpExecutionError (0)191 192 log('Move a folder','testend')193 194def select_all (fldrname): 195 try:196 #log('select all mails in a folder','teststart')197 #remap('evolution','frmEvolution-Mail')198 if selectrowpartialmatch ('frmEvolution-*','ttblMailFolderTree',fldrname) == 1:199 waittillguiexist ('frmEvolution-'+fldrname+'*')200 log('From folder selected','info')201 time.sleep (3)202 if selectmenuitem('frmEvolution-*','mnuFolder;mnuSelectAllMessages') == 1:203 log('All items have been selected','info') 204 #log('select all mails in a folder','testend')205 return 1206 else:207 print 'Unable to select all mails'208 #log('select all mails in a folder','testend')209 return 0210 else:211 print 'Unable to find the folder'212 log('Unable to find the folder','cause')213 #log('select all mails in a folder','testend')214 return 0215 except :216 print 'Cannot select all items in the folder'217 log('Cannot select all the items','error')218 raise LdtpExecutionError (0)219def mark_all_read(fldrname): 220 try:221 log('Mark all as read','teststart')222 select_all(fldrname)223 if selectmenuitem('frmEvolution-*','mnuFolder;mnuMarkAllMessagesasRead') == 1:224 print 'All messages has been marked read'225 log('All items have been selected','info') 226 else:227 print 'Unable to select the mails'228 log('Unable to select the menu Markas;Read','error')229 log('Mark all as read','testend')230 except:231 print 'Cannot set all items in the folder as read'232 log('Cannot mark as read','error')233 log('Mark all as read','testend')234 raise LdtpExecutionError(0)235def mark_read (subject, fldr=''):236 try:237 if fldr != '':238 selectrowpartialmatch ('frmEvolution-*','ttblMessageFolderTree',fldr)239 waittillguiexist ('frmEvolution-'+fldr+'*')240 selectrowpartialmatch ('frmEvolution-*','ttblMessages',subject)241 try:242 selectmenuitem ('frmEvolution-*','mnuMessage;mnuMarkas;mnuRead')243 except:244 log ('Already in Read state','info')245 except:246 log ('Unable to mark message as read','error')247 raise LdtpExecutionError (0)248 249def mark_unread (subject, fldr=''):250 try:251 if fldr != '':252 selectrowpartialmatch ('frmEvolution-*','ttblMessageFolderTree',fldr)253 waittillguiexist ('frmEvolution-'+fldr+'*')254 selectrowpartialmatch ('frmEvolution-*','ttblMessages',subject)255 try:256 selectmenuitem ('frmEvolution-*','mnuMessage;mnuMarkas;mnuUnread')257 except:258 log ('Already in Unread state','info')259 except:260 log ('Unable to mark message as Unread','error')261 raise LdtpExecutionError (0)262def mark_junk (subject, fldr=''):263 try:264 if fldr != '':265 selectrowpartialmatch ('frmEvolution-*','ttblMessageFolderTree',fldr)266 waittillguiexist ('frmEvolution-'+fldr+'*')267 selectrowpartialmatch ('frmEvolution-*','ttblMessages',subject)268 try:269 selectmenuitem ('frmEvolution-*','mnuMessage;mnuMarkas;mnuJunk')270 except:271 log ('Already in Junk state','info')272 except:273 log ('Unable to mark message as Junk','error')274 raise LdtpExecutionError (0)275def mark_notjunk (subject, fldr=''):276 try:277 if fldr != '':278 selectrowpartialmatch ('frmEvolution-*','ttblMessageFolderTree',fldr)279 waittillguiexist ('frmEvolution-'+fldr+'*')280 selectrowpartialmatch ('frmEvolution-*','ttblMessages',subject)281 try:282 selectmenuitem ('frmEvolution-*','mnuMessage;mnuMarkas;mnuNotJunk')283 except:284 log ('Already in Not Junk state','info')285 except:286 log ('Unable to mark message as not junk','error')287 raise LdtpExecutionError (0)288def rename (old_name,new_name):289 try:290 #log('Rename a folder','teststart')291 windowname = 'dlgRenameFolder'292 #remap('evolution','frmEvolution-Mail')293 if selectrowpartialmatch ('frmEvolution-*','ttblMailFolderTree',old_name) == 1:294 waittillguiexist ('frmEvolution-'+old_name+'*')295 log('From folder selected','info')296 selectmenuitem('frmEvolution-*','mnuFolder;mnuRename')297 time.sleep(3)298 waittillguiexist(windowname)299 settextvalue(windowname,'txt0',new_name)300 time.sleep(3)301 #undoremap('evolution','frmEvolution-Mail')302 click(windowname,'btnOK')303 time.sleep(3)304 if guiexist('dlgEvolutionError'):305 click('dlgEvolutionError','btnOK')306 time.sleep(3)307 if guiexist (windowname)==1:308 click(windowname,'btnCancel')309 print 'Folder Name already exist'310 log('Folder Already exists','error')311 else:312 log ('Evolution is Offline','cause')313 else:314 print '\''+old_name+'\' has been renamed to \''+new_name315 log('Rename sucessfull','info')316 #log('Rename a folder','testend')317 return 1 318 else:319 print 'Unable to find the folder'320 log('Unable to find the folder','cause')321 #log('Rename a folder','testend')322 return 0323 except :324 print 'Unable to rename'325 log('Cannot rename the folder','error')326 #log('Rename a folder','testend')327 raise LdtpExecutionError (0)328 log('Rename a folder','testend')329 return 0330def delete_nonsys_folder (fldr): 331 try:332 windowname = 'dlgDelete' 333 #defaultname = '\"Inbox/ashwin\"?'334 sysfolder = ['Inbox','Drafts','Junk','Outbox','Sent','Trash']335 if fldr in sysfolder: 336 log ('A system folder has been selected','error')337 print 'You cannot delete a system folder'338 else:339 selectrow ('frmEvolution-*', 'ttblMailFolderTree', fldr)340 selectmenuitem('frmEvolution-*','mnuFolder;mnuDelete')341 time.sleep(2)342 #if waittillguiexist (windowname + defaultname) == 1:343 print windowname + '\"'+fldr+'\"?'344 if waittillguiexist (windowname + '*') == 1:345 click(windowname + '*', 'btnDelete')346 time.sleep(2)347 if guiexist('dlgEvolutionError') ==1:348 click('dlgEvolutionError','btnOK')349 log('The folder has subfolders or evolution is offline','cause')350 log('delete a non system folder','testend')351 return 0352 else: 353 print 'the folder has been deleted'354 log('the folder has been deleted','info') 355 else:356 log('unable to find the delete window','error')357 log('delete a non system folder','testend')358 raise LdtpExecutionError (0)359 return 1360 except :361 print 'Cannot delete the folder'362 log('Cannot delete the folder','error')363 raise LdtpExecutionError (0)364def insert_followup_details (follow_up_flag, due_date, time, progress):365 try:366 log('Insert Follow up details','teststart')367 windowname = 'dlgFlagtoFollowUp'368 waittillguiexist (windowname)369 settextvalue (windowname,'txtFlag',follow_up_flag)370 settextvalue (windowname,'txtTextDateEntry',due_date)371 settextvalue (windowname,'txt1',time)372 if progress == 'completed':373 check(windowname,'chkCompleted')374 elif progress == 'not started':375 uncheck(windowname,'chkCompleted')376 time.sleep (3)377 click(windowname,'btnOK')378 log('Inserted the followup details')379 print 'Follow up details entered'380 log('Insert Follow up details','testend')381 except:382 log('Unable to enter the given details','error')383 log('Insert Follow up details','testend')384 print 'Unable to enter the follow up details'385 raise LdtpExecutionError (0)386 387def expunge():388 try:389 log('Expunge mails','teststart')390 # Assuming that only the mails in the trash can be expunged.391 fldr = 'Trash'392 remap('evolution','frmEvolution-Mail')393 if selectrowpartialmatch ('frmEvolution-Mail', 'ttblMailFolderTree', fldr):394 waittillguiexist ('frmEvolution-'+fldr+'*')395 log('fldr has been selected','info')396 time.sleep(2)397 if selectmenuitem('frmEvolution-Mail','mnuFolder;mnuExpunge') == 1:398 log('Expunge successfull','info')399 print 'Mails have been permanently removed'400 else:401 log('Expunge not completed','info')402 print 'Probs in permanently removing the mails'403 raise LdtpExecutionError (0)404 else:405 print fldr+ 'not found'406 log('Unable to find trash','error')407 time.sleep (2)408 if getrowcount ('frmEvolution-Mail','mnuFolder;mnuExpunge') == 0:409 log ('Expunge Verified','info')410 else:411 log ('Expunge Failed during verification','cause')412 raise LdtpExecutionError (0)413 except:414 log('Unable to expunge the mails','error')415 log('Expunge mails','testend')416 print 'Unable to expunge'417 raise LdtpExecutionError (0)...

Full Screen

Full Screen

mailaccounts.py

Source:mailaccounts.py Github

copy

Full Screen

1#!/usr/bin/env python2#3# Linux Desktop Testing Project http://ldtp.freedesktop.org4#5# Author:6# Prashanth Mohan <prashmohan@gmail.com>7#8# Copyright 2004 Novell, Inc.9#10# This test script is free software; you can redistribute it and/or11# modify it under the terms of the GNU Library General Public12# License as published by the Free Software Foundation; either13# version 2 of the License, or (at your option) any later version.14#15# This library is distributed in the hope that it will be useful,16# but WITHOUT ANY WARRANTY; without even the implied warranty of17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU18# Library General Public License for more details.19#20# You should have received a copy of the GNU Library General Public21# License along with this library; if not, write to the22# Free Software Foundation, Inc., 59 Temple Place - Suite 330,23# Boston, MA 02111-1307, USA.24#25from ldtp import *26from ldtputils import *27from evoutils import *28def deletemailaccount (account_name):29 log ('Delete E-Mail Account','teststart')30 try:31 try:32 selectmenuitem ('frmEvolution-*','mnuEdit;mnuPreferences')33 waittillguiexist ('dlgEvolutionPreferences')34 if verifyaccountexist (account_name)== -1:35 #account_name += ' [Default]'36 #raw_input (account_name)37 #if verifyaccountexist (account_name) == -1:38 raise LdtpExecutionError (0)39 selectrowpartialmatch ('dlgEvolutionPreferences','tblMailAccounts',account_name)40 except:41 log ('Account not present','cause')42 raise LdtpExecutionError (0)43 time.sleep (3)44 try:45 click ('dlgEvolutionPreferences','btnRemove')46 waittillguiexist ('dlgDeleteaccount?')47 click ('dlgDeleteaccount?','btnDelete')48 except:49 log ('Unable to delete the account','cause')50 raise LdtpExecutionError (0)51 time.sleep (2)52 if verifyaccountexist (account_name) == -1:53 log ('Delete Account','pass')54 else:55 log ('Delete Account','fail')56 raise LdtpExecutionError (0)57 click ('dlgEvolutionPreferences','btnClose')58 except:59 log ('Unable to delete account','error')60 log ('Delete E-Mail Account','testend')61 raise LdtpExecutionError (0)62 log ('Delete E-Mail Account','testend')63def verifyaccountexist (account_name):64 try:65 print account_name66 numofchild = getrowcount ('dlgEvolutionPreferences','tblMailAccounts')67 for num in range (numofchild):68 if getcellvalue ('dlgEvolutionPreferences','tblMailAccounts',num,1).startswith (account_name):69 print num70 return num71 return -172 except:73 log ('Unable to verify if account exists','error')74 raise LdtpExecutionError (0)75def enablemailaccount (account_name):76 log ('Enable Mail Account','teststart')77 try:78 try:79 selectmenuitem ('frmEvolution-*','mnuEdit;mnuPreferences')80 waittillguiexist ('dlgEvolutionPreferences')81 index=verifyaccountexist (account_name)82 if index==-1: 83 raise LdtpExecutionError (0)84 selectrowpartialmatch ('dlgEvolutionPreferences','tblMailAccounts',account_name)85 except:86 log ('Account not present','cause')87 raise LdtpExecutionError (0)88 try:89 selectrowpartialmatch ('dlgEvolutionPreferences','tblMailAccounts',account_name)90 time.sleep (10)91 checkrow ('dlgEvolutionPreferences','tblMailAccounts',index,0)92 except:93 log ('Unable to enable Mail Account','cause')94 raise LdtpExecutionError (0)95 time.sleep (5)96 #verification -- Not valid for POP accounts97 try:98 selectrowpartialmatch ('frmEvolution-*','ttblMailFolderTree',account_name)99 except:100 log ('Account not available in Directory List','warning')101 #raise LdtpExecutionError (0)102 log ('Enable Account','pass')103 click ('dlgEvolutionPreferences','btnClose')104 waittillguinotexist ('dlgEvolutionPreferences')105 except:106 log ('Mail Account not enabled','error')107 log ('Enable Mail Account','testend')108 raise LdtpExecutionError (0)109 log ('Enable Mail Account','testend')110 111def disablemailaccount (account_name):112 log ('Disable Mail Account','teststart')113 try:114 try:115 selectmenuitem ('frmEvolution-*','mnuEdit;mnuPreferences')116 waittillguiexist ('dlgEvolutionPreferences')117 index=verifyaccountexist (account_name)118 if index==-1: 119 raise LdtpExecutionError (0)120 selectrowpartialmatch ('dlgEvolutionPreferences','tblMailAccounts',account_name)121 time.sleep (10)122 except:123 log ('Account not present','cause')124 raise LdtpExecutionError (0)125 try:126 uncheckrow ('dlgEvolutionPreferences','tblMailAccounts',index,0)127 except:128 log ('Unable to disable Mail Account','cause')129 raise LdtpExecutionError (0)130 time.sleep (5)131 #verification -- useless for POP accounts132 try:133 print account_name134 selectrowpartialmatch ('frmEvolution-*','ttblMailFolderTree',account_name)135 except:136 log ('Disable Account','pass')137 log ('Disable Mail Account','testend')138 click ('dlgEvolutionPreferences','btnClose')139 waittillguinotexist ('dlgEvolutionPreferences')140 return141 log ('Disable Account','fail')142 raise LdtpExecutionError (0)143 except:144 log ('Mail Account not Disabled','error')145 log ('Disable Mail Account','testend')146 raise LdtpExecutionError (0)147def makedefault (account_name):148 log ('Make Mail account default','teststart')149 try:150 time.sleep (3)151 try:152 selectmenuitem ('frmEvolution-*','mnuEdit;mnuPreferences')153 waittillguiexist ('dlgEvolutionPreferences')154 index=verifyaccountexist (account_name)155 if index==-1: 156 raise LdtpExecutionError (0)157 selectrowpartialmatch ('dlgEvolutionPreferences','tblMailAccounts',account_name)158 time.sleep (2)159 except:160 log ('Account not present','cause')161 raise LdtpExecutionError (0)162 try:163 try:164 click ('dlgEvolutionPreferences','btnDefault')165 except:166 log ('Already Default','info')167 return168 time.sleep (2)169 name=getcellvalue ('dlgEvolutionPreferences','tblMailAccounts',index,1)170 desired_name=account_name+' '+'[Default]'171 if name == desired_name:172 log ('Set Default','pass')173 else:174 log ('Set Default','fail')175 except:176 log ('Unable to make account as default','error')177 raise LdtpExecutionError (0)178 except:179 log ('Make Account default failed','error')180 log ('Make Mail account default','testend')181 raise LdtpExecutionError (0)182 click ('dlgEvolutionPreferences','btnClose')183 log ('Make Mail account default','testend')184def restartevolution():185 log ('Restart Evolution','teststart')186 try:187 time.sleep (3)188 window_id = 'frmEvolution-*'189 remap ('evolution',window_id)190 selectmenuitem (window_id,'mnuFile;mnuQuit')191 waittillguinotexist (window_id)192 undoremap ('evolution',window_id)193 time.sleep (2)194 launchapp ('evolution',1)195 time.sleep (2)196 if guiexist (window_id) == 1:197 log ('Evolution Restarted successfully','info')198 else:199 log ('Evolution window not open','cause')200 raise LdtpExecutionError (0)201 except:202 log ('Restart evolution failed','error')203 log ('Restart Evolution','testend')204 raise LdtpExecutionError (0)...

Full Screen

Full Screen

movemail.py

Source:movemail.py Github

copy

Full Screen

1#2# Linux Desktop Testing Project http://ldtp.freedesktop.org3#4# Authors:5# Nagashree <mnagashree@novell.com>6# Premkumar <jpremkumar@novell.com>7# Khasim Shaheed <khasim.shaheed@gmail.com>8#9# Copyright 2004 Novell, Inc.10#11# This test script is free software; you can redistribute it and/or12# modify it under the terms of the GNU Library General Public13# License as published by the Free Software Foundation; either14# version 2 of the License, or (at your option) any later version.15#16# This library is distributed in the hope that it will be useful,17# but WITHOUT ANY WARRANTY; without even the implied warranty of18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU19# Library General Public License for more details.20#21# You should have received a copy of the GNU Library General Public22# License along with this library; if not, write to the23# Free Software Foundation, Inc., 59 Temple Place - Suite 330,24# Boston, MA 02111-1307, USA.25#26#Moving an existing Mail27import time28from ldtp import *29from evoutils.mail import *30# Section to select and move mail31def move_mail (from_fldr, to_fldr, mail_index):32 try:33 selectrowpartialmatch ('frmEvolution-*', 'ttblMailFolderTree', to_fldr)34 waittillguiexist ('frmEvolution-'+to_fldr+'*')35 time.sleep (2)36 row_before = getrowcount('frmEvolution-*', 'ttblMessages')37 selectrowpartialmatch ('frmEvolution-*', 'ttblMailFolderTree', from_fldr)38 waittillguiexist ('frmEvolution-'+from_fldr+'*')39 time.sleep (2)40 rowcount = getrowcount('frmEvolution-*', 'ttblMessages') 41 if rowcount > 0:42 if mail_index == -1:43 mail_index = rowcount-144 selectrowindex ('frmEvolution-*', 'ttblMessages', mail_index)45 time.sleep (1)46 selectmenuitem ('frmEvolution-*', 'mnuMessage;mnuMovetoFolder')47 if waittillguiexist ('dlgSelectfolder') == 0:48 log ('Select folder dialog not opened', 'error')49 raise LdtpExecutionError(0)50 selectrowpartialmatch ('dlgSelectfolder', 'ttblMailFolderTree', to_fldr)51 time.sleep (1)52 click ('dlgSelectfolder', 'btnMove')53 time.sleep (1)54 if waittillguinotexist ('dlgSelectfolder') == 0:55 log ('Select folder dialog not closed', 'error')56 raise LdtpExecutionError(0)57 else:58 # TODO: Moving a duplicate message has to be handled59 selectrowpartialmatch ('frmEvolution-*', 'ttblMailFolderTree',to_fldr)60 waittillguiexist ('frmEvolution-'+to_fldr+'*')61 time.sleep (2)62 row_after = getrowcount ('frmEvolution-*', 'ttblMessages')63 selectrowpartialmatch ('frmEvolution-*', 'ttblMailFolderTree', from_fldr)64 waittillguiexist ('frmEvolution-'+from_fldr+'*')65 time.sleep (2)66 rowcount_after_move = getrowcount('frmEvolution-*', 'ttblMessages')67 if row_after == (row_before+1) and rowcount == (rowcount_after_move+1):68 log ('Moving a mail passed successfully', 'info') 69 return 170 else:71 log ('Row count does not match after moving', 'cause')72 log ('Moving a mail failed', 'info')73 return 074 else:75 log ('From folder empty!', 'Warning')76 log ('Did not move any mails to other folder', 'info')77 return 078 except ldtp.error,msg:79 log ('Moving mail between folders failed ' + str(msg), 'cause')80 log ('Moving mail failed', 'fail')81 raise LdtpExecutionError (0)82 83# Read input from file84data_object = LdtpDataFileParser (datafilename)85from_fldr = data_object.gettagvalue ('from_fldr')86to_fldr = data_object.gettagvalue ('to_fldr')87mail_index = data_object.gettagvalue ('mail_index')88 89# Call the function90try:91 log ('Move a message', 'teststart')92 result = move_mail (from_fldr[0], to_fldr[0], int (mail_index[0]))93 if result == 1:94 log ('Move a message', 'pass')95 else:96 log ('Move a message', 'fail')97 log ('Move a message', 'testend')98except:99 log ('Move a message', 'error')100 log ('Move a message', 'testend')...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run pyatom automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful