use of com.android.tools.idea.tests.gui.framework.RunIn 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();
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class InstantRunTest method hotSwap.
/**
* Verifies that instant run hot swap works as expected.
* <p>
* This is run to qualify releases. Please involve the test team in substantial changes.
* <p>
* TR ID: C14581583
* <p>
* <pre>
* Test Steps:
* 1. Import SimpleApplication.
* 2. Update the gradle plugin version if necessary for testing purpose.
* 3. Create an AVD with a system image API 21 or above.
* 4. Run on the AVD
* 5. Verify 1.
* 6. Edit a java file.
* 7. Run again.
* 8. Verify 2.
* Verify:
* 1. Make sure the right app is installed and started in Run tool window.
* 2. Make sure the instant run hot swap is applied in Run tool window.
* </pre>
*/
@RunIn(TestGroup.QA)
@Test
public void hotSwap() throws Exception {
IdeFrameFixture ideFrameFixture = guiTest.importSimpleApplication();
updateGradleVersion(guiTest.getProjectPath());
createAVD();
ideFrameFixture.runApp(APP_NAME).selectDevice(AVD_NAME).clickOk();
ideFrameFixture.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(RUN_OUTPUT), 120);
ideFrameFixture.getEditor().open("app/src/main/java/google/simpleapplication/MyActivity.java").enterText(Strings.repeat("\n", 10));
ideFrameFixture.waitForGradleProjectSyncToFinish().findRunApplicationButton().click();
ideFrameFixture.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(HOT_SWAP_OUTPUT), 120);
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class GradleBuildTest method compileWithJack.
/**
* Verifies that a simple app is configured to build using Jack and Jill.
* <p>
* This is run to qualify releases. Please involve the test team in substantial changes.
* <p>
* TR ID: C14581579
* <p>
* <pre>
* Test Steps:
* 1. Import the JackAndJillApp project.
* 2. Build the project.
* Verify:
* The project builds.
* </pre>
* <p>
* This test does not try and run the project.
*/
@Ignore("https://code.google.com/p/android/issues/detail?id=226797")
@RunIn(TestGroup.QA)
@Test
public void compileWithJack() throws IOException {
GradleInvocationResult buildResult = guiTest.importProjectAndWaitForProjectSyncToFinish("JackAndJillApp").invokeProjectMake();
assertThat(buildResult.isBuildSuccessful()).named("Gradle build successful").isTrue();
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class FlavorsExecutionTest method runBuildFlavors.
/***
* To verify that the selected app flavor activity can be launched using build variants
* <p>This is run to qualify releases. Please involve the test team in substantial changes.
* <p>TR ID: C14578811
* <pre>
* Test Steps:
* 1. Create a new project
* 2. Open Project Structure Dialog
* 3. Select app module, add two new flavors (Flavor1 and Flavor2)
* 4. Switch to Project View
* 5. Select app
* 6. Add launcher activities under Flavor1 and Flavor2 and name them F1_Main_Activity and F2_Main_Activity
* 7. Open Build variants window and select flavor1Debug
* 8. Deploy the project on an AVD (Verify 1)
* 9. Select flavor2Debug from Build variants
* 10. Deploy the project on an AVD (Verify 2)
* Verification:
* 1. Verify in Android Run tool window for the launch of F1_Main_Activity
* 2. Verify in Android Run tool window for the launch of F2_Main_Activity
* </pre>
*/
@Ignore("http://b/30795134")
@RunIn(TestGroup.QA)
@Test
public void runBuildFlavors() throws Exception {
guiTest.ideFrame().openFromMenu(ProjectStructureDialogFixture::find, "File", "Project Structure...").selectConfigurable("app").selectFlavorsTab().clickAddButton().setFlavorName("flavor1").clickAddButton().setFlavorName("flavor2").clickOk();
guiTest.ideFrame().getProjectView().selectProjectPane().selectByPath("SimpleApplication", "app");
guiTest.ideFrame().openFromMenu(NewActivityWizardFixture::find, "File", "New", "Activity", "Basic Activity").getConfigureActivityStep().enterTextFieldValue(ConfigureBasicActivityStepFixture.ActivityTextField.NAME, FIRST_ACTIVITY_NAME).enterTextFieldValue(ConfigureBasicActivityStepFixture.ActivityTextField.LAYOUT, "activity_f1_main").selectLauncherActivity().setTargetSourceSet("flavor1").clickFinish().waitForGradleProjectSyncToFinish();
guiTest.ideFrame().getProjectView().selectProjectPane().selectByPath("SimpleApplication", "app");
guiTest.ideFrame().openFromMenu(NewActivityWizardFixture::find, "File", "New", "Activity", "Basic Activity").getConfigureActivityStep().enterTextFieldValue(ConfigureBasicActivityStepFixture.ActivityTextField.NAME, SECOND_ACTIVITY_NAME).enterTextFieldValue(ConfigureBasicActivityStepFixture.ActivityTextField.LAYOUT, "activity_f2_main").selectLauncherActivity().setTargetSourceSet("flavor2").clickFinish().waitForGradleProjectSyncToFinish();
guiTest.ideFrame().getBuildVariantsWindow().selectVariantForModule("app", "flavor1Debug");
guiTest.ideFrame().runApp("app").selectDevice(AVD_NAME).clickOk();
guiTest.ideFrame().getRunToolWindow().findContent("app").waitForOutput(new PatternTextMatcher(Pattern.compile(ACTIVITY_OUTPUT_PATTERN.replace("Main_Activity", FIRST_ACTIVITY_NAME))), 120);
guiTest.ideFrame().getAndroidToolWindow().selectDevicesTab().selectProcess(PROCESS_NAME).clickTerminateApplication();
guiTest.ideFrame().getBuildVariantsWindow().selectVariantForModule("app", "flavor2Debug");
guiTest.ideFrame().runApp("app").selectDevice(AVD_NAME).clickOk();
guiTest.ideFrame().getRunToolWindow().findContent("app").waitForOutput(new PatternTextMatcher(Pattern.compile(ACTIVITY_OUTPUT_PATTERN.replace("Main_Activity", SECOND_ACTIVITY_NAME))), 120);
guiTest.ideFrame().getAndroidToolWindow().selectDevicesTab().selectProcess(PROCESS_NAME).clickTerminateApplication();
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class InstantRunTest method changeManifest.
/**
* Verifies that instant run works as expected when AndroidManifest is changed.
* <p>
* This is run to qualify releases. Please involve the test team in substantial changes.
* <p>
* TR ID: C14581585
* <p>
* <pre>
* Test Steps:
* 1. Import SimpleApplication.
* 2. Update the gradle plugin version if necessary for testing purpose.
* 3. Create an AVD with a system image API 21 or above.
* 4. Run on the AVD
* 5. Verify 1.
* 6. Edit AndroidManifest.
* 7. Run again.
* 8. Verify 2.
* Verify:
* 1. Make sure the right app is installed and started in Run tool window.
* 2. Make sure the instant run is applied in EventLog tool window.
* </pre>
*/
@RunIn(TestGroup.QA)
@Test
public void changeManifest() throws Exception {
IdeFrameFixture ideFrameFixture = guiTest.importSimpleApplication();
updateGradleVersion(guiTest.getProjectPath());
createAVD();
ideFrameFixture.runApp(APP_NAME).selectDevice(AVD_NAME).clickOk();
ideFrameFixture.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(RUN_OUTPUT), 120);
ideFrameFixture.getEditor().open("app/src/main/AndroidManifest.xml", EditorFixture.Tab.EDITOR).moveBetween("", "<application").enterText("<uses-permission android:name=\"android.permission.INTERNET\" /\n");
ideFrameFixture.waitForGradleProjectSyncToFinish().findRunApplicationButton().click();
ideFrameFixture.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(RUN_OUTPUT), 120);
Wait.seconds(1).expecting("The notification is showing").until(() -> {
try {
Notification notification = Iterables.getLast(EventLog.getLogModel(ideFrameFixture.getProject()).getNotifications());
assertThat(notification.getContent()).matches(INSTANT_RUN_NOTIFICATION_REGEX);
return true;
} catch (Exception e) {
System.out.println(e.getClass().toString());
return false;
}
});
}
Aggregations