summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprashmohan <prashmohan>2006-06-19 17:18:34 +0000
committerprashmohan <prashmohan>2006-06-19 17:18:34 +0000
commit6098ec3a5bb6e3d9475cedf994d5af6b988c6d6e (patch)
tree59d22e8e4fbfdb00ffb634603b25bf2a86b4bf9d
parente1def19b689538519d476ca0855974bc7e657723 (diff)
adding nags's gedit scripts
-rw-r--r--gedit/README39
-rw-r--r--gedit/click-cancel-opendialog.py117
-rw-r--r--gedit/click-cancel-saveas.py66
-rw-r--r--gedit/create-new-file.py103
-rwxr-xr-xgedit/gedit.py99
-rw-r--r--gedit/run.xml21
6 files changed, 350 insertions, 95 deletions
diff --git a/gedit/README b/gedit/README
new file mode 100644
index 0000000..a7cf9ec
--- /dev/null
+++ b/gedit/README
@@ -0,0 +1,39 @@
+Welcome! We have provided sample Gedit test scripts for you to take a look at what LDTP can do for you.
+
+Version Summary:
+
+LDTP 0.2.1 (With Localiaztion support)
+Gedit 2.12.0
+
+How to use this:
+
+* Install LDTP
+
+* This example includes the following test cases
+ i. Open a new file, add some text and save it.
+ ii. Open saveas dialog and click cancel
+ iii. Open Fileopen dialog and click cancel
+
+* Open gedit. Make sure its opened in the default state with the title as "Unsaved Document 1 - gedit". If any other document is open please close them all and click File->New once to bring it to the required state.
+
+* Execute the following command from the directory where you have these samples. By default it will be in <LDTP-HOME>/EXAMPLES/gedit
+ $ gldap.py gedit-execution.xml
+
+* After the tests are over you should be able to see gedit.log file which has the log output for the tests undertaken in xml format.
+
+Hints for using with locales other than English:
+
+* Make sure LANG varaiable is set appropriately.
+
+* Edit gedit.py file with proper path for mo files required.
+
+* Make sure LANG variable is set in the terminal where you start the testing by invoking gldap.py or use as given below
+ $ LANG=<appropriate-value> gldap.py gedit-execution.xml
+
+References:
+
+If you have any queries please use the following references to let us know
+
++ http://www.gnomebangalore.org/ldtp
++ Our mailing list -> ldtp-dev@lists.freedesktop.org
++ Join us in IRC #ldtp at irc.gimp.org \ No newline at end of file
diff --git a/gedit/click-cancel-opendialog.py b/gedit/click-cancel-opendialog.py
new file mode 100644
index 0000000..5bef6c0
--- /dev/null
+++ b/gedit/click-cancel-opendialog.py
@@ -0,0 +1,117 @@
+#
+# Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
+#
+# Author:
+# Aishoo Team, Fasila
+# A. Nagappan <anagappan@novell.com>
+# J. Premkumar <jpremkumar@novell.com>
+#
+# Copyright 2004 Novell, Inc.
+#
+# This library 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.
+#
+
+# Click cancel in save as dialog box, after selecting a file
+
+from ldtp import *
+from ldtputils import *
+import string, sys, os, commands, time, filecmp
+
+default_dir = os.getcwd ()
+default_image_dir = default_dir + '/images'
+default_doc_dir = default_dir + '/doc'
+default_tmp_dir = default_dir + '/tmp'
+gedit_exe_path = 'gedit'
+
+if os.access (default_tmp_dir, os.F_OK | os.R_OK | os.W_OK | os.X_OK) == 0:
+ os.mkdir (default_tmp_dir)
+
+log ('Click Cancel In Save As Dialog Box', 'teststart')
+try:
+ #setcontext ('Unsaved Document 1 - gedit', 'gedit')
+ selectmenuitem ('*gedit', 'mnuFile;mnuOpen')
+
+ # Wait for 3 seconds, let the open dialog box window appear
+ #time.sleep (3)
+
+ if waittillguiexist ('dlgOpenFiles...') == 1:
+ # TODO
+ try:
+ time.sleep (1)
+ selectrow ('dlgOpenFiles...', 'tblFiles', 'EXAMPLES')
+ click ('dlgOpenFiles...', 'btnOpen')
+ except LdtpExecutionError:
+ None
+ try:
+ time.sleep (1)
+ selectrow ('dlgOpenFiles...', 'tblFiles', 'gedit')
+ click ('dlgOpenFiles...', 'btnOpen')
+ except LdtpExecutionError:
+ None
+ try:
+ time.sleep (1)
+ selectrow ('dlgOpenFiles...', 'tblFiles', 'tmp')
+ click ('dlgOpenFiles...', 'btnOpen')
+ except LdtpExecutionError:
+ None
+ time.sleep (1)
+ # - Once GTK File Selector bug is resolved try to select some file from Filesystem shortcuts
+ selectrow ('dlgOpenFiles...', 'tblFiles', 'sample.txt')
+ # TODO
+ # - Check if file does not exist
+ click ('dlgOpenFiles...', 'btnOpen')
+
+ if waittillguinotexist ('dlgOpenFiles...') == 0:
+ log ('Open dialog box appears after opening file', 'error')
+ log ('Click Cancel In Save As Dialog Box', 'fail')
+ else:
+ # TODO
+ # Check if file opened successfully
+ # Wait for 2 seconds, Let the file be loaded
+ time.sleep (2)
+ mo = re.match (os.path.expandvars ('$HOME'), default_tmp_dir)
+ if str(mo) != "<type 'NoneType'>":
+ newcontext = '~' + default_tmp_dir [mo.end():]
+ else:
+ newcontext = default_tmp_dir
+ #releasecontext ()
+ #setcontext ('Unsaved Document 1 - gedit', 'sample.txt ' + '(' + newcontext + ') - gedit')
+ selectmenuitem ('*gedit', 'mnuFile;mnuSaveAs')
+ # Wait for 2 seconds, Let the file be loaded
+ time.sleep (2)
+ if guiexist ('dlgSaveAs...') == 1:
+ # btncancel is not working (hanged) - comment by fasila
+ click ('dlgSaveAs...', 'btnCancel')
+ # Wait for 2 seconds, Let the file be loaded
+ time.sleep (2)
+ if waittillguinotexist ('dlgSaveAs...') == 1:
+ log ('Click Cancel In Save As Dialog Box', 'pass')
+ else:
+ log ('Save As dialog box still appears', 'error')
+ log ('Click Cancel In Open Dialog Box', 'fail')
+ else:
+ log ('Save As dialog box does not appear', 'error')
+ log ('Click Cancel In Save As Dialog Box', 'fail')
+ else:
+ log ('Open dialog box does not appear', 'error')
+ log ('Click Cancel In Save As Dialog Box', 'fail')
+ #releasecontext ()
+ selectmenuitem ('*gedit','mnuFile;mnuQuit')
+except error, msg:
+ #releasecontext ()
+ log (str (msg), 'error')
+ log ('Click Cancel In Save As Dialog Box', 'fail')
+log ('Click Cancel In Save As Dialog Box', 'testend')
diff --git a/gedit/click-cancel-saveas.py b/gedit/click-cancel-saveas.py
new file mode 100644
index 0000000..ce8c45b
--- /dev/null
+++ b/gedit/click-cancel-saveas.py
@@ -0,0 +1,66 @@
+#
+# Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
+#
+# Author:
+# Aishoo Team, Fasila
+# A. Nagappan <anagappan@novell.com>
+# J. Premkumar <jpremkumar@novell.com>
+#
+# Copyright 2004 Novell, Inc.
+#
+# This library 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.
+#
+
+# Click cancel in open dialog box, after selecting a file
+from ldtp import *
+from ldtputils import *
+import string, sys, os, commands, time, filecmp
+
+default_dir = os.getcwd ()
+default_image_dir = default_dir + '/images'
+default_doc_dir = default_dir + '/doc'
+default_tmp_dir = default_dir + '/tmp'
+gedit_exe_path = 'gedit'
+
+if os.access (default_tmp_dir, os.F_OK | os.R_OK | os.W_OK | os.X_OK) == 0:
+ os.mkdir (default_tmp_dir)
+
+
+log ('Click Cancel In Open Dialog Box', 'teststart')
+try:
+ #setcontext ('Unsaved Document 1 - gedit', 'gedit')
+ selectmenuitem ('*gedit', 'mnuFile;mnuOpen')
+
+ # Wait for 3 seconds, let the open dialog box window appear
+ time.sleep (3)
+
+ if guiexist ('dlgOpenFiles...') == 1:
+ # TODO
+ # - Once GTK File Selector bug is resolved try to select some file from Filesystem shortcuts
+ click ('dlgOpenFiles...', 'btnCancel')
+ time.sleep (2)
+ if guiexist ('dlgOpenFiles...') == 0:
+ log ('Click Cancel In Open Dialog Box', 'pass')
+ else:
+ log ('Open dialog box still appears', 'error')
+ log ('Click Cancel In Open Dialog Box', 'fail')
+ else:
+ log ('Open dialog box does not appear', 'error')
+ log ('Click Cancel In Open Dialog Box', 'fail')
+except error, msg:
+ log (str(msg), 'error')
+ log ('Click Cancel In Open Dialog Box', 'fail')
+log ('Click Cancel In Open Dialog Box', 'testend')
diff --git a/gedit/create-new-file.py b/gedit/create-new-file.py
new file mode 100644
index 0000000..5e5e4b0
--- /dev/null
+++ b/gedit/create-new-file.py
@@ -0,0 +1,103 @@
+#
+# Linux Desktop Testing Project http://www.gnomebangalore.org/ldtp
+#
+# Author:
+# Aishoo Team, Fasila
+# A. Nagappan <anagappan@novell.com>
+# J. Premkumar <jpremkumar@novell.com>
+#
+# Copyright 2004 Novell, Inc.
+#
+# This library 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.
+#
+
+# Create a new document and save it
+from ldtp import *
+from ldtputils import *
+import string, sys, commands, time, filecmp
+import re, os
+
+default_dir = os.getcwd ()
+default_image_dir = default_dir + '/images'
+default_doc_dir = default_dir + '/doc'
+default_tmp_dir = default_dir + '/tmp'
+gedit_exe_path = 'gedit'
+
+if os.access (default_tmp_dir, os.F_OK | os.R_OK | os.W_OK | os.X_OK) == 0:
+ os.mkdir (default_tmp_dir)
+
+log ('Create New Document', 'teststart')
+
+try:
+ try:
+ # Close all opened tab
+ selectmenuitem ('*-gedit', 'mnuDocuments;mnuCloseAll')
+ except error:
+ log ('There maybe no documents opened', 'info')
+
+ #setcontext ('Unsaved Document 1 - gedit', 'gedit')
+ selectmenuitem ('*gedit', 'mnuFile;mnuNew')
+ #releasecontext ()
+ # TODO
+ # - Verify new document window is opened
+ # - Get text from pre-defined file maybe from default_doc_dir and use it in settextvalue function
+ settextvalue ('*gedit', 'txt0', 'Testing gedit using GNU/Linux Desktop Testing Project')
+
+ # TODO
+ # - Verify text content placed properly
+ #setcontext ('Unsaved Document 1 - gedit', '*Unsaved Document 1 - gedit')
+ selectmenuitem ('*gedit', 'mnuFile;mnuSaveAs')
+
+ # Wait for 3 seconds, so that save as dialog window will appear
+ time.sleep (3)
+
+ # Check for dialog window
+ if waittillguiexist ('dlgSaveAs...') == 1:
+ #remap ('gedit','dlgSaveas')
+ settextvalue ('dlgSaveAs...', 'txtName', default_tmp_dir + '/sample.txt')
+ click ('dlgSaveAs...', 'tbtnBrowseforotherfolders')
+ selectrowindex ('dlgSaveAs...', 'tblShortcuts', 0)
+ click ('dlgSaveAs...', 'btnSave')
+ time.sleep (3)
+ if guiexist ('*Question') == 1:
+ click ('*Question', 'btnReplace')
+ #undoremap ('gedit','dlgSaveas')
+ #releasecontext ()
+ mo = re.match (os.path.expandvars ('$HOME'), default_tmp_dir)
+ if str(mo) != "<type 'NoneType'>":
+ newcontext = '~' + default_tmp_dir [mo.end():]
+ else:
+ newcontext = default_tmp_dir
+ waittillguinotexist ('dlgQuestion')
+ waittillguinotexist ('dlgSaveAs...')
+ time.sleep (5)
+ #setcontext ('Unsaved Document 1 - gedit', 'sample.txt ' + '(' + newcontext + ') - gedit')
+ selectmenuitem ('*gedit', 'mnuDocuments;mnuCloseAll')
+ # TODO
+ # - Verify saved text file content using compare function
+ log ('Create New Document', 'pass')
+ #releasecontext ()
+ #setcontext ('Unsaved Document 1 - gedit', 'gedit')
+ else:
+ log ('Save dialog does not appear', 'error')
+ log ('Create New Document', 'fail')
+except error, msg:
+ #releasecontext ()
+ #setcontext ('Unsaved Document 1 - gedit', 'gedit')
+ log (str (msg), 'error')
+ log ('Create New Document', 'fail')
+
+log ('Create New Document', 'testend')
diff --git a/gedit/gedit.py b/gedit/gedit.py
index da1abff..4bf5bc9 100755
--- a/gedit/gedit.py
+++ b/gedit/gedit.py
@@ -5,6 +5,7 @@
# Author:
# Aishoo, Fasila
# A. Nagappan <anagappan@novell.com>
+# J. Premkumar <jpremkumar@novell.com>
#
# Copyright 2004 Novell, Inc.
#
@@ -34,100 +35,8 @@ default_image_dir = default_dir + '/images'
default_doc_dir = default_dir + '/doc'
default_tmp_dir = default_dir + '/tmp'
gedit_exe_path = 'gedit'
+launchapp ('gedit',1)
+#bindtext ('gedit', '/opt/gnome/share/locale')
+#bindtext ('gtk20', '/opt/gnome/share/locale')
-startlog ('gedit-execution.xml', 1)
-log ('Gedit Test Report', 'begin')
-
-if len (sys.argv) == 1:
- if os.access ('./gedit.map', os.F_OK | os.R_OK) == 0:
- log ('Appmap path missing', 'error')
- log ('Gedit Test Report', 'end')
- stoplog ()
- sys.exit(0);
- else:
- appmap_path = '.'
-else:
- appmap_path = sys.argv[1]
-
-initappmap (appmap_path + '/gedit.map')
-
-if os.access (default_tmp_dir, os.F_OK | os.R_OK | os.W_OK | os.X_OK) == 0:
- os.mkdir (default_tmp_dir)
-
-try:
- execfile ('launch.py')
-except LdtpExecutionError:
- log ('Unable to launch gedit', 'Error')
- log ('Gedit Test Report', 'end')
- stoplog ()
- sys.exit (0)
-
-time.sleep (5)
-
-#to create a new document and can be saved in gedit.
-execfile ('gedit02.py')
-#time.sleep (3)
-#to open and edit an existing document in gedit.
-execfile ('gedit03.py')
-time.sleep (3)
-#to cancel the operation 'open a file' after the operation was initiated. .
-execfile ('gedit04.py')
-time.sleep (3)
-#to cancel the operation 'Save as' after the operation was initiated. .
-execfile ('gedit05.py')
-time.sleep (3)
-#to print preview and print a document in gedit.
-execfile ('gedit06.py')
-log ('Gedit Test Report', 'end')
-stoplog ()
-sys.exit (0)
-time.sleep (3)
-#to close the currently opened document in gedit .
-execfile ('gedit07.py')
-time.sleep (3)
-#to save all the currently open and modified documents in gedit even if one of those documents is a new document
-#execfile ('gedit08.py')
-time.sleep (3)
-#to close all the documents that are opened currently in gedit.
-execfile ('gedit09.py')
-time.sleep (3)
-#to open a document from URL.
-execfile ('gedit10.py')
-sys.exit (0)
-time.sleep (3)
-#to cancel the operation 'Open a document from URL' after it was initiated.
-execfile ('gedit11.py')
-time.sleep (3)
-#to revert to a saved version of a currently opened document.
-execfile ('gedit12.py')
-time.sleep (3)
-#to 'undo' or 'redo' changes made to a document in gedit.
-execfile ('gedit13.py')
-time.sleep (3)
-#to highlight the contents of the currently opened document.
-execfile ('gedit14.py')
-time.sleep (3)
-# to copy and paste text in gedit.
-execfile ('gedit15.py')
-time.sleep (3)
-#to cut and paste text in gedit.
-execfile ('gedit16.py')
-time.sleep (3)
-# to do a search for any specified word/phrase in the currently opened document in gedit.
-execfile ('gedit17.py')
-time.sleep (3)
-#to replace any word/phrase in the currently opened document with another word/phrase in gedit.
-execfile ('gedit18.py')
-time.sleep (3)
-#to go to any line in the currently opened document..
-execfile ('gedit19.py')
-time.sleep (3)
-#to view installed & uninstalled plugins in gedit.
-execfile ('gedit20.py')
-time.sleep (3)
-#to view information about any currently available(installed or uninstalled ) plugins in gedit .
-execfile ('gedit21.py')
-time.sleep (3)
-
-log ('Gedit Test Report', 'end')
diff --git a/gedit/run.xml b/gedit/run.xml
new file mode 100644
index 0000000..be282ff
--- /dev/null
+++ b/gedit/run.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<ldtp>
+ <logfileoverwrite>1</logfileoverwrite>
+ <logfile>gedit-log.xml</logfile>
+ <group>
+ <script>
+ <name>gedit.py</name>
+ </script>
+ <script>
+ <name>create-new-file.py</name>
+ </script>
+ </group>
+ <group>
+ <script>
+ <name>click-cancel-saveas.py</name>
+ </script>
+ <script>
+ <name>click-cancel-opendialog.py</name>
+ </script>
+ </group>
+</ldtp>