use of org.fest.swing.fixture.JComboBoxFixture in project android by JetBrains.
the class MultiModuleThemeEditorTest method testModuleWithoutThemes.
@Test
public void testModuleWithoutThemes() throws IOException {
guiTest.importProjectAndWaitForProjectSyncToFinish("MultiAndroidModule");
final ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
final JComboBoxFixture modulesComboBox = themeEditor.getModulesComboBox();
modulesComboBox.selectItem("app");
themeEditor.getThemesComboBox().selectItem("AppTheme");
themeEditor.waitForThemeSelection("AppTheme");
modulesComboBox.selectItem("nothemeslibrary");
guiTest.robot().waitForIdle();
final LogModel logModel = EventLog.getLogModel(guiTest.ideFrame().getProject());
for (Notification notification : logModel.getNotifications()) {
assertThat(notification.getType()).isNotEqualTo(NotificationType.ERROR);
}
}
use of org.fest.swing.fixture.JComboBoxFixture in project android by JetBrains.
the class ThemeConfigurationTest method testThemesWithConfiguration.
/**
* Tests that the theme editor deals well with themes defined only in certain configurations
*/
@Test
public void testThemesWithConfiguration() throws IOException {
guiTest.importSimpleApplication();
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
JComboBoxFixture themesComboBox = themeEditor.getThemesComboBox();
themesComboBox.selectItem("Create New Theme");
NewStyleDialogFixture newStyleDialog = NewStyleDialogFixture.find(guiTest.robot());
JComboBoxFixture parentComboBox = newStyleDialog.getParentComboBox();
parentComboBox.selectItem("Show all themes");
ThemeSelectionDialogFixture themeSelectionDialog = ThemeSelectionDialogFixture.find(guiTest.robot());
final JTreeFixture categoriesTree = themeSelectionDialog.getCategoriesTree();
JListFixture themeList = themeSelectionDialog.getThemeList();
categoriesTree.clickPath("Material Dark");
guiTest.robot().waitForIdle();
themeList.clickItem("android:Theme.Material");
themeSelectionDialog.clickOk();
parentComboBox.requireSelection("android:Theme.Material");
JTextComponentFixture newNameTextField = newStyleDialog.getNewNameTextField();
newNameTextField.click();
newNameTextField.deleteText();
newNameTextField.enterText("MyMaterialTheme");
newStyleDialog.clickOk();
themeEditor.waitForThemeSelection("MyMaterialTheme");
AndroidThemePreviewPanelFixture themePreviewPanel = themeEditor.getPreviewComponent().getThemePreviewPanel();
themePreviewPanel.requirePreviewPanel();
JButton apiButton = themeEditor.findToolbarButton("API Version in Editor");
guiTest.robot().click(apiButton);
clickPopupMenuItem("API 19", "19", apiButton, guiTest.robot());
themePreviewPanel.requireErrorPanel();
themesComboBox.selectItem("AppTheme");
themePreviewPanel.requirePreviewPanel();
themesComboBox.selectItem("MyMaterialTheme");
themePreviewPanel.requireErrorPanel();
}
use of org.fest.swing.fixture.JComboBoxFixture in project ats-framework by Axway.
the class SwingElementLocator method findFixture.
public static ComponentFixture<? extends Component> findFixture(UiElement uiElement) {
SwingDriverInternal driver = (SwingDriverInternal) uiElement.getUiDriver();
ContainerFixture<?> containerFixture = (ContainerFixture<?>) driver.getActiveContainerFixture();
Class<? extends Component> componentClass = componentsMap.get(uiElement.getClass());
try {
if (componentClass.equals(JButton.class)) {
return (ComponentFixture<? extends Component>) new JButtonFixture(containerFixture.robot, (JButton) findElement(uiElement));
} else if (componentClass.equals(JTextComponent.class)) {
return (ComponentFixture<? extends Component>) new JTextComponentFixture(containerFixture.robot, (JTextComponent) findElement(uiElement));
} else if (componentClass.equals(JMenuItem.class)) {
if (uiElement.getElementProperty("path") != null) {
return containerFixture.menuItemWithPath(uiElement.getElementProperty("path").split("[\\,\\/]+"));
} else {
return (ComponentFixture<? extends Component>) new JMenuItemFixture(containerFixture.robot, (JMenuItem) findElement(uiElement));
}
} else if (componentClass.equals(JPopupMenu.class)) {
return (ComponentFixture<? extends Component>) new JPopupMenuFixture(containerFixture.robot, (JPopupMenu) findElement(uiElement));
} else if (componentClass.equals(JTree.class)) {
return (ComponentFixture<? extends Component>) new JTreeFixture(containerFixture.robot, (JTree) findElement(uiElement));
} else if (componentClass.equals(JList.class)) {
return (ComponentFixture<? extends Component>) new JListFixture(containerFixture.robot, (JList) findElement(uiElement));
} else if (componentClass.equals(JCheckBox.class)) {
return (ComponentFixture<? extends Component>) new JCheckBoxFixture(containerFixture.robot, (JCheckBox) findElement(uiElement));
} else if (componentClass.equals(JToggleButton.class)) {
return (ComponentFixture<? extends Component>) new JToggleButtonFixture(containerFixture.robot, (JToggleButton) findElement(uiElement));
} else if (componentClass.equals(JComboBox.class)) {
return (ComponentFixture<? extends Component>) new JComboBoxFixture(containerFixture.robot, (JComboBox) findElement(uiElement));
} else if (componentClass.equals(JRadioButton.class)) {
return (ComponentFixture<? extends Component>) new JRadioButtonFixture(containerFixture.robot, (JRadioButton) findElement(uiElement));
} else if (componentClass.equals(JTable.class)) {
return (ComponentFixture<? extends Component>) new JTableFixture(containerFixture.robot, (JTable) findElement(uiElement));
} else if (componentClass.equals(JSpinner.class)) {
return (ComponentFixture<? extends Component>) new JSpinnerFixture(containerFixture.robot, (JSpinner) findElement(uiElement));
} else if (componentClass.equals(JTabbedPane.class)) {
return (ComponentFixture<? extends Component>) new JTabbedPaneFixture(containerFixture.robot, (JTabbedPane) findElement(uiElement));
} else if (componentClass.equals(JOptionPane.class)) {
return (ComponentFixture<? extends Component>) containerFixture.optionPane();
} else if (componentClass.equals(JLabel.class)) {
return (ComponentFixture<? extends Component>) new JLabelFixture(containerFixture.robot, (JLabel) findElement(uiElement));
} else if (componentClass.equals(Component.class)) {
return new ComponentFixture<Component>(containerFixture.robot, findElement(uiElement)) {
};
} else if (componentClass.equals(JFileChooser.class)) {
// TODO - might be searched by name too
return containerFixture.fileChooser(Timeout.timeout(UiEngineConfigurator.getInstance().getElementStateChangeDelay()));
} else {
throw new ElementNotFoundException(uiElement.toString() + " not found. No such Fixture");
}
} catch (ComponentLookupException cle) {
throw new ElementNotFoundException(uiElement.toString() + " not found.", cle);
} catch (WaitTimedOutError exc) {
// thrown for OptionPane search, wait for Window (BasicRobot.waitForWindow), AbstractJTableCellWriter, JTreeDriver.waitForChildrenToShowUp, each Pause wait
throw new ElementNotFoundException(uiElement.toString() + " not found.", exc);
}
}
use of org.fest.swing.fixture.JComboBoxFixture in project android by JetBrains.
the class MultiModuleThemeEditorTest method testMultipleModules.
@Test
public void testMultipleModules() throws IOException {
guiTest.importProjectAndWaitForProjectSyncToFinish("MultiAndroidModule");
final ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
assertThat(themeEditor.getModulesList()).containsExactly("app", "library", "library2", "library3", "nothemeslibrary");
final JComboBoxFixture modulesComboBox = themeEditor.getModulesComboBox();
modulesComboBox.selectItem("app");
final List<String> appThemes = themeEditor.getThemesList();
assertThat(appThemes).containsAllOf("AppTheme", "Library1DependentTheme", "Library1Theme", "Library2Theme");
assertThat(appThemes).doesNotContain("Library3Theme");
modulesComboBox.selectItem("library");
final List<String> library1Themes = themeEditor.getThemesList();
assertThat(library1Themes).containsAllOf("Library1Theme", "Library2Theme");
assertThat(library1Themes).containsNoneOf("AppTheme", "Library1DependentTheme", "Library3Theme");
modulesComboBox.selectItem("library2");
final List<String> library2Themes = themeEditor.getThemesList();
assertThat(library2Themes).contains("Library2Theme");
assertThat(library2Themes).containsNoneOf("AppTheme", "Library1DependentTheme", "Library1Theme", "Library3Theme");
modulesComboBox.selectItem("library3");
final List<String> library3Themes = themeEditor.getThemesList();
assertThat(library3Themes).contains("Library3Theme");
assertThat(library3Themes).containsNoneOf("AppTheme", "Library1DependentTheme", "Library1Theme", "Library2Theme");
}
use of org.fest.swing.fixture.JComboBoxFixture in project android by JetBrains.
the class NewStyleDialogGuiTest method testCreateNewThemeSelection.
/**
* When "Create New Theme" is selected, opened dialog contains theme that was edited
* as a parent.
*
* Is a regression test for http://b.android.com/180575
*/
@Test
public void testCreateNewThemeSelection() throws IOException {
guiTest.importSimpleApplication();
final ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(guiTest.ideFrame());
final JComboBoxFixture themesComboBox = themeEditor.getThemesComboBox();
themesComboBox.selectItem("Theme.AppCompat.Light.NoActionBar");
themesComboBox.selectItem("Create New Theme");
final NewStyleDialogFixture newStyleDialog1 = NewStyleDialogFixture.find(guiTest.robot());
assertEquals("Theme.AppCompat.Light.NoActionBar", newStyleDialog1.getParentComboBox().selectedItem());
newStyleDialog1.clickCancel();
themeEditor.waitForThemeSelection("Theme.AppCompat.Light.NoActionBar");
themesComboBox.selectItem("Theme.AppCompat.NoActionBar");
themesComboBox.selectItem("Create New Theme");
final NewStyleDialogFixture newStyleDialog2 = NewStyleDialogFixture.find(guiTest.robot());
assertEquals("Theme.AppCompat.NoActionBar", newStyleDialog2.getParentComboBox().selectedItem());
newStyleDialog2.clickCancel();
}
Aggregations