Search in sources :

Example 6 with RunIn

use of com.android.tools.idea.tests.gui.framework.RunIn 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);
}
Also used : IdeFrameFixture(com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture) PatternTextMatcher(org.fest.swing.util.PatternTextMatcher) RunIn(com.android.tools.idea.tests.gui.framework.RunIn)

Example 7 with RunIn

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

the class NewProjectTest method testStillBuildingMessage.

@RunIn(TestGroup.UNRELIABLE)
@Test
public void testStillBuildingMessage() throws Exception {
    // Create a new project and open a layout file.
    // If the first build is still going on when the rendering happens, simply show a message that a build is going on,
    // and check that the message disappears at the end of the build.
    newProject("Test Application").withBriefNames().withMinSdk("15").withoutSync().create();
    final EditorFixture editor = guiTest.ideFrame().getEditor();
    Wait.seconds(5).expecting("file to open").until(() -> "A.java".equals(editor.getCurrentFileName()));
    editor.open("app/src/main/res/layout/activity_a.xml", EditorFixture.Tab.EDITOR);
    NlEditorFixture layoutEditor = editor.getLayoutEditor(true);
    layoutEditor.waitForRenderToFinish();
    if (layoutEditor.hasRenderErrors()) {
        layoutEditor.waitForErrorPanelToContain("still building");
        assertThat(layoutEditor.getErrorText()).doesNotContain("Missing styles");
        guiTest.ideFrame().waitForGradleProjectSyncToFinish();
        layoutEditor.waitForRenderToFinish();
        assertThat(layoutEditor.hasRenderErrors()).isFalse();
    }
}
Also used : NlEditorFixture(com.android.tools.idea.tests.gui.framework.fixture.layout.NlEditorFixture) NlEditorFixture(com.android.tools.idea.tests.gui.framework.fixture.layout.NlEditorFixture) Test(org.junit.Test) RunIn(com.android.tools.idea.tests.gui.framework.RunIn)

Example 8 with RunIn

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

the class NewProjectTest method createNewProjectNameWithSpace.

/**
   * Verify able to create a new project with name containing a space.
   * <p>
   * This is run to qualify releases. Please involve the test team in substantial changes.
   * <p>
   *   <pre>
   *   Steps:
   *   1. Create a new project with min sdk 23.
   *   2. Enter a project name with at least one space.
   *   3. Accept all other defaults.
   *   4. Wait for build to finish.
   *   5. Project is created successfully.
   *   Verify:
   *   Successfully created new project with name containing a space.
   *   </pre>
   */
@RunIn(TestGroup.QA)
@Test
public void createNewProjectNameWithSpace() {
    EditorFixture editor = newProject("Test Application").withMinSdk("23").create().getEditor().open("app/src/main/res/values/strings.xml", EditorFixture.Tab.EDITOR);
    String text = editor.getCurrentFileContents();
    assertThat(text).contains("Test Application");
}
Also used : NlEditorFixture(com.android.tools.idea.tests.gui.framework.fixture.layout.NlEditorFixture) Test(org.junit.Test) RunIn(com.android.tools.idea.tests.gui.framework.RunIn)

Example 9 with RunIn

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

the class NewProjectTest method testCreateNewMobileProject.

/**
   * Verify creating a new project from default template.
   * <p>
   * This is run to qualify releases. Please involve the test team in substantial changes.
   * <p>
   *   <pre>
   *   Steps:
   *   1. From the welcome screen, click on "Start a new Android Studio project".
   *   2. Enter a unique project name.
   *   3. Accept all other defaults.
   *   Verify:
   *   1. Check that the project contains 2 module.
   *   2. Check that MainActivity is in AndroidManifest.
   *   </pre>
   */
@RunIn(TestGroup.QA)
@Test
public void testCreateNewMobileProject() {
    newProject("Test Application").create();
    EditorFixture editor = guiTest.ideFrame().getEditor();
    editor.open("app/src/main/res/layout/activity_main.xml", EditorFixture.Tab.EDITOR);
    guiTest.ideFrame().requireModuleCount(2);
    // Make sure that the activity registration uses the relative syntax
    // (regression test for https://code.google.com/p/android/issues/detail?id=76716)
    editor.open("app/src/main/AndroidManifest.xml", EditorFixture.Tab.EDITOR);
    assertThat(editor.getCurrentFileContents()).contains("\".MainActivity\"");
}
Also used : NlEditorFixture(com.android.tools.idea.tests.gui.framework.fixture.layout.NlEditorFixture) Test(org.junit.Test) RunIn(com.android.tools.idea.tests.gui.framework.RunIn)

Example 10 with RunIn

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

the class NewProjectTest method testRenderResourceInitialization.

@RunIn(TestGroup.UNRELIABLE)
@Test
public void testRenderResourceInitialization() throws IOException {
    // Regression test for https://code.google.com/p/android/issues/detail?id=76966
    newProject("Test Application").withBriefNames().withMinSdk("9").create();
    EditorFixture editor = guiTest.ideFrame().getEditor();
    assertThat(editor.getCurrentFileName()).isEqualTo("A.java");
    editor.close();
    assertThat(editor.getCurrentFileName()).isEqualTo("activity_a.xml");
    NlEditorFixture layoutEditor = editor.getLayoutEditor(true);
    layoutEditor.waitForRenderToFinish();
    guiTest.ideFrame().invokeProjectMake();
    layoutEditor.waitForRenderToFinish();
    assertFalse(layoutEditor.hasRenderErrors());
    guiTest.waitForBackgroundTasks();
}
Also used : NlEditorFixture(com.android.tools.idea.tests.gui.framework.fixture.layout.NlEditorFixture) NlEditorFixture(com.android.tools.idea.tests.gui.framework.fixture.layout.NlEditorFixture) Test(org.junit.Test) RunIn(com.android.tools.idea.tests.gui.framework.RunIn)

Aggregations

RunIn (com.android.tools.idea.tests.gui.framework.RunIn)18 Test (org.junit.Test)13 IdeFrameFixture (com.android.tools.idea.tests.gui.framework.fixture.IdeFrameFixture)7 PatternTextMatcher (org.fest.swing.util.PatternTextMatcher)6 NlEditorFixture (com.android.tools.idea.tests.gui.framework.fixture.layout.NlEditorFixture)4 EditorFixture (com.android.tools.idea.tests.gui.framework.fixture.EditorFixture)3 Ignore (org.junit.Ignore)3 GradleInvocationResult (com.android.tools.idea.gradle.project.build.invoker.GradleInvocationResult)2 ProjectStructureDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.projectstructure.ProjectStructureDialogFixture)2 GradleBuildModel (com.android.tools.idea.gradle.dsl.model.GradleBuildModel)1 InputDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.InputDialogFixture)1 ProjectViewFixture (com.android.tools.idea.tests.gui.framework.fixture.ProjectViewFixture)1 SelectRefactoringDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.SelectRefactoringDialogFixture)1 WelcomeFrameFixture (com.android.tools.idea.tests.gui.framework.fixture.WelcomeFrameFixture)1 AvdEditWizardFixture (com.android.tools.idea.tests.gui.framework.fixture.avdmanager.AvdEditWizardFixture)1 AvdManagerDialogFixture (com.android.tools.idea.tests.gui.framework.fixture.avdmanager.AvdManagerDialogFixture)1 ChooseSystemImageStepFixture (com.android.tools.idea.tests.gui.framework.fixture.avdmanager.ChooseSystemImageStepFixture)1 ConfigureAvdOptionsStepFixture (com.android.tools.idea.tests.gui.framework.fixture.avdmanager.ConfigureAvdOptionsStepFixture)1 BrowseSamplesWizardFixture (com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.BrowseSamplesWizardFixture)1 ConfigureAndroidProjectStepFixture (com.android.tools.idea.tests.gui.framework.fixture.newProjectWizard.ConfigureAndroidProjectStepFixture)1