use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class BuildTypesTest method addNewBuildType.
/**
* Verifies addition of new build types
* <p>This is run to qualify releases. Please involve the test team in substantial changes.
* <p>TR ID: C14581580
* <pre>
* Test Steps:
* 1. Open the project structure dialog
* 2. Select a module
* 3. Click the Build Types tab
* 4. Create new Build Type and name it newBuildType
* 5. Set properties debuggable and version Name Suffix to valid values
* Verification:
* 1. Open the build.gradle file for that module and verify
* entries for build types to contain new build type added.
* 2. Verify the properties in the file match the values
* set in the project structure flavor dialog
* </pre>
*/
@RunIn(TestGroup.QA)
@Test
public void addNewBuildType() throws Exception {
IdeFrameFixture ideFrame = guiTest.importSimpleApplication();
ProjectStructureDialogFixture projectStructureDialog = ideFrame.openFromMenu(ProjectStructureDialogFixture::find, "File", "Project Structure...");
BuildTypesTabFixture buildTypesTab = projectStructureDialog.selectConfigurable("app").selectBuildTypesTab();
buildTypesTab.setName("newBuildType").setDebuggable("true").setVersionNameSuffix("suffix");
projectStructureDialog.clickOk();
ideFrame.waitForGradleProjectSyncToFinish();
EditorFixture editor = ideFrame.getEditor().open("/app/build.gradle");
String gradleFileContents = editor.getCurrentFileContents();
assertThat(gradleFileContents).containsMatch("newBuildType \\{\\n[\\s]*debuggable true\\n[\\s]*versionNameSuffix 'suffix'\\n[\\s]*\\}");
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class ThemePreviewTest method testToolbarState.
@RunIn(TestGroup.UNRELIABLE)
@Test
public void testToolbarState() throws Exception {
guiTest.importSimpleApplication();
Project project = guiTest.ideFrame().getProject();
EditorFixture editor = guiTest.ideFrame().getEditor();
editor.open("app/src/main/res/layout/activity_my.xml", EditorFixture.Tab.EDITOR);
int savedApiLevel = editor.getLayoutPreview(true).getConfigToolbar().getApiLevel();
editor.open("app/src/main/res/values-v19/styles.xml", EditorFixture.Tab.EDITOR);
editor.moveBetween("PreviewTheme", "");
guiTest.robot().waitForIdle();
assertTrue(ToolWindowManager.getInstance(project).getToolWindow("Theme Preview").isAvailable());
// There is also a v20 styles.xml so in order to preview v19, it has to be selected in the toolbar
editor.getThemePreview(true).getPreviewComponent().requireApi(19);
editor.open("app/src/main/res/values/styles.xml", EditorFixture.Tab.EDITOR);
editor.moveBetween("PreviewTheme", "");
guiTest.robot().waitForIdle();
editor.getThemePreview(true).getPreviewComponent().requireApi(18);
editor.open("app/src/main/res/layout/activity_my.xml", EditorFixture.Tab.EDITOR);
// The API level shouldn't be modified by the theme preview. Regression test for http://b.android.com/201313
assertThat(editor.getLayoutPreview(true).getConfigToolbar().getApiLevel()).isEqualTo(savedApiLevel);
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class DeveloperServicesTest method toggleDevServicesDependencies.
/**
* Verifies that Developer Services dependencies can be added and removed in app build gradle file.
* <p>
* This is run to qualify releases. Please involve the test team in substantial changes.
* <p>
* TR ID: C14581655
* <p>
* <pre>
* Test Steps:
* 1. Import a project.
* 2. Open File > Project Structure
* 3. Developer Services option is listed and contains the following options: Ads, Authentication, Notifications.
* 4. Enable all services.
* 5. Click OK button.
* 6. Open app/build.gradle
* 7. Dependencies are added for each of the enabled services.
* 8. Open File > Structure
* 9. Disable services for Ads, Authentication, Notification.
* 10. Click OK button.
* 11. Open app/build.gradle
* 12. Dependencies are removed for the services.
* Verify:
* Toggling Developer Services dependencies reflects in app build gradle file.
* </pre>
* <p>
* The test checks both the presence of the string and that the build.gradle file is written correctly by parsing it.
*/
@RunIn(TestGroup.QA)
@Test
public void toggleDevServicesDependencies() throws Exception {
IdeFrameFixture ideFrameFixture = guiTest.importSimpleApplication();
ideFrameFixture.openFromMenu(ProjectStructureDialogFixture::find, "File", "Project Structure...").setServiceEnabled("Ads", true).setServiceEnabled("Authentication", true).setServiceEnabled("Notifications", true).clickOk();
String gradleFileContents = getBuildGradleFileContents();
assertThat(gradleFileContents).contains("compile 'com.google.android.gms:play-services-ads:");
assertThat(gradleFileContents).contains("compile 'com.google.android.gms:play-services-auth:");
assertThat(gradleFileContents).contains("compile 'com.google.android.gms:play-services-gcm:");
// Parsing of the Gradle file needs to be done in a ReadAction.
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
GradleBuildModel buildModel = GradleBuildModel.parseBuildFile(getBuildGradleFile(), ideFrameFixture.getProject());
assertThat(dependencyIsPresent(buildModel, "play-services-ads")).isTrue();
assertThat(dependencyIsPresent(buildModel, "play-services-auth")).isTrue();
assertThat(dependencyIsPresent(buildModel, "play-services-gcm")).isTrue();
}
});
// Disable the services.
ideFrameFixture.openFromMenu(ProjectStructureDialogFixture::find, "File", "Project Structure...").setServiceEnabled("Ads", false).setServiceEnabled("Authentication", false).setServiceEnabled("Notifications", false).clickOk();
gradleFileContents = getBuildGradleFileContents();
assertThat(gradleFileContents).doesNotContain("compile 'com.google.android.gms:play-services-ads:");
assertThat(gradleFileContents).doesNotContain("compile 'com.google.android.gms:play-services-auth:");
assertThat(gradleFileContents).doesNotContain("compile 'com.google.android.gms:play-services-gcm:");
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
GradleBuildModel buildModel = GradleBuildModel.parseBuildFile(getBuildGradleFile(), ideFrameFixture.getProject());
assertThat(dependencyIsPresent(buildModel, "play-services-ads")).isFalse();
assertThat(dependencyIsPresent(buildModel, "play-services-auth")).isFalse();
assertThat(dependencyIsPresent(buildModel, "play-services-gcm")).isFalse();
}
});
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class AvdListDialogTest method testCreateAvd.
@RunIn(TestGroup.QA)
@Test
public void testCreateAvd() throws Exception {
guiTest.importSimpleApplication();
AvdManagerDialogFixture avdManagerDialog = guiTest.ideFrame().invokeAvdManager();
AvdEditWizardFixture avdEditWizard = avdManagerDialog.createNew();
avdEditWizard.selectHardware().enterSearchTerm("Nexus").selectHardwareProfile("Nexus 7");
avdEditWizard.clickNext();
ChooseSystemImageStepFixture chooseSystemImageStep = avdEditWizard.getChooseSystemImageStep();
chooseSystemImageStep.selectTab("x86 Images");
chooseSystemImageStep.selectSystemImage("Nougat", "24", "x86", "Android 7.0");
avdEditWizard.clickNext();
ConfigureAvdOptionsStepFixture configureAvdOptionsStep = avdEditWizard.getConfigureAvdOptionsStep();
configureAvdOptionsStep.showAdvancedSettings();
// check default
configureAvdOptionsStep.requireAvdName("Nexus 7 API 24");
configureAvdOptionsStep.setAvdName("Testsuite AVD");
configureAvdOptionsStep.setFrontCamera("Emulated");
avdEditWizard.clickFinish();
guiTest.waitForBackgroundTasks();
// Ensure the AVD was created
avdManagerDialog.selectAvd("Testsuite AVD");
// Then clean it up
avdManagerDialog.deleteAvd("Testsuite AVD");
avdManagerDialog.close();
}
use of com.android.tools.idea.tests.gui.framework.RunIn in project android by JetBrains.
the class LaunchAndroidApplicationTest method testRunOnEmulator.
@RunIn(TestGroup.QA)
@Ignore("https://android-jenkins.corp.google.com/builders/studio-sanity_master-dev/builds/2122")
@Test
public void testRunOnEmulator() throws IOException, ClassNotFoundException {
guiTest.importSimpleApplication();
createAVD();
IdeFrameFixture ideFrameFixture = guiTest.ideFrame();
ideFrameFixture.runApp(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.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(LOCAL_PATH_OUTPUT), 120);
ideFrameFixture.getRunToolWindow().findContent(APP_NAME).waitForOutput(new PatternTextMatcher(RUN_OUTPUT), 120);
ideFrameFixture.getAndroidToolWindow().selectDevicesTab().selectProcess(PROCESS_NAME).clickTerminateApplication();
}
Aggregations