use of com.android.tools.idea.tests.gui.framework.fixture.MessagesToolWindowFixture.MessageFixture 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.MessageFixture 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);
}
use of com.android.tools.idea.tests.gui.framework.fixture.MessagesToolWindowFixture.MessageFixture in project android by JetBrains.
the class GradleSyncTest method syncDuringOfflineMode.
@Test
public void syncDuringOfflineMode() throws IOException {
String hyperlinkText = "Disable offline mode and sync project";
guiTest.importSimpleApplication();
IdeFrameFixture ideFrame = guiTest.ideFrame();
File buildFile = new File(ideFrame.getProjectPath(), join("app", FN_BUILD_GRADLE));
assertAbout(file()).that(buildFile).isFile();
appendToFile(buildFile, "dependencies { compile 'something:not:exists' }");
GradleSettings gradleSettings = GradleSettings.getInstance(ideFrame.getProject());
gradleSettings.setOfflineWork(true);
ideFrame.requestProjectSync().waitForGradleProjectSyncToFinish();
MessagesToolWindowFixture messagesToolWindow = ideFrame.getMessagesToolWindow();
MessageFixture message = messagesToolWindow.getGradleSyncContent().findMessage(ERROR, firstLineStartingWith("Failed to resolve:"));
HyperlinkFixture hyperlink = message.findHyperlink(hyperlinkText);
hyperlink.click();
assertFalse(gradleSettings.isOfflineWork());
ideFrame.waitForGradleProjectSyncToFinish();
messagesToolWindow = ideFrame.getMessagesToolWindow();
message = messagesToolWindow.getGradleSyncContent().findMessage(ERROR, firstLineStartingWith("Failed to resolve:"));
try {
message.findHyperlink(hyperlinkText);
fail(hyperlinkText + " link still present");
} catch (AssertionError e) {
// After offline mode is disable, the previous hyperlink will disappear after next sync
assertThat(e.getMessage()).contains("Failed to find URL");
assertThat(e.getMessage()).contains(hyperlinkText);
}
}
Aggregations