source: gs3-extensions/testing/trunk/src/src/org/greenstone/gsdl3/testing/GSGUITestingUtil.java@ 32693

Last change on this file since 32693 was 32693, checked in by ak19, 5 years ago

Some cleanup and shifting commented out useful code about

File size: 5.4 KB
Line 
1package org.greenstone.gsdl3.testing;
2
3import java.util.Map;
4import java.awt.Component;
5
6// only JUnit and JAssert-Swing, no Selenium in this class
7import org.junit.Assert;
8import org.assertj.swing.fixture.*;
9
10/*
11 *
12*/
13
14public class GSGUITestingUtil
15{
16
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
25 /************** NEEDED FOR TESTING *************/
26 // There's now a new method in GLI: GUIManager.setNamesRecursively()
27 // that attempts to recursively call setName() on visible GUI components so that we
28 // can have easier access to those GUI components when testing here through their names
29
30 /************************ GENERAL *******************************/
31 //https://joel-costigliola.github.io/assertj/swing/api/org/assertj/swing/fixture/FrameFixture.html
32 public static void switchToPane(FrameFixture window, String pane) {
33 //JTabbedPaneFixture tab = window.tabbedPane("GUIManager.tab_pane");
34 JPanelFixture tab = window.panel(pane);
35 }
36 public static void getMenu(String menu, String subMenu) {}
37
38 // e.g. pane = Enrich,view=collection; pane = Gather, view = workspace (or collection)
39 public static void getFolderPath(String pane, String view, String folderPath) {}
40 public static void getFilePath(String pane, String view, String filePath) {}
41
42 /**********************FILE MENU*******************************/
43 public static void setPrefs(String tab, Map params) {}
44 // mode e.g. librarian, expert
45 public static void changeUserMode(String mode) {}
46
47 public static void deleteCollection(){}
48 public static void saveCollection(){}
49 public static void closeCollection(){}
50 public static void createCollection(String basedOn) {}
51 public static void loadCollection(String colName) {}
52
53 // only for GS2?
54 public static void exportCollection() {}
55
56 /*************** DESIGN ******************************/
57 public static void changeIndexer(String toIndexer) {}
58 public static void changeDB(String toDB) {}
59
60 public static void configurePartitionIndex(String tab, Map params) {}
61
62 public static void configurePlugin(String pluginName, Map params) {
63 }
64
65 public static void configureClassifier(String classifierName, Map params) {}
66
67 public static void configurePlugout(String plugoutName, Map params) {}
68
69 // https://www.journaldev.com/1257/java-varargs
70 // https://www.geeksforgeeks.org/variable-arguments-varargs-in-java/
71 public static void keepOnlyPlugins(String ... plug_n) {}
72
73 public static void removePlugs(String ... plug_n) {}
74
75 /********************** CREATE PANEL ********************/
76 public static void buildOpenCollection() {}
77 public static void buildOpenCollection(boolean minimalRebuild) {}
78 public static void configureImportOptions(Map params) {}
79 public static void configureBuildOptions(Map params) {}
80
81 public static void buildOutputContains(String ... n) {}
82
83 /******************** GATHER PANE ********************/
84 public static void createWorkspaceShortcut(){}
85
86 // in current open collection
87 public static void createCollectionSubfolder() {}
88
89 public static void dragNDrop(String workspacePath, String collPath) {}
90
91 /********************* ENRICH PANE ******************/
92 // docPath can be just docName or collectionSubfolder/Subfolder2/docName
93 public static void addMeta(String docPath, Map metanamesToValues) {}
94 public static void addFolderLevelMeta(String folderPath, Map metanamesToValues) {}
95
96 /********************* DOWNLOAD PANE ******************/
97 // TODO: more functions needed here: e.g. serverInfo?
98 public static void download(String downloader, Map params) {}
99 public static void clearCache() {}
100 public static String serverInfo() {
101 return "";
102 }
103
104 /********************* DOWNLOAD PANE ******************/
105 public static void formatGeneral(){}
106 public static void formatSearch() {}
107 public static void formatFeature(String featureName, String filename) {}
108 public static boolean isFormatFeatureXMLValid() {
109 return true;
110 }
111
112 // Moving these working bits of code here, in case I can use them to right
113 // general get methods that make use of the GenericTypeMatcher method of accessing components
114 // See https://joel-costigliola.github.io/assertj/assertj-swing-lookup.html
115
116 /*window = findFrame(new GenericTypeMatcher<JFrame>(JFrame.class) {
117 protected boolean isMatching(JFrame window) {
118 return window.getTitle().trim().startsWith(expectedWindowTitle)
119 && window.isShowing();
120 }
121 }).using(robot());
122 */
123 /*
124 JTabbedPaneFixture tab = window.tabbedPane(new GenericTypeMatcher<JTabbedPane>(JTabbedPane.class) {
125 @Override protected boolean isMatching(JTabbedPane tabPane) {
126 System.err.println("### trying for match");
127 //int index = GuiActionRunner.execute(() -> tabPane.getSelectedIndex());
128 int index = tabPane.getSelectedIndex();
129 String selectedTabTitle = tabPane.getTitleAt(index); //GuiActionRunner.execute(() -> tabPane.getTitleAt(index));
130 System.err.println("### GOT TITLE: " + selectedTabTitle);
131 return gatherPaneLabel.equals(selectedTabTitle);
132 }
133 });
134 */
135}
Note: See TracBrowser for help on using the repository browser.