use of org.eclipse.swtbot.swt.finder.waits.ICondition in project syncope by apache.
the class SyncopeViewTest method canAddReportTemplate.
private boolean canAddReportTemplate() {
SWTBotTreeItem rTemplateHead = syncopeView.bot().tree().getTreeItem("Report Templates");
rTemplateHead.setFocus();
rTemplateHead.select().contextMenu("Add Template").click();
BOT.sleep(1000);
// Filling Dialog details
SWTBotShell addTemplateShell = BOT.activeShell();
addTemplateShell.activate();
BOT.textWithLabel("Key").setText("newReportTemplate");
BOT.button("Add").click();
// wait for template keys reload
BOT.waitWhile(new ICondition() {
@Override
public boolean test() throws Exception {
String title = BOT.activeShell().getText();
return title.equals("Loading Templates");
}
@Override
public void init(final SWTBot bot) {
}
@Override
public String getFailureMessage() {
return "Unable to Login";
}
});
// recheck available templates
syncopeView = BOT.viewByTitle("Apache Syncope Templates");
rTemplateItem = syncopeView.bot().tree().expandNode("Report Templates");
rtemplateList = rTemplateItem.getItems();
return (rtemplateList.length == 3 && rtemplateList[1].getText().equals("newReportTemplate"));
}
use of org.eclipse.swtbot.swt.finder.waits.ICondition in project syncope by apache.
the class SyncopeViewTest method canLoginAdmin.
@Test
public void canLoginAdmin() throws Exception {
SWTBotShell loginShell = BOT.activeShell();
loginShell.activate();
BOT.textWithLabel("Deployment Url").setText(ADDRESS);
BOT.textWithLabel("Username").setText(ADMIN_UNAME);
BOT.textWithLabel("Password").setText(ADMIN_PWD);
BOT.button("Login").click();
BOT.waitWhile(new ICondition() {
@Override
public boolean test() throws Exception {
String title = BOT.activeShell().getText();
return title.equals("Loading Templates");
}
@Override
public void init(final SWTBot bot) {
}
@Override
public String getFailureMessage() {
return "Unable to Login";
}
});
}
use of org.eclipse.swtbot.swt.finder.waits.ICondition in project syncope by apache.
the class SyncopeViewTest method canAddMailTemplate.
private boolean canAddMailTemplate() {
SWTBotTreeItem mTemplateHead = syncopeView.bot().tree().getTreeItem("Mail Templates");
mTemplateHead.setFocus();
mTemplateHead.select().contextMenu("Add Template").click();
BOT.sleep(1000);
// Filling Dialog details
SWTBotShell addTemplateShell = BOT.activeShell();
addTemplateShell.activate();
BOT.textWithLabel("Key").setText("newMailTemplate");
BOT.button("Add").click();
// wait for template keys reload
BOT.waitWhile(new ICondition() {
@Override
public boolean test() throws Exception {
String title = BOT.activeShell().getText();
return title.equals("Loading Templates");
}
@Override
public void init(final SWTBot bot) {
}
@Override
public String getFailureMessage() {
return "Unable to Login";
}
});
// recheck available templates
syncopeView = BOT.viewByTitle("Apache Syncope Templates");
mTemplateItem = syncopeView.bot().tree().expandNode("Mail Templates");
mtemplateList = mTemplateItem.getItems();
return (mtemplateList.length == 5 && mtemplateList[1].getText().equals("newMailTemplate"));
}
use of org.eclipse.swtbot.swt.finder.waits.ICondition in project syncope by apache.
the class SyncopeViewTest method canOpenReportTemplateEditor.
public boolean canOpenReportTemplateEditor() {
final int initBotEditors = BOT.editors().size();
SWTBotTreeItem sample = syncopeView.bot().tree().expandNode("Report Templates").getNode("sample");
sample.setFocus();
sample.select().contextMenu("View Template").click();
// wait for template keys reload
BOT.waitWhile(new ICondition() {
@Override
public boolean test() throws Exception {
return BOT.editors().size() == initBotEditors;
}
@Override
public void init(final SWTBot bot) {
}
@Override
public String getFailureMessage() {
return "Unable to Login";
}
});
return !BOT.editors().isEmpty();
}
use of org.eclipse.swtbot.swt.finder.waits.ICondition in project syncope by apache.
the class SyncopeViewTest method canDeleteMailTemplate.
private boolean canDeleteMailTemplate() {
SWTBotTreeItem mTemplateHead = syncopeView.bot().tree().getTreeItem("Mail Templates");
if (!mTemplateHead.isExpanded()) {
mTemplateHead.expand();
}
SWTBotTreeItem mNewTemplate = mTemplateHead.getNode("newMailTemplate");
mNewTemplate.setFocus();
mNewTemplate.select().contextMenu("Remove template").click();
BOT.sleep(1000);
// wait for template keys reload
BOT.waitWhile(new ICondition() {
@Override
public boolean test() throws Exception {
String title = BOT.activeShell().getText();
return title.equals("Loading Templates");
}
@Override
public void init(final SWTBot bot) {
}
@Override
public String getFailureMessage() {
return "Unable to Login";
}
});
// recheck available templates
mTemplateItem = syncopeView.bot().tree().expandNode("Mail Templates");
mtemplateList = mTemplateItem.getItems();
return (mtemplateList.length == 4);
}
Aggregations