use of org.xwiki.panels.test.po.ApplicationsPanelAdministrationPage in project xwiki-platform by xwiki.
the class ApplicationsPanelAdministrationTest method testApplicationsPanelAdministration.
@Test
public void testApplicationsPanelAdministration() throws Exception {
createApplicationUIXs();
// First: check that the panel displays everything in the right order
checkInitialState(ApplicationsPanel.gotoPage());
// No go to the administration
ApplicationsPanelAdministrationPage appPanelAdminPage = ApplicationsPanelAdministrationPage.gotoPage();
// Check that everything is as expected
checkInitialState(appPanelAdminPage);
// Make changes and revert them, check that it works
applyChanges(appPanelAdminPage);
appPanelAdminPage.revert();
checkInitialState(appPanelAdminPage);
// Do the changes again, and save them
applyChanges(appPanelAdminPage);
appPanelAdminPage.save();
assertTrue(appPanelAdminPage.hasSuccessNotification());
// Go to the panel and see what are the new results
ApplicationsPanel applicationsPanel = ApplicationsPanel.gotoPage();
List<String> applications = applicationsPanel.getApplications();
assertEquals(3, applications.size());
Iterator<String> iterator = applications.iterator();
assertEquals("App3", iterator.next());
assertEquals("App1", iterator.next());
assertEquals("App2", iterator.next());
// Go back to the app panel admin page and verify that the settings are well displayed
appPanelAdminPage = ApplicationsPanelAdministrationPage.gotoPage();
assertFalse(appPanelAdminPage.getApplicationsInBar().contains("Panels"));
assertTrue(appPanelAdminPage.getApplicationsNotInBar().contains("Panels"));
iterator = appPanelAdminPage.getApplicationsInBar().iterator();
assertEquals("App3", iterator.next());
assertEquals("App1", iterator.next());
assertEquals("App2", iterator.next());
// Put the application back to the bar
appPanelAdminPage.addApplicationInBar("Panels");
assertTrue(appPanelAdminPage.getApplicationsInBar().contains("Panels"));
assertFalse(appPanelAdminPage.getApplicationsNotInBar().contains("Panels"));
// Put back the initial order
appPanelAdminPage.moveAppBefore("App1", appPanelAdminPage.getApplicationsInBar().get(0));
appPanelAdminPage.moveAppBefore("App2", appPanelAdminPage.getApplicationsInBar().get(1));
appPanelAdminPage.moveAppBefore("App3", appPanelAdminPage.getApplicationsInBar().get(2));
// Save again
appPanelAdminPage.save();
assertTrue(appPanelAdminPage.hasSuccessNotification());
// Go back to the panel and check everything is good
checkInitialState(ApplicationsPanel.gotoPage());
// Verify that the settings have been saved
checkInitialState(ApplicationsPanelAdministrationPage.gotoPage());
// Cleanup
cleanUp();
}
Aggregations