Changeset 32694 for gs3-extensions


Ignore:
Timestamp:
12/16/18 20:36:15 (2 years ago)
Author:
ak19
Message:

Started implementing GSGUITestingUtil.java and simultaneously testing it out. To compile it now needs GLI.jar in classpath which also needs GS3 env script run, so update to build.xml as well.

Location:
gs3-extensions/testing/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • gs3-extensions/testing/trunk/src/build.xml

    r32688 r32694  
    77  <property name="gli.home" value="${env.GSDL3SRCHOME}/gli"/>
    88 
    9   <target name="build-util-jar">
     9  <target name="build-util-jar" depends="needs-gs3-setup, needs-make-gli-jar">
    1010    <mkdir dir="${basedir}/build"/>
    1111    <javac srcdir="${basedir}/src"
     
    1616      <include name="*.jar"/>
    1717    </fileset>
     18    <fileset dir="${gli.home}">
     19    <include name="GLI.jar"/>
     20      </fileset>
    1821      </classpath>
    1922      <include name="org/greenstone/gsdl3/testing/*.java"/>         
  • gs3-extensions/testing/trunk/src/src/gstests/tutorials/RunGLITest.java

    r32693 r32694  
    6868import static org.assertj.swing.launcher.ApplicationLauncher.*;
    6969import static org.assertj.swing.finder.WindowFinder.findFrame;
     70
     71import static org.greenstone.gsdl3.testing.GSGUITestingUtil.*;
    7072
    7173public class RunGLITest extends AssertJSwingJUnitTestCase {
     
    140142    tab.requireSelectedTab(Index.atIndex(1));
    141143    tab.requireTitle(gatherPaneLabel, Index.atIndex(1));
     144
     145    // attempt to switch to enrich pane, uses static methods of GSGUITestingUtil
     146    // through static import of that class
     147    switchToPane(window, DOWNLOAD_PANE);
     148   
    142149  }
    143150
  • gs3-extensions/testing/trunk/src/src/org/greenstone/gsdl3/testing/GSGUITestingUtil.java

    r32693 r32694  
    88import org.assertj.swing.fixture.*;
    99
     10// GLI imports
     11import org.greenstone.gatherer.Gatherer;
     12import org.greenstone.gatherer.GathererProg; // main GLI class we'll be testing
     13import org.greenstone.gatherer.Dictionary; // access to display strings
     14
    1015/*
    11  *
     16 * Utility class containing helper functions for GLI GUI testing using AsssertJ Swing
    1217*/
    1318
    1419public class GSGUITestingUtil
    15 {
     20{
     21    public static final String DOWNLOAD_PANE = "GUI.Download";
     22    public static final String GATHER_PANE = "GUI.Gather";
     23    public static final String ENRICH_PANE = "GUI.Enrich";
     24    public static final String DESIGN_PANE = "GUI.Design";
     25    public static final String CREATE_PANE = "GUI.Create";
     26    public static final String FORMAT_PANE = "GUI.Format";
    1627   
    17    
    18     public static final String DOWNLOAD_PANE = "DownloadPane";
    19     public static final String GATHER_PANE = "GatherPane";
    20     public static final String ENRICH_PANE = "EnrichPane";
    21     public static final String DESIGN_PANE = "DesignPane";
    22     public static final String CREATE_PANE = "CreatePane";
    23     public static final String FORMAT_PANE = "FormatPane";
    24 
    2528    /************** NEEDED FOR TESTING *************/
    2629    // There's now a new method in GLI: GUIManager.setNamesRecursively()
     
    3134    //https://joel-costigliola.github.io/assertj/swing/api/org/assertj/swing/fixture/FrameFixture.html
    3235    public static void switchToPane(FrameFixture window, String pane) {
    33     //JTabbedPaneFixture tab = window.tabbedPane("GUIManager.tab_pane");
    34     JPanelFixture tab = window.panel(pane);
     36    String paneLabel = Dictionary.get(pane); // e.g. GUI.Enrich
     37    //JPanelFixture tab = window.panel(pane); // this just gets us the JPanel of controls within
     38    JTabbedPaneFixture tab = window.tabbedPane("GUIManager.tab_pane");
     39    tab.selectTab(paneLabel); // select tab by its title
    3540    }
    3641    public static void getMenu(String menu, String subMenu) {}
Note: See TracChangeset for help on using the changeset viewer.