Changeset 32713 for gs3-extensions


Ignore:
Timestamp:
2018-12-18T19:31:51+13:00 (5 years ago)
Author:
ak19
Message:

No longer passing around the FrameFixture window object between the test class and the testutil class of helper functions. The helper class (GSGUITestingUtil) keeps a reference to it, but it's still instantiated in the test class to ensure JUnit setup and teardown works normally on a per test basis (or however will turn out best when we finally get tutorial tests implemented).

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

Legend:

Unmodified
Added
Removed
  • gs3-extensions/testing/trunk/src/src/gstests/tutorials/RunGLITest.java

    r32705 r32713  
    129129      window = findFrame("GUIManager").using(robot());
    130130     
     131      GSGUITestingUtil.setWindow(window); // set this first before calling any of Util's other methods
     132     
    131133      String gatherPaneLabel = Dictionary.get("GUI.Gather");
    132134      System.err.println("@@@ Expecting label: " + gatherPaneLabel);
     
    142144      // attempt to switch to enrich pane, uses static methods of GSGUITestingUtil
    143145      // through static import of that class
    144       switchToPane(window, DOWNLOAD_PANE);
     146      switchToPane(DOWNLOAD_PANE);
    145147
    146148      // For testing, want GLI to be in librarian mode by default
    147       changeUserMode(window, "librarian");
     149      changeUserMode("librarian");
    148150
    149       switchToPane(window, GATHER_PANE);
     151      switchToPane(GATHER_PANE);
    150152     
    151       loadCollection(window, "lucene-jdbm-demo");
     153      loadCollection("lucene-jdbm-demo");
    152154
    153155      // wait a couple of seconds again?
    154156      PAUSE(2);     
    155       closeCollection(window);
     157      closeCollection();
    156158     
    157       createCollection(window, "pinky", "Pinky was here", null);
    158       closeCollection(window); // collection must be closed in order to be deleted
    159       deleteCollection(window, "pinky");
     159      createCollection("pinky", "Pinky was here", null);
     160      closeCollection(); // collection must be closed in order to be deleted
     161      deleteCollection("pinky");
    160162      // wait a few of seconds again?
    161163      PAUSE(2);
    162164     
    163       exportCollection(window, "GreenstoneMETS", "lucene-jdbm-demo");
     165      exportCollection("GreenstoneMETS", "lucene-jdbm-demo");
    164166
    165167      // Reset GLI to expert mode for regular GLI use
    166       changeUserMode(window, "expert");
     168      changeUserMode("expert");
    167169     
    168170      PAUSE(5);
    169       //exitGLI(window);
     171      //exitGLI();
    170172     
    171       switchToPane(window, GATHER_PANE);
     173      switchToPane(GATHER_PANE);
    172174  }
    173175
  • gs3-extensions/testing/trunk/src/src/org/greenstone/gsdl3/testing/GSGUITestingUtil.java

    r32705 r32713  
    2323public class GSGUITestingUtil
    2424{
     25    public static FrameFixture window = null;
     26   
    2527    public static final boolean PAUSE_ON = true;
    2628   
     
    3335    public static final String CREATE_PANE = "Create";
    3436    public static final String FORMAT_PANE = "Format";
    35 
     37   
    3638   
    3739    /************** NEEDED FOR TESTING *************/
     
    4143
    4244    /************************ GENERAL *******************************/
     45
     46    public static void setWindow(FrameFixture w) { window = w; }
     47   
    4348    public static void PAUSE() {   
    4449    PAUSE(5);
     
    5762   
    5863    //https://joel-costigliola.github.io/assertj/swing/api/org/assertj/swing/fixture/FrameFixture.html
    59     public static void switchToPane(FrameFixture window, String pane) {
     64    public static void switchToPane(String pane) {
    6065    String paneLabel = Dictionary.get("GUI." + pane); // e.g. GUI.Enrich
    6166    //JPanelFixture tab = window.panel(pane); // this just gets us the JPanel of controls within
     
    6368    tab.selectTab(paneLabel); // select tab by its title
    6469    }
    65     public static void openMenuItem(FrameFixture window, String menu, String subMenu) {
     70    public static void openMenuItem(String menu, String subMenu) {
    6671    /*String menuLabel = Dictionary.get("Menu." + menu); // e.g. Menu.File
    6772    window.menuItem(menuLabel).click(); //JMenuItemFixture.click()
     
    7378
    7479    /*
    75     public static void stealAnyLock(FrameFixture window) {
     80    public static void stealAnyLock() {
    7681    DialogFixture dialog = window.dialog("LockFileDialog");
    7782    if(dialog != null) {
     
    8691   
    8792    /**********************FILE MENU*******************************/
    88     public static void setPrefs(FrameFixture window, String tab, Map params) {
    89     openMenuItem(window, "file", "options");
     93    public static void setPrefs(String tab, Map params) {
     94    openMenuItem("file", "options");
    9095
    9196    }
     
    95100     * Choose from Preferences.Mode.Assistant, Preferences.Mode.Librarian, Preferences.Mode.Expert
    96101     */
    97     public static void changeUserMode(FrameFixture window, String toMode) {
    98     openMenuItem(window, "file", "options"); // click MenuBar.file -> MenuBar.file_options
     102    public static void changeUserMode(String toMode) {
     103    openMenuItem("file", "options"); // click MenuBar.file -> MenuBar.file_options
    99104
    100105    // switch to Mode tab
     
    117122    }
    118123
    119     public static void exitGLI(FrameFixture window) {
    120     openMenuItem(window, "file", "exit");
     124    public static void exitGLI() {
     125    openMenuItem("file", "exit");
    121126    PAUSE(5);
    122127    }
    123128   
    124     public static void closeCollection(FrameFixture window){
     129    public static void closeCollection(){
    125130    // Through componennt names, clicks on MenuBar.file then MenuBar.file_close
    126     openMenuItem(window, "file", "close");
    127     }
    128 
    129     public static void deleteCollection(FrameFixture window, String collName) {
    130     openMenuItem(window, "file", "delete");
     131    openMenuItem("file", "close");
     132    }
     133
     134    public static void deleteCollection(String collName) {
     135    openMenuItem("file", "delete");
    131136    DialogFixture dialog = window.dialog("DeleteCollectionPrompt"); // could call window.dialg() too as there will be only one, unless GLI run in debug mode?
    132137   
     
    147152    }
    148153   
    149     public static void saveCollection(FrameFixture window) {
    150     openMenuItem(window, "file", "save"); // MenuBar.file -> MenuBar.file_save
    151     }
    152 
    153     public static void createCollection(FrameFixture window,
    154                     String collTitle, String collDescription, String baseColl)
     154    public static void saveCollection() {
     155    openMenuItem("file", "save"); // MenuBar.file -> MenuBar.file_save
     156    }
     157
     158    public static void createCollection(String collTitle, String collDescription, String baseColl)
    155159    {
    156     openMenuItem(window, "file", "new");
     160    openMenuItem("file", "new");
    157161    DialogFixture dialog = window.dialog("col"); // GLI is unable to setName() of this dialog
    158162    // to NewCollectioNDetailsPrompt. Not sure why.
     
    174178    }
    175179
    176     public static void loadCollection(FrameFixture window, String collName) {
    177     openMenuItem(window, "file", "open");
     180    public static void loadCollection(String collName) {
     181    openMenuItem("file", "open");
    178182    DialogFixture dialog = window.dialog("OpenCollectionDialog");
    179183    JListFixture collection_list = dialog.list("OpenCollectionDialog.collection_list");
     
    220224     * not public collection name like "Demo Collection".
    221225     */
    222     public static void exportCollection(FrameFixture window, String exportToFormat, String exportColl)
     226    public static void exportCollection(String exportToFormat, String exportColl)
    223227    {
    224     openMenuItem(window, "file", "exportas"); // Clicks MenuBar.file -> MenuBar.file_exportas
     228    openMenuItem("file", "exportas"); // Clicks MenuBar.file -> MenuBar.file_exportas
    225229
    226230    DialogFixture dialog = window.dialog("ExportAsPrompt");
Note: See TracChangeset for help on using the changeset viewer.