Index: /gs3-extensions/testing/trunk/README_2024
===================================================================
--- /gs3-extensions/testing/trunk/README_2024	(revision 39017)
+++ /gs3-extensions/testing/trunk/README_2024	(revision 39018)
@@ -1,8 +1,30 @@
----------------------------
-Notes written 2024:
----------------------------
-I'm not sure what I read on junits, assertj swing and (if anything) on selenium to start off the automated gli testing work back in 2018, but here's what I can gather from current code.
+-------------------------------------------------------------
+README Notes written 2024
+(AssertJ Swing GLI GUI testing groundwork laid in 2018-2019)
+-------------------------------------------------------------
 
-But the following may be useful websites
+Sections
+I Code Layout
+II Background Reading
+III Compiling and Running
+
+
+-------------------
+CODE LAYOUT
+-------------------
+- ext/testing/src/src/org/greenstone/gsdl3/testing/GSGUIUtil.java (Selenium, browser testing helper functions, needs revisiting in 2024)
+- ext/testing/src/src/org/greenstone/gsdl3/testing/GSGUITestingUtil.java (AssertJ Swing, GUI testing helper functions)
+- ext/testing/src/src/gstests/tutorials/RunGLITest.java (tests, rudimentary stage of testing the basic GUI helper functions above)
+
+
+-------------------
+BACKGROUND READING
+-------------------
+See the comments section at the top of ext/testing/src/src/gstests/tutorials/RunGLITest.java
+It lists the URLs and reading that I went through pertaining to junits, assertj swing and (if anything) on selenium to start off the automated gli testing work back in 2018.
+
+I can further gather the following from the current code.
+
+The following may be useful websites
 - interspersed throughout our code that uses assert swing, I find I'd added references to this website: https://joel-costigliola.github.io/assertj/assertj-swing-basics.html
 
@@ -12,5 +34,7 @@
 - there's also the older wiki page by Sam that has his own work (not yet incorporated): https://wiki.greenstone.org/doku.php?id=internal:gs3_automated_testing
 
-
+----------------------
+COMPILING AND RUNNING
+----------------------
 0. Have a fresh GS3, preferrably a code checkout from SVN so that you can tweak the code on any errors.
 
Index: /gs3-extensions/testing/trunk/src/src/gstests/tutorials/RunGLITest.java
===================================================================
--- /gs3-extensions/testing/trunk/src/src/gstests/tutorials/RunGLITest.java	(revision 39017)
+++ /gs3-extensions/testing/trunk/src/src/gstests/tutorials/RunGLITest.java	(revision 39018)
@@ -68,5 +68,5 @@
 import javax.swing.*;
 
-// static imports
+// static imports - call static functions without class as namespace qualifier
 import static org.greenstone.gsdl3.testing.GSGUITestingUtil.*;
 
@@ -82,4 +82,14 @@
     private FrameFixture window;
 
+    // https://stackoverflow.com/questions/50815329/close-application-after-test-without-test-failure-using-assertj
+    // https://stackoverflow.com/questions/23139321/testing-java-gui-application-closing-window-during-test-ends-test-suite
+    // https://stackoverflow.com/questions/5401281/preventing-system-exit-from-api
+    /*
+    @BeforeClass
+    public static void initOnce() {
+	// to prevent system.exit from causing issues
+	org.assertj.swing.security.NoExitSecurityManagerInstaller.installNoExitSecurityManager();	
+    }
+    */
     // Selenium
     @Before
@@ -99,4 +109,5 @@
     @Override
     protected void onSetUp() {
+	System.err.println("#### onSetUp called - running GLI");
 	// Launch GLI and then get a ref to the launched app window:
 	runGLI();
@@ -111,20 +122,9 @@
   @Test
   public void testGLIRunning() {
-
-	
       // waiting a few seconds for window, so we can see it
-      PAUSE(2);      
-    
+      PAUSE(2);
+
       System.err.println("@@@ First test: GLI Running");
-
-      /*
-      // See "Testing long duration tasks" at
-      // https://joel-costigliola.github.io/assertj/assertj-swing-lookup.html	
-      DialogFixture lockfileDialog = WindowFinder.findDialog("LockFileDialog").using(robot());//new DialogFixture(robot(), "LockFileDialog"); //window.dialog("LockFileDialog", Timeout.timeout(1));
-      if(lockfileDialog != null) {
- 	  lockfileDialog.click(); // bring to foreground in case JProgressBar hides it
-	  lockfileDialog.button("LockFileDialog.ok_button").click();	  
-      }
-      */
+      
       // steal any collection lock that may or may not presents itself within param seconds
       stealAnyCollectionLock(1);
@@ -150,5 +150,5 @@
       // For testing, want GLI to be in librarian mode by default
       changeUserMode("librarian");
-
+      
       switchToPane(GATHER_PANE);
       
@@ -166,5 +166,5 @@
       
       exportCollection("GreenstoneMETS", "lucene-jdbm-demo");
-
+      
       // Reset GLI to expert mode for regular GLI use
       changeUserMode("expert");
@@ -172,9 +172,32 @@
       PAUSE(2);      
       
-      switchToPane(GATHER_PANE);
-
-      //exitGLI(); //System.exit() on GLI won't allow quit to be called on Selenium's web _driver, why?
+      switchToPane(GATHER_PANE);      
+
+      exitGLI(); //System.exit() on GLI won't allow quit to be called on Selenium's web _driver, why? Because System.exit exited the JUnit tests too
+      
       PAUSE(3);
   }
+
+
+    @Test
+    public void tutorial_tests() {
+	/*
+	// Preliminaries
+	// waiting a few seconds for window, so we can see GLI running
+	PAUSE(2);
+	
+	System.err.println("@@@ First test: GLI Running");
+	
+	// steal any collection lock that may or may not presents itself within param seconds
+	stealAnyCollectionLock(1);
+	switchToPane(GATHER_PANE);
+
+	// dummy tests
+	testGLIRunning();
+	*/
+	// First tutorial
+	simpleHTML();
+	
+    }
 
     // Selenium
@@ -185,4 +208,17 @@
 	abortListener.unregister(); // aborting assertJ-swing GUI tests
 	_driver.quit();
-    }
+	//After exiting your application uninstall the no exit security manager
+	//org.assertj.swing.security.NoExitSecurityManagerInstaller.installNoExitSecurityManager().uninstall();
+    }
+
+    /****************************** TUTORIAL FUNCTIONS  *******************************/
+    // Tutorial functions: regular methods called by JUnit at-Test methods in sequence
+    // to ensure sequential ordering of tests
+    public void simpleHTML() {
+	System.err.println("@@@ Tutorial 1: simple HTML");	
+	stealAnyCollectionLock(1);
+	switchToPane(GATHER_PANE);
+	changeUserMode("librarian");
+    }
+    
 }
Index: /gs3-extensions/testing/trunk/src/src/org/greenstone/gsdl3/testing/GSGUITestingUtil.java
===================================================================
--- /gs3-extensions/testing/trunk/src/src/org/greenstone/gsdl3/testing/GSGUITestingUtil.java	(revision 39017)
+++ /gs3-extensions/testing/trunk/src/src/org/greenstone/gsdl3/testing/GSGUITestingUtil.java	(revision 39018)
@@ -113,8 +113,17 @@
     // Gets a ref to the main window (FrameFixture) of a running GLI
     public static FrameFixture getGLIApplicationWindow(Robot robotParam) {
+	return getGLIApplicationWindow(robotParam, -1);
+    }
+
+    // Gets a ref to the main window (FrameFixture) of a running GLI
+    public static FrameFixture getGLIApplicationWindow(Robot robotParam, int waitTime) {
 	GSGUITestingUtil.robot = robotParam; // store
-	
+
 	// locate and set the internal FrameFixture member variable 'window' and return a handle to it
-	window = findFrame("GUIManager").using(robot); // GLI application JFrame's name is set to its classname, 'GUIManager'
+	if(waitTime <= 0) {
+	    window = findFrame("GUIManager").using(robot); // GLI application JFrame's name is set to its classname, 'GUIManager'
+	} else {	
+	    window = findFrame("GUIManager").withTimeout(waitTime*SECOND).using(robot);
+	}
 
 	// https://joel-costigliola.github.io/assertj/swing/api/index.html?org/assertj/swing/launcher/ApplicationLauncher.html
@@ -295,18 +304,4 @@
 	//steal any lock
 	//PAUSE(3);
-	// See "Testing long duration tasks" at
-	// https://joel-costigliola.github.io/assertj/assertj-swing-lookup.html
-
-	    /*
-	try {
-	    DialogFixture lockfileDialog = findDialog("LockFileDialog").using(robot);//window.dialog("LockFileDialog");
-	    if(lockfileDialog != null) {
-		lockfileDialog.click(); // bring to foreground in case JProgressBar hides it
-		lockfileDialog.button("LockFileDialog.ok_button").click();
-	    }
-	} catch(Exception e) {
-	    System.err.println("@@@@@@@@@@@@@ No lockfile dialog");
-	}
-	    */
 	stealAnyCollectionLock(1);
     }
@@ -418,5 +413,5 @@
     }
     
-    // Moving these working bits of code here, in case I can use them to right
+    // Moving these working bits of code here, in case I can use them to write
     // general get methods that make use of the GenericTypeMatcher method of accessing components
     // See https://joel-costigliola.github.io/assertj/assertj-swing-lookup.html
