Search in sources :

Example 1 with NewXmlValueWizardFixture

use of com.android.tools.idea.tests.gui.framework.fixture.npw.NewXmlValueWizardFixture in project android by JetBrains.

the class NewComponentTest method testNewValueWizard.

@Test
public void testNewValueWizard() throws IOException {
    guiTest.importSimpleApplication();
    guiTest.ideFrame().getProjectView().selectAndroidPane();
    guiTest.ideFrame().invokeMenuPath("File", "New", "XML", "Values XML File");
    final NewXmlValueWizardFixture wizardFixture = NewXmlValueWizardFixture.find(guiTest.robot());
    final JButtonFixture finishFixture = wizardFixture.findWizardButton("Finish");
    finishFixture.requireEnabled();
    wizardFixture.getFileNameField().enterText("strings");
    final JLabelFixture errorLabel = wizardFixture.findLabel("Values File Name must be unique");
    Wait.seconds(1).expecting("Finish to be disabled").until(() -> !finishFixture.isEnabled());
    wizardFixture.getFileNameField().enterText("2");
    Wait.seconds(1).expecting("Finish to be enabled").until(finishFixture::isEnabled);
    // Now test an invalid file name. Currently we have "strings2" so add an space to make it invalid.
    wizardFixture.getFileNameField().enterText(" ");
    Wait.seconds(1).expecting("Finish to be disabled").until(() -> !finishFixture.isEnabled());
    errorLabel.requireText("Values File Name is not set to a valid resource name: ' ' is not a valid resource name character");
    // UI tests should close all dialogs before finishing
    wizardFixture.findWizardButton("Cancel").click();
}
Also used : JButtonFixture(org.fest.swing.fixture.JButtonFixture) JLabelFixture(org.fest.swing.fixture.JLabelFixture) NewXmlValueWizardFixture(com.android.tools.idea.tests.gui.framework.fixture.npw.NewXmlValueWizardFixture) Test(org.junit.Test)

Aggregations

NewXmlValueWizardFixture (com.android.tools.idea.tests.gui.framework.fixture.npw.NewXmlValueWizardFixture)1 JButtonFixture (org.fest.swing.fixture.JButtonFixture)1 JLabelFixture (org.fest.swing.fixture.JLabelFixture)1 Test (org.junit.Test)1