use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class LaunchAndroidApplicationTest method testCppDebugOnEmulatorWithBreakpoint.
/**
* To verify that sample ndk projects can be imported and breakpoints in code are hit.
* <p>
* This is run to qualify releases. Please involve the test team in substantial changes.
* <p>
* TR ID: C14578820
* <p>
* <pre>
* Test Steps:
* 1. Open Android Studio
* 2. Import Teapot from the cloned repo
* 3. Open TeapotNativeActivity.cpp
* 4. Click on any method and make sure it finds the method or its declaration
* 5. Search for the symbol HandleInput and put a break point in the method
* 6. Deploy to a device/emulator
* 7. Wait for notification that the debugger is connected
* 8. Teapot should show up on the device
* 9. Touch to interact
* Verify:
* 1. After step 9, the breakpoint is triggered.
* </pre>
* <p>
*/
@Ignore("http://b/30795134")
@RunIn(TestGroup.QA)
@Test
public void testCppDebugOnEmulatorWithBreakpoint() throws Exception {
WelcomeFrameFixture welcomeFrame = WelcomeFrameFixture.find(guiTest.robot());
welcomeFrame.importCodeSample();
BrowseSamplesWizardFixture samplesWizard = BrowseSamplesWizardFixture.find(guiTest.robot());
samplesWizard.selectSample("Ndk/Teapot").clickNext();
ConfigureAndroidProjectStepFixture configStep = samplesWizard.getConfigureFormFactorStep();
configStep.enterApplicationName("TeapotTest");
guiTest.setProjectPath(configStep.getLocationInFileSystem());
samplesWizard.clickFinish();
IdeFrameFixture ideFrameFixture = guiTest.ideFrame();
ideFrameFixture.waitForGradleProjectSyncToFinish().getEditor().open("app/src/main/jni/TeapotNativeActivity.cpp").moveBetween("g_engine.Draw", "Frame()").invokeAction(// First break point - First Frame is drawn
EditorFixture.EditorAction.TOGGLE_LINE_BREAKPOINT).moveBetween("static int32_t Handle", "Input(").invokeAction(EditorFixture.EditorAction.GOTO_IMPLEMENTATION).invokeAction(// Second break point - HandleInput()
EditorFixture.EditorAction.TOGGLE_LINE_BREAKPOINT);
assertThat(guiTest.ideFrame().getEditor().getCurrentLine()).contains("int32_t Engine::HandleInput(");
createAVD();
ideFrameFixture.debugApp(APP_NAME).selectDevice(AVD_NAME).clickOk();
// Wait for the UI App to be up and running, by waiting for the first Frame draw to get hit.
expectBreakPoint("g_engine.DrawFrame()");
// Simulate a screen touch
getEmulatorConnection().tapRunningAvd(400, 400);
// Wait for the Cpp HandleInput() break point to get hit.
expectBreakPoint("Engine* eng = (Engine*)app->userData;");
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class NlPreviewTest method testEditCustomView.
@RunIn(TestGroup.UNRELIABLE)
@Test
public void testEditCustomView() throws Exception {
// Opens the LayoutTest project, opens a layout with a custom view, checks
// that it can't render yet (because the project hasn't been built),
// builds the project, checks that the render works, edits the custom view
// source code, ensures that the render lists the custom view as out of date,
// applies the suggested fix to build the project, and finally asserts that the
// build is now successful.
EditorFixture editor = guiTest.importProjectAndWaitForProjectSyncToFinish("LayoutTest").getEditor().open("app/src/main/res/layout/layout1.xml", EditorFixture.Tab.EDITOR);
NlPreviewFixture preview = editor.getLayoutPreview(false);
preview.waitForRenderToFinish();
assertTrue(preview.hasRenderErrors());
preview.waitForErrorPanelToContain("The following classes could not be found");
preview.waitForErrorPanelToContain("com.android.tools.tests.layout.MyButton");
preview.waitForErrorPanelToContain("Change to android.widget.Button");
GradleInvocationResult result = guiTest.ideFrame().invokeProjectMake();
assertTrue(result.isBuildSuccessful());
// Build completion should trigger re-render
preview.waitForRenderToFinish();
assertFalse(preview.hasRenderErrors());
editor.open("app/src/main/java/com/android/tools/tests/layout/MyButton.java", EditorFixture.Tab.EDITOR).moveBetween("extends Button {", "").enterText(// Next let's edit the custom view source file
" // test").open("app/src/main/res/layout/layout1.xml", // Switch back; should trigger render
EditorFixture.Tab.EDITOR);
preview.waitForRenderToFinish();
preview.waitForErrorPanelToContain("The MyButton custom view has been edited more recently than the last build");
result = guiTest.ideFrame().invokeProjectMake();
assertTrue(result.isBuildSuccessful());
preview.waitForRenderToFinish();
assertFalse(preview.hasRenderErrors());
// Now make some changes to the file which updates the modification timestamp of the source. However,
// also edit them back and save again (which still leaves a new modification timestamp). Gradle will
// *not* rebuild if the file contents have not changed (it uses checksums rather than file timestamps).
// Make sure that we don't get render errors in this scenario! (Regression test for http://b.android.com/76676)
editor.open("app/src/main/java/com/android/tools/tests/layout/MyButton.java", EditorFixture.Tab.EDITOR).moveBetween("extends Button {", "").enterText(" ").invokeAction(EditorFixture.EditorAction.SAVE).invokeAction(EditorFixture.EditorAction.BACK_SPACE).invokeAction(EditorFixture.EditorAction.SAVE);
waitForBackgroundTasks(guiTest.robot());
editor.open("app/src/main/res/layout/layout1.xml", EditorFixture.Tab.EDITOR);
preview.waitForRenderToFinish();
preview.waitForErrorPanelToContain("The MyButton custom view has been edited more recently than the last build");
// this build won't do anything this time, since Gradle notices checksum has not changed
result = guiTest.ideFrame().invokeProjectMake();
assertTrue(result.isBuildSuccessful());
preview.waitForRenderToFinish();
// but our build timestamp check this time will mask the out of date warning
assertFalse(preview.hasRenderErrors());
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class LayoutInspectorTest method launchLayoutInspector.
/**
* <p>This is run to qualify releases. Please involve the test team in substantial changes.
* <p>TR ID: C14581570
* <pre>
* Verifies that the layout inspector launches successfully and shows relevant layout elements
* Test Steps
* 1. Import a project
* 2. Run the Project to Emulator
* 3. Click on Layout Inspector
* Verification
* 1. Verify for Layout elements in Hierarchy View of Layout Inspector
* </pre>
*/
@Ignore("http://b/30795134")
@Test
@RunIn(TestGroup.QA)
public void launchLayoutInspector() throws Exception {
guiTest.ideFrame().runApp("app").selectDevice(AVD_NAME).clickOk();
guiTest.ideFrame().getRunToolWindow().findContent("app").waitForOutput(new PatternTextMatcher(LOCAL_PATH_OUTPUT), 120);
List<String> layoutElements = guiTest.ideFrame().getAndroidToolWindow().selectProcess(PROCESS_NAME).selectDevicesTab().clickLayoutInspector().getLayoutElements();
assertThat(layoutElements).contains("android.widget.RelativeLayout");
assertThat(layoutElements).contains("android.widget.TextView");
assertThat(layoutElements).contains("android.widget.FrameLayout");
}
Aggregations