ElementInspector serverImage = element("formID:serverImage");
serverImage.assertElementExists(false);
ElementInspector serverText = element("formID:serverText");
serverText.assertElementExists(false);
FoldingPanelInspector serverFoldingPanel = foldingPanel("formID:serverFP");
serverFoldingPanel.assertElementExists();
serverFoldingPanel.toggle().clickAndWait();
serverImage.assertVisible(true);
serverText.assertVisible(true);
serverText.assertText("test server loading mode");
//check 'client' loading mode
element("formID:clientFP::caption").assertVisible(true); //todo: use FoldingPanelInspector in such cases
ElementInspector clientImage = element("formID:clientImage");
clientImage.assertElementExists();
clientImage.assertVisible(false);
ElementInspector clientText = element("formID:clientText");
clientText.assertElementExists();
clientText.assertVisible(false);
FoldingPanelInspector clientFoldingPanel = foldingPanel("formID:clientFP");
clientFoldingPanel.assertElementExists();
clientFoldingPanel.toggle().click();
clientImage.assertVisible(true);
clientText.assertVisible(true);
clientText.assertText("test client loading mode");
//check 'ajax' loading mode
FoldingPanelInspector ajaxFoldingPanel = foldingPanel("formID:ajaxFP");
ajaxFoldingPanel.caption().assertVisible(true);
ElementInspector ajaxImage = element("formID:ajaxImage");
ajaxImage.assertElementExists(false);
ElementInspector ajaxText = element("formID:ajaxText");
ajaxText.assertElementExists(false);
ajaxFoldingPanel.assertElementExists();
ajaxFoldingPanel.toggle().clickAndWait(OpenFacesAjaxLoadingMode.getInstance());
ajaxImage.assertVisible(true);
ajaxText.assertVisible(true);
ajaxText.assertText("test ajax loading mode");
/*check that content loaded once*/
//collapse all FoldingPanels
serverFoldingPanel.toggle().click();
clientFoldingPanel.toggle().click();
ajaxFoldingPanel.toggle().click();
serverFoldingPanel.toggle().click();
serverImage.assertVisible(true);
serverText.assertVisible(true);
clientFoldingPanel.toggle().click();
clientImage.assertVisible(true);
clientText.assertVisible(true);
ajaxFoldingPanel.toggle().click();
ajaxImage.assertVisible(true);
ajaxText.assertVisible(true);
}