private static void createPlainQuestion(JPanelFixture panel, AnswerType type, boolean alterPair) { createQuestionTitleQuestionCitation(panel, alterPair); JComboBoxFixture answerType = new JComboBoxFixture( panel.robot, (JComboBox) panel .robot .finder() .find(panel.component(), new NameMatcher("question_answer_type_menu"))); answerType.selectItem(type.ordinal()); if (!alterPair && type.equals(AnswerType.CATEGORICAL)) { panel.button(withText("Selections")).click(); fillInCategoricalQuestions(panel.robot); } else if (alterPair) { panel.button(withText("Selections")).click(); DialogFixture dialog = WindowFinder.findDialog("Category Options").withTimeout(10000).using(panel.robot); JComboBoxFixture cmbF = dialog.comboBox(); cmbF.selectItem(2); dialog.list().selectItem(0); dialog.button(withText("Mark selected item adjacent")).click(); dialog.button(withText("OK")).click(); } }
private static void fillInCategoricalQuestions(Robot robot) { DialogFixture dialog = WindowFinder.findDialog("Category Options").withTimeout(10000).using(robot); JComboBoxFixture cmbF = dialog.comboBox(); String[] poss = cmbF.contents(); int sel = (int) (Math.random() * poss.length); cmbF.selectItem(sel); dialog.button(withText("OK")).click(); }
public void findEnumEntryBoxAndSelectValue(String name, String value) { JPanelFixture entryBoxArrayPanel = focusedWindow.panel("EntryBoxArrayPanel"); JPanelFixture enumEntryBox = entryBoxArrayPanel.panel(name + "_YoEntryBox"); JComboBoxFixture comboBox = enumEntryBox.comboBox(); comboBox.selectItem(value); }