use of com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture in project android by JetBrains.
the class LaunchAndroidApplicationTest method testDebugOnEmulator.
@Ignore("http://b/30795134")
@Test
public void testDebugOnEmulator() throws IOException, ClassNotFoundException, EvaluateException {
guiTest.importSimpleApplication();
createAVD();
IdeFrameFixture ideFrameFixture = guiTest.ideFrame();
ideFrameFixture.debugApp(APP_NAME).selectDevice(AVD_NAME).clickOk();
// Make sure the right app is being used. This also serves as the sync point for the package to get uploaded to the device/emulator.
ideFrameFixture.getDebugToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(LOCAL_PATH_OUTPUT), 120);
ideFrameFixture.getDebugToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(DEBUG_OUTPUT), 120);
ideFrameFixture.getAndroidToolWindow().selectDevicesTab().selectProcess(PROCESS_NAME).clickTerminateApplication();
}
use of com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture 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.fixture.IdeFrameFixture 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;
}
});
}
use of com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture in project android by JetBrains.
the class InstantRunTest method coldSwap.
/**
* Verifies that instant run cold swap works as expected.
* <p>
* This is run to qualify releases. Please involve the test team in substantial changes.
* <p>
* TR ID: C14581584
* <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 resource xml 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 cold swap is applied in Run tool window.
* </pre>
*/
@RunIn(TestGroup.QA)
@Test
public void coldSwap() 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/res/layout/activity_my.xml", EditorFixture.Tab.DESIGN).getLayoutEditor(false).dragComponentToSurface("Widgets", "TextView").waitForRenderToFinish();
ideFrameFixture.waitForGradleProjectSyncToFinish().findRunApplicationButton().click();
ideFrameFixture.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(COLD_SWAP_OUTPUT), 120);
}
use of com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture in project android by JetBrains.
the class ThemeSelectorTest method testRenameTheme.
/**
* Tests the theme renaming functionality of the theme selector
* and that IntelliJ's Undo works can revert this action
*/
@Ignore("go/studio-builder/builders/ubuntu-studio-master-dev-uitests/builds/257")
@Test
public void testRenameTheme() throws IOException {
guiTest.importSimpleApplication();
IdeFrameFixture ideFrame = guiTest.ideFrame();
ThemeEditorFixture themeEditor = ThemeEditorGuiTestUtils.openThemeEditor(ideFrame);
final JComboBoxFixture themesComboBox = themeEditor.getThemesComboBox();
themesComboBox.selectItem("Rename AppTheme");
RenameRefactoringDialogFixture renameRefactoringDialog = RenameRefactoringDialogFixture.find(guiTest.robot());
renameRefactoringDialog.setNewName("NewAppTheme").clickRefactor();
themeEditor.waitForThemeSelection("NewAppTheme");
themesComboBox.requireSelection("NewAppTheme");
List<String> themeList = themeEditor.getThemesList();
assertThat(themeList).hasSize(9);
assertThat(themeList.get(0)).isEqualTo("NewAppTheme");
assertThat(themeList.get(8)).isEqualTo("Rename NewAppTheme");
guiTest.robot().waitForIdle();
// AppCompat is read-only, being a library theme
themesComboBox.selectItem("Theme.AppCompat.NoActionBar");
themeList = themeEditor.getThemesList();
assertThat(themeList).hasSize(8);
assertThat(themeList.get(0)).isEqualTo("NewAppTheme");
assertThat(themeList.get(3)).isEqualTo("Theme.AppCompat.Light.NoActionBar");
assertThat(themeList.get(4)).isEqualTo("Theme.AppCompat.NoActionBar");
assertThat(themeList.get(5)).isEqualTo("Show all themes");
assertThat(themeList.get(7)).isEqualTo("Create New Theme");
EditorFixture editor = ideFrame.invokeMenuPath("Window", "Editor Tabs", "Select Previous Tab").getEditor();
assertThat(editor.getCurrentFileContents()).doesNotContain("name=\"AppTheme");
editor.moveBetween("", "name=\"NewAppTheme");
assertThat(editor.getCurrentLine().trim()).isEqualTo("<style name=\"NewAppTheme\" parent=\"android:Theme.Holo.Light.DarkActionBar\">");
// Testing Undo
ideFrame.invokeMenuPath("Window", "Editor Tabs", "Select Next Tab");
themesComboBox.selectItem("NewAppTheme");
ideFrame.invokeMenuPath("Edit", "Undo Renaming attribute value AppTh...").findMessageDialog("Undo").clickOk();
themeEditor.waitForThemeSelection("AppTheme");
// required to ensure that the Select Previous Tab action is available
themeEditor.focus();
ideFrame.invokeMenuPath("Window", "Editor Tabs", "Select Previous Tab");
assertThat(editor.getCurrentFileContents()).doesNotContain("name=\"NewAppTheme");
editor.moveBetween("", "name=\"AppTheme");
assertThat(editor.getCurrentLine().trim()).isEqualTo("<style name=\"AppTheme\" parent=\"android:Theme.Holo.Light.DarkActionBar\">");
}
Aggregations