// Make sure the new version is installed.
getExtensionTestUtils().install(new ExtensionId(extensionId, newVersion));
// Downgrade the extension.
ExtensionAdministrationPage adminPage = ExtensionAdministrationPage.gotoPage().clickAddExtensionsSection();
ExtensionPane extensionPane =
adminPage.getSearchBar().clickAdvancedSearch().search(extensionId, oldVersion).getExtension(0);
Assert.assertEquals("remote-installed", extensionPane.getStatus());
Assert.assertEquals("Version 2.1.4 is installed", extensionPane.getStatusMessage());
extensionPane = extensionPane.downgrade();
// Check the downgrade plan.
List<DependencyPane> downgradePlan = extensionPane.openProgressSection().getJobPlan();
Assert.assertEquals(1, downgradePlan.size());
Assert.assertEquals(extensionId, downgradePlan.get(0).getName());
Assert.assertEquals(oldVersion, downgradePlan.get(0).getVersion());
Assert.assertEquals("remote-installed", downgradePlan.get(0).getStatus());
Assert.assertEquals("Version 2.1.4 is installed", downgradePlan.get(0).getStatusMessage());
// Finish the downgrade and check the downgrade log.
extensionPane = extensionPane.confirm();
Assert.assertEquals("installed", extensionPane.getStatus());
Assert.assertEquals("Installed", extensionPane.getStatusMessage());
List<LogItemPane> log = extensionPane.openProgressSection().getJobLog();
Assert.assertTrue(log.size() > 2);
Assert.assertEquals("info", log.get(2).getLevel());
Assert.assertEquals("Resolving extension [alice-xar-extension 1.3] on namespace [Home]", log.get(2)
.getMessage());
Assert.assertEquals("info", log.get(log.size() - 1).getLevel());