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);
}
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");
}
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);
}
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());
}
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();
}
Aggregations