use of com.android.tools.idea.tests.gui.framework.fixture.MessagesToolWindowFixture.ContentFixture in project android by JetBrains.
the class GradleSyncTest method withAndroidProjectWithoutVariants.
// Verifies that sync does not fail and user is warned when a project contains an Android module without variants.
// See https://code.google.com/p/android/issues/detail?id=170722
@Test
public void withAndroidProjectWithoutVariants() throws IOException {
guiTest.importSimpleApplication();
IdeFrameFixture ideFrame = guiTest.ideFrame();
assertNotNull(AndroidFacet.getInstance(ideFrame.getModule("app")));
File appBuildFile = new File(ideFrame.getProjectPath(), join("app", FN_BUILD_GRADLE));
assertAbout(file()).that(appBuildFile).isFile();
// Remove all variants.
appendToFile(appBuildFile, "android.variantFilter { variant -> variant.ignore = true }");
ideFrame.requestProjectSync().waitForGradleProjectSyncToFinish();
// Verify user was warned.
ContentFixture syncMessages = ideFrame.getMessagesToolWindow().getGradleSyncContent();
syncMessages.findMessage(ERROR, firstLineStartingWith("The module 'app' is an Android project without build variants"));
// Verify AndroidFacet was removed.
assertNull(AndroidFacet.getInstance(ideFrame.getModule("app")));
}
use of com.android.tools.idea.tests.gui.framework.fixture.MessagesToolWindowFixture.ContentFixture in project android by JetBrains.
the class GradleSyncTest method withPreReleasePlugin.
@Test
public void withPreReleasePlugin() throws IOException {
guiTest.importMultiModule();
guiTest.ideFrame().updateAndroidGradlePluginVersion("1.2.0-beta1").requestProjectSync().waitForGradleProjectSyncToFail();
ContentFixture syncMessages = guiTest.ideFrame().getMessagesToolWindow().getGradleSyncContent();
MessageFixture message = syncMessages.findMessage(ERROR, firstLineStartingWith("Plugin is too old, please update to a more recent version"));
// Verify that the "quick fix" is added.
message.findHyperlink("Fix plugin version and sync project");
}
use of com.android.tools.idea.tests.gui.framework.fixture.MessagesToolWindowFixture.ContentFixture in project android by JetBrains.
the class GradleSyncTest method javaToAndroidModuleDependencies.
// See https://code.google.com/p/android/issues/detail?id=169778
@Test
public void javaToAndroidModuleDependencies() throws IOException {
guiTest.importMultiModule();
IdeFrameFixture ideFrame = guiTest.ideFrame();
Module library3 = ideFrame.getModule("library3");
assertNull(AndroidFacet.getInstance(library3));
File library3BuildFile = new File(ideFrame.getProjectPath(), join("library3", FN_BUILD_GRADLE));
assertAbout(file()).that(library3BuildFile).isFile();
appendToFile(library3BuildFile, "dependencies { compile project(':app') }");
ideFrame.requestProjectSync().waitForGradleProjectSyncToFinish();
ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(library3);
// Verify that the module "library3" doesn't depend on module "app"
ModuleOrderEntry moduleDependency = null;
for (OrderEntry orderEntry : moduleRootManager.getOrderEntries()) {
if (orderEntry instanceof ModuleOrderEntry) {
moduleDependency = (ModuleOrderEntry) orderEntry;
break;
}
}
assertNull(moduleDependency);
ContentFixture syncMessages = ideFrame.getMessagesToolWindow().getGradleSyncContent();
MessageFixture message = syncMessages.findMessage(WARNING, firstLineStartingWith("Ignoring dependency of module 'app' on module 'library3'."));
// Verify if the error message's link goes to the build file.
VirtualFile buildFile = getGradleBuildFile(library3);
message.requireLocation(new File(buildFile.getPath()), 0);
}
Aggregations