Search in sources :

Example 26 with EditorFixture

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

the class GradleIncreaseLanguageLevelTest method testIncreaseLanguageLevelForAndroid.

@Ignore("http://wpie20.hot.corp.google.com:8200/builders/ubuntu-studio-master-dev-uitests/builds/28/")
@Test
public void testIncreaseLanguageLevelForAndroid() throws IOException {
    guiTest.importProjectAndWaitForProjectSyncToFinish("MultiModule");
    EditorFixture editor = guiTest.ideFrame().getEditor();
    editor.open("library/src/androidTest/java/com/android/library/ApplicationTest.java");
    editor.moveBetween("super(Application.class);", "");
    useJava7FeatureAndIncreaseLanguageLevel(editor);
}
Also used : EditorFixture(com.android.tools.idea.tests.gui.framework.fixture.EditorFixture) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 27 with EditorFixture

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

the class AddGradleDependencyTest method testNoModuleDependencyQuickfixFromAndroidLibToApplication.

@Test
public void testNoModuleDependencyQuickfixFromAndroidLibToApplication() throws IOException {
    guiTest.importProjectAndWaitForProjectSyncToFinish("MultiModule");
    EditorFixture editor = guiTest.ideFrame().getEditor().open("library/src/main/java/com/android/library/MainActivity.java");
    String classToImport = "com.android.multimodule.MainActivity";
    addImport(editor, classToImport);
    editor.waitForCodeAnalysisHighlightCount(ERROR, 2);
    moveCaretToClassName(editor, classToImport);
    editor.waitForQuickfix();
    assertIntentionNotIncluded(editor, "Add dependency on module");
}
Also used : EditorFixture(com.android.tools.idea.tests.gui.framework.fixture.EditorFixture) Test(org.junit.Test)

Example 28 with EditorFixture

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

the class AddGradleDependencyTest method testAddJetbrainsAnnotationDependency.

@Test
public void testAddJetbrainsAnnotationDependency() throws IOException {
    guiTest.importSimpleApplication();
    EditorFixture editor = guiTest.ideFrame().getEditor().open("app/src/main/java/google/simpleapplication/MyActivity.java");
    editor.moveBetween("onCreate(", "Bundle savedInstanceState) {");
    editor.enterText("\n@NotNull ");
    editor.waitForCodeAnalysisHighlightCount(ERROR, 1);
    editor.moveBetween("@Not", "Null ");
    editor.invokeQuickfixAction("Add 'annotations-java5' to classpath");
    guiTest.ideFrame().waitForGradleProjectSyncToFinish();
    editor.waitForCodeAnalysisHighlightCount(ERROR, 0);
    GradleBuildModelFixture appBuildModel = guiTest.ideFrame().parseBuildFileForModule("app");
    ArtifactDependencySpec expected = new ArtifactDependencySpec("annotations-java5", "org.jetbrains", "15.0");
    appBuildModel.requireDependency(COMPILE, expected);
    // Undo the import statement first
    editor.invokeAction(UNDO);
    verifyUndo(editor, 1);
}
Also used : EditorFixture(com.android.tools.idea.tests.gui.framework.fixture.EditorFixture) GradleBuildModelFixture(com.android.tools.idea.tests.gui.framework.fixture.gradle.GradleBuildModelFixture) ArtifactDependencySpec(com.android.tools.idea.gradle.dsl.model.dependencies.ArtifactDependencySpec) Test(org.junit.Test)

Example 29 with EditorFixture

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

the class AndroidSdkSourceAttachTest method testDownloadSdkSource.

@Ignore("failed in http://go/aj/job/studio-ui-test/417 and from IDEA")
@Test
public void testDownloadSdkSource() throws IOException {
    if (mySdkSourcePath.isDirectory()) {
        delete(mySdkSourceTmpPath);
        rename(mySdkSourcePath, mySdkSourceTmpPath);
    }
    updateSdkSourceRoot(mySdk);
    guiTest.importSimpleApplication();
    final EditorFixture editor = guiTest.ideFrame().getEditor();
    final VirtualFile classFile = findActivityClassFile();
    editor.open(classFile, EditorFixture.Tab.EDITOR);
    acceptLegalNoticeIfNeeded();
    // Download the source.
    editor.awaitNotification("Sources for '" + mySdk.getName() + "' not found.").performAction("Download");
    DialogFixture downloadDialog = findDialog(withTitle("SDK Quickfix Installation")).withTimeout(TimeUnit.MINUTES.toMillis(2)).using(guiTest.robot());
    final JButtonFixture finish = downloadDialog.button(withText("Finish"));
    // Wait until installation is finished. By then the "Finish" button will be enabled.
    Wait.seconds(1).expecting("Android source to be installed").until(finish::isEnabled);
    finish.click();
    Wait.seconds(1).expecting("source file to be opened").until(() -> !classFile.equals(editor.getCurrentFile()));
    assertIsActivityJavaFile(editor.getCurrentFile());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) JButtonFixture(org.fest.swing.fixture.JButtonFixture) EditorFixture(com.android.tools.idea.tests.gui.framework.fixture.EditorFixture) DialogFixture(org.fest.swing.fixture.DialogFixture) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 30 with EditorFixture

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

the class RefactoringFlowTest method testResourceConflict.

@Test
public void testResourceConflict() throws IOException {
    // Try to rename a resource to an existing resource; check that
    // you get a warning in the conflicts dialog first
    guiTest.importSimpleApplication();
    EditorFixture editor = guiTest.ideFrame().getEditor();
    editor.open("app/src/main/res/values/strings.xml");
    editor.moveBetween("hello", "_world");
    guiTest.ideFrame().invokeMenuPath("Refactor", "Rename...");
    // Rename as action_settings, which is already defined
    RenameRefactoringDialogFixture refactoringDialog = RenameRefactoringDialogFixture.find(guiTest.robot());
    refactoringDialog.setNewName("action_settings");
    refactoringDialog.clickRefactor();
    ConflictsDialogFixture conflictsDialog = ConflictsDialogFixture.find(guiTest.robot());
    assertThat(conflictsDialog.getText()).contains("Resource @string/action_settings already exists");
    conflictsDialog.clickCancel();
    refactoringDialog.clickCancel();
}
Also used : RenameRefactoringDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.RenameRefactoringDialogFixture) EditorFixture(com.android.tools.idea.tests.gui.framework.fixture.EditorFixture) ConflictsDialogFixture(com.android.tools.idea.tests.gui.framework.fixture.RenameRefactoringDialogFixture.ConflictsDialogFixture) Test(org.junit.Test)

Aggregations

EditorFixture (com.android.tools.idea.tests.gui.framework.fixture.EditorFixture)41 Test (org.junit.Test)37 IdeFrameFixture (com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture)9 Ignore (org.junit.Ignore)7 GradleBuildModelFixture (com.android.tools.idea.tests.gui.framework.fixture.gradle.GradleBuildModelFixture)6 NlComponentFixture (com.android.tools.idea.tests.gui.framework.fixture.layout.NlComponentFixture)6 NlEditorFixture (com.android.tools.idea.tests.gui.framework.fixture.layout.NlEditorFixture)6 ArtifactDependencySpec (com.android.tools.idea.gradle.dsl.model.dependencies.ArtifactDependencySpec)4 MergedManifestFixture (com.android.tools.idea.tests.gui.framework.fixture.MergedManifestFixture)4 RunIn (com.android.tools.idea.tests.gui.framework.RunIn)3 RenameRefactoringDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.RenameRefactoringDialogFixture)3 VirtualFile (com.intellij.openapi.vfs.VirtualFile)3 DialogFixture (org.fest.swing.fixture.DialogFixture)3 JButtonFixture (org.fest.swing.fixture.JButtonFixture)3 JTreeFixture (org.fest.swing.fixture.JTreeFixture)3 ExpectedModuleDependency (com.android.tools.idea.gradle.dsl.model.dependencies.ExpectedModuleDependency)2 ChooseResourceDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.ChooseResourceDialogFixture)2 ConflictsDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.RenameRefactoringDialogFixture.ConflictsDialogFixture)2 ThemeEditorFixture (com.android.tools.idea.tests.gui.framework.fixture.theme.ThemeEditorFixture)2 Project (com.intellij.openapi.project.Project)2