Search in sources :

Example 1 with InputDialogFixture

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

the class GradleRenameModuleTest method testRenameModuleAlsoChangeReferencesInBuildFile.

@Test
public void testRenameModuleAlsoChangeReferencesInBuildFile() throws IOException {
    guiTest.importMultiModule();
    ProjectViewFixture.PaneFixture paneFixture = guiTest.ideFrame().getProjectView().selectProjectPane();
    paneFixture.selectByPath("MultiModule", "library");
    invokeRefactor();
    SelectRefactoringDialogFixture selectRefactoringDialog = SelectRefactoringDialogFixture.findByTitle(guiTest.robot());
    selectRefactoringDialog.selectRenameModule();
    selectRefactoringDialog.clickOk();
    InputDialogFixture renameModuleDialog = InputDialogFixture.findByTitle(guiTest.robot(), "Rename Module");
    renameModuleDialog.enterTextAndClickOk("newLibrary");
    guiTest.waitForBackgroundTasks();
    assertThat(guiTest.ideFrame().hasModule("newLibrary")).named("newLibrary module exists").isTrue();
    // app module has two references to library module
    GradleBuildModelFixture buildModel = guiTest.ideFrame().parseBuildFileForModule("app");
    ExpectedModuleDependency expected = new ExpectedModuleDependency();
    expected.configurationName = "debugCompile";
    expected.path = ":newLibrary";
    buildModel.requireDependency(expected);
    expected.configurationName = "releaseCompile";
    buildModel.requireDependency(expected);
}
Also used : ExpectedModuleDependency(com.android.tools.idea.gradle.dsl.model.dependencies.ExpectedModuleDependency) InputDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.InputDialogFixture) SelectRefactoringDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.SelectRefactoringDialogFixture) ProjectViewFixture(com.android.tools.idea.tests.gui.framework.fixture.ProjectViewFixture) GradleBuildModelFixture(com.android.tools.idea.tests.gui.framework.fixture.gradle.GradleBuildModelFixture) Test(org.junit.Test)

Example 2 with InputDialogFixture

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

the class GradleRenameModuleTest method testCannotRenameRootModule.

@Test
public void testCannotRenameRootModule() throws IOException {
    guiTest.importSimpleApplication();
    ProjectViewFixture.PaneFixture paneFixture = guiTest.ideFrame().getProjectView().selectProjectPane();
    paneFixture.selectByPath("SimpleApplication");
    invokeRefactor();
    InputDialogFixture renameModuleDialog = InputDialogFixture.findByTitle(guiTest.robot(), "Rename Module");
    renameModuleDialog.enterTextAndClickOk("SimpleApplication2");
    MessagesFixture errorMessage = MessagesFixture.findByTitle(guiTest.robot(), "Rename Module");
    errorMessage.requireMessageContains("Can't rename root module");
    errorMessage.clickOk();
}
Also used : InputDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.InputDialogFixture) ProjectViewFixture(com.android.tools.idea.tests.gui.framework.fixture.ProjectViewFixture) MessagesFixture(com.android.tools.idea.tests.gui.framework.fixture.MessagesFixture) Test(org.junit.Test)

Example 3 with InputDialogFixture

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

the class GradleRenameModuleTest method testCannotRenameToExistingFile.

@Test
public void testCannotRenameToExistingFile() throws IOException {
    guiTest.importMultiModule();
    ProjectViewFixture.PaneFixture paneFixture = guiTest.ideFrame().getProjectView().selectProjectPane();
    paneFixture.selectByPath("MultiModule", "app");
    invokeRefactor();
    SelectRefactoringDialogFixture selectRefactoringDialog = SelectRefactoringDialogFixture.findByTitle(guiTest.robot());
    selectRefactoringDialog.selectRenameModule();
    selectRefactoringDialog.clickOk();
    InputDialogFixture renameModuleDialog = InputDialogFixture.findByTitle(guiTest.robot(), "Rename Module");
    renameModuleDialog.enterTextAndClickOk("library2");
    MessagesFixture errorMessage = MessagesFixture.findByTitle(guiTest.robot(), "Rename Module");
    errorMessage.requireMessageContains("Module named 'library2' already exist");
    errorMessage.clickOk();
    // In this case, the rename dialog will let you choose another name, click cancel to close the dialog
    renameModuleDialog.clickCancel();
}
Also used : InputDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.InputDialogFixture) SelectRefactoringDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.SelectRefactoringDialogFixture) ProjectViewFixture(com.android.tools.idea.tests.gui.framework.fixture.ProjectViewFixture) MessagesFixture(com.android.tools.idea.tests.gui.framework.fixture.MessagesFixture) Test(org.junit.Test)

Example 4 with InputDialogFixture

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

the class GradleRenameModuleTest method testRenameModule.

@RunIn(TestGroup.UNRELIABLE)
@Test
public void testRenameModule() throws IOException {
    guiTest.importSimpleApplication();
    ProjectViewFixture.PaneFixture paneFixture = guiTest.ideFrame().getProjectView().selectProjectPane();
    paneFixture.selectByPath("SimpleApplication", "app");
    invokeRefactor();
    SelectRefactoringDialogFixture selectRefactoringDialog = SelectRefactoringDialogFixture.findByTitle(guiTest.robot());
    selectRefactoringDialog.selectRenameModule();
    selectRefactoringDialog.clickOk();
    InputDialogFixture renameModuleDialog = InputDialogFixture.findByTitle(guiTest.robot(), "Rename Module");
    renameModuleDialog.enterTextAndClickOk("app2");
    renameModuleDialog.waitUntilNotShowing();
    guiTest.ideFrame().waitForGradleProjectSyncToStart().waitForGradleProjectSyncToFinish();
    assertThat(guiTest.ideFrame().hasModule("app2")).named("app2 module exists").isTrue();
    assertThat(guiTest.ideFrame().hasModule("app")).named("app module exists").isFalse();
}
Also used : InputDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.InputDialogFixture) SelectRefactoringDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.SelectRefactoringDialogFixture) ProjectViewFixture(com.android.tools.idea.tests.gui.framework.fixture.ProjectViewFixture) Test(org.junit.Test) RunIn(com.android.tools.idea.tests.gui.framework.RunIn)

Aggregations

InputDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.InputDialogFixture)4 ProjectViewFixture (com.android.tools.idea.tests.gui.framework.fixture.ProjectViewFixture)4 Test (org.junit.Test)4 SelectRefactoringDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.SelectRefactoringDialogFixture)3 MessagesFixture (com.android.tools.idea.tests.gui.framework.fixture.MessagesFixture)2 ExpectedModuleDependency (com.android.tools.idea.gradle.dsl.model.dependencies.ExpectedModuleDependency)1 RunIn (com.android.tools.idea.tests.gui.framework.RunIn)1 GradleBuildModelFixture (com.android.tools.idea.tests.gui.framework.fixture.gradle.GradleBuildModelFixture)1