org.eclipse.swtbot.swt.finder.waits.DefaultCondition Java Examples
The following examples show how to use
org.eclipse.swtbot.swt.finder.waits.DefaultCondition.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RemoteBotView.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilIsActive() throws RemoteException { RemoteWorkbenchBot.getInstance() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return isActive(); } @Override public String getFailureMessage() { return "unable to activate the view: " + widget.getTitle(); } }); }
Example #2
Source File: RunOptionsDefaultsComponentTest.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
private void assertStagingLocationCombo(final String... buckets) { bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { spinEvents(); return new SWTBotCombo(stagingLocations).itemCount() == buckets.length; } @Override public String getFailureMessage() { return "missing staging buckets"; } }); Assert.assertArrayEquals(buckets, stagingLocations.getItems()); }
Example #3
Source File: SwtBotTreeUtilities.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
/** Wait until the tree item contains the given text with the timeout specified. */ public static void waitUntilTreeTextMatches( SWTWorkbenchBot bot, final SWTBotTreeItem treeItem, final Matcher<String> textMatcher, long timeout) { bot.waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return textMatcher.matches(treeItem.getText()); } @Override public String getFailureMessage() { Description description = new StringDescription(); description.appendText("Text never matched: "); textMatcher.describeMismatch(treeItem.getText(), description); return description.toString(); } }, timeout); }
Example #4
Source File: CoreSwtbotTools.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Waits until the node collapses. * * @param bot * bot to work with, must not be {@code null} * @param node * node to wait for, must not be {@code null} */ public static void safeBlockingCollapse(final SWTWorkbenchBot bot, final SWTBotTreeItem node) { Assert.isNotNull(bot, ARGUMENT_BOT); Assert.isNotNull(node, ARGUMENT_NODE); if (node.isExpanded()) { node.collapse(); try { bot.waitUntil(new DefaultCondition() { @Override @SuppressWarnings("PMD.JUnit4TestShouldUseTestAnnotation") public boolean test() { return !node.isExpanded(); } @Override public String getFailureMessage() { return "Timeout for node to collapse"; } }, TIMEOUT_FOR_NODE_TO_COLLAPSE_EXPAND); } catch (TimeoutException e) { // Try one last time and do not wait anymore node.collapse(); } } }
Example #5
Source File: BotBdmModelEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public BotBdmModelEditor renameAttribute(String packageName, String businessObject, String oldAttributeName, String newAttributeName) { SWTBotTable attributeTable = getAttributeTable(packageName, businessObject); bot.waitUntil(Conditions.widgetIsEnabled(attributeTable)); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { attributeTable.getTableItem(oldAttributeName).select(); return attributeTable.selectionCount() == 1; } @Override public String getFailureMessage() { return String.format("Cannot select '%s' row in attribute table", oldAttributeName); } }); attributeTable.getTableItem(oldAttributeName).click(); bot.textWithId(SWTBOT_ID_ATTRIBUTE_NAME_TEXTEDITOR) .setText(newAttributeName) .pressShortcut(Keystrokes.CR); attributeTable.setFocus(); return this; }
Example #6
Source File: BotBdmModelEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public BotBdmModelEditor addAttribute(String packageName, String businessObject, String attribute, String type) { SWTBotTable attributeTable = getAttributeTable(packageName, businessObject); attributeTable.unselect(); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return attributeTable.selectionCount() == 0; } @Override public String getFailureMessage() { return "Attribute table should have no selection"; } }); bot.toolbarButtonWithId(AttributeEditionControl.ADD_ATTRIBUTE_BUTTON_ID).click(); SWTBotText botText = bot.textWithId(SWTBOT_ID_ATTRIBUTE_NAME_TEXTEDITOR); botText.setText(attribute); botText.pressShortcut(Keystrokes.CR); setType(packageName, businessObject, attributeTable.getTableItem(attribute), type, attributeTable); return this; }
Example #7
Source File: ConnectorImplementationTest.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Test public void testClassNameSyntax() throws Exception { final String id = "testImplementation"; final String definition = "testEdit"; final String packageName = "org.bonita.connector"; SWTBotConnectorTestUtil.activateConnectorImplementationShell(bot); selectDefinition(definition); bot.textWithLabel(Messages.implementationId + " *").setText(id); bot.textWithLabel("Package *").setText(packageName); bot.textWithLabel(Messages.classNameLabel + " *").setText("MyConnector.Implsfgsdf"); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return !bot.button(IDialogConstants.FINISH_LABEL).isEnabled(); } @Override public String getFailureMessage() { return "finish button should be disabled"; } }); bot.button(IDialogConstants.CANCEL_LABEL).click(); }
Example #8
Source File: CopyToClipboardTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static void assertContextMenuAbsent(final SWTBotTable tableBot, final String text) { fBot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { try { SWTBotPreferences.TIMEOUT = 0; tableBot.contextMenu(text); } catch (WidgetNotFoundException e) { return true; } finally { SWTBotPreferences.TIMEOUT = TIMEOUT; } return false; } @Override public String getFailureMessage() { return text + " context menu present, absent expected."; } }); }
Example #9
Source File: WidgetUtil.java From saros with GNU General Public License v2.0 | 6 votes |
public static SWTBotToolbarButton getToolbarButtonWithRegex( final SWTBotView view, final String regex) { try { new SWTBot() .waitUntil( new DefaultCondition() { @Override public String getFailureMessage() { return "Could not find toolbar button matching " + regex; } @Override public boolean test() throws Exception { return getToolbarButton(view, regex) != null; } }); return getToolbarButton(view, regex); } catch (TimeoutException e) { throw new WidgetNotFoundException( "Timed out waiting for toolbar button matching " + regex, e); // $NON-NLS-1$ } }
Example #10
Source File: SarosView.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilIsInconsistencyDetected() throws RemoteException { RemoteWorkbenchBot.getInstance() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return WidgetUtil.getToolbarButtonWithRegex( view, Pattern.quote(TB_INCONSISTENCY_DETECTED) + ".*") .isEnabled(); } @Override public String getFailureMessage() { return "the toolbar button " + TB_INCONSISTENCY_DETECTED + " is not enabled"; } }); }
Example #11
Source File: SarosView.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilIsInSession() throws RemoteException { new SWTBot() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return isInSession(); } @Override public String getFailureMessage() { return "joining the session failed"; } }); }
Example #12
Source File: SarosView.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilIsDisconnected() throws RemoteException { new SWTBot() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return isDisconnected(); } @Override public String getFailureMessage() { return "unable to disconnect from server"; } }, SarosSWTBotPreferences.SAROS_DEFAULT_TIMEOUT); }
Example #13
Source File: SarosView.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilIsConnected() throws RemoteException { new SWTBot() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return isConnected(); } @Override public String getFailureMessage() { return "unable to connect to server"; } }, SarosSWTBotPreferences.SAROS_DEFAULT_TIMEOUT); }
Example #14
Source File: SwtBotTreeActions.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
private static boolean waitUntilTreeHasTextImpl(SWTBot bot, final TreeItem tree) { try { bot.waitUntil(new DefaultCondition() { @Override public String getFailureMessage() { return "Not all of the nodes in the tree have text."; } @Override public boolean test() throws Exception { return doesTreeItemHaveText(tree); } }); } catch (TimeoutException e) { return false; } return true; }
Example #15
Source File: BotAddConnectorDialog.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * Select the connector in the right list. * * @param pConnectorId */ public void selectConnector(final String pConnectorId) { bot.tree().select("All"); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return "All".equals(bot.tree().selection().get(0).get(0)); } @Override public String getFailureMessage() { return "Root element of the tree not selected."; } }); bot.table().select(pConnectorId); }
Example #16
Source File: CopyToClipboardTest.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
private static void assertClipboardContentsEquals(final String expected) { fBot.waitUntil(new DefaultCondition() { String actual; @Override public boolean test() throws Exception { actual = UIThreadRunnable.syncExec(new StringResult() { @Override public String run() { Clipboard clipboard = new Clipboard(Display.getDefault()); TextTransfer textTransfer = TextTransfer.getInstance(); try { return (String) clipboard.getContents(textTransfer); } finally { clipboard.dispose(); } } }); return expected.equals(actual); } @Override public String getFailureMessage() { return NLS.bind("Clipboard contents:\n{0}\nExpected:\n{1}", actual, expected); } }); }
Example #17
Source File: RemoteBotTree.java From saros with GNU General Public License v2.0 | 6 votes |
/** * ******************************************** * * <p>waits until * * <p>******************************************** */ @Override public void waitUntilItemExists(final String itemText) throws RemoteException { RemoteWorkbenchBot.getInstance() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return existsSubItem(itemText); } @Override public String getFailureMessage() { return "tree '" + widget.getText() + "' does not contain the treeItem: " + itemText; } }); }
Example #18
Source File: RemoteBotTree.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilItemNotExists(final String itemText) throws RemoteException { RemoteWorkbenchBot.getInstance() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return !existsSubItem(itemText); } @Override public String getFailureMessage() { return "tree '" + widget.getText() + "' still contains the treeItem: " + itemText; } }); }
Example #19
Source File: BotContractInputRow.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public BotContractInputRow getChildRow(final int childIndex) { bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return swtBotTreeItem.expand().getItems().length > childIndex; } @Override public String getFailureMessage() { return "Child at index " + childIndex + " doesn't exist"; } }); final SWTBotTreeItem[] items = swtBotTreeItem.expand().getItems(); final SWTBotTreeItem childItem = items[childIndex]; return new BotContractInputRow(bot, childItem); }
Example #20
Source File: RemoteBotEditor.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilIsTextSame(final String otherText) throws RemoteException { RemoteWorkbenchBot.getInstance() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return getText().equals(otherText); } @Override public String getFailureMessage() { return "content of editor '" + widget.getTitle() + "' does not match: " + widget.getText() + " != " + otherText; } }); }
Example #21
Source File: RemoteBotTreeItem.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilSubItemExists(final String subItemText) throws RemoteException { RemoteWorkbenchBot.getInstance() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return existsSubItem(subItemText); } @Override public String getFailureMessage() { return "the tree node '" + widget.getText() + "'does not contain the tree item: " + subItemText; } }); }
Example #22
Source File: RemoteBotTreeItem.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilContextMenuExists(final String... contextNames) throws RemoteException { RemoteWorkbenchBot.getInstance() .waitLongUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return existsContextMenu(contextNames); } @Override public String getFailureMessage() { return "the context menu for context names + " + Arrays.toString(contextNames) + " does not exists"; } }); }
Example #23
Source File: ContextMenusInSessionArea.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilHasWriteAccess() throws RemoteException { log.trace("waiting for participant '" + participantJID.getBase() + "' to gain write access"); new SWTBot() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return hasWriteAccess(); } @Override public String getFailureMessage() { return "unable to grant write access to " + participantJID.getBase(); } }); }
Example #24
Source File: ContextMenusInSessionArea.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilHasReadOnlyAccess() throws RemoteException { log.trace( "waiting for participant '" + participantJID.getBase() + "' to gain read only access"); new SWTBot() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return hasReadOnlyAccess(); } @Override public String getFailureMessage() { return "unable to restrict " + participantJID.getBase() + " to read-only access"; } }); }
Example #25
Source File: ContextMenusInSessionArea.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilIsFollowing() throws RemoteException { log.trace("waiting to follow participant: " + participantJID.getBase()); new SWTBot() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return isFollowing(); } @Override public String getFailureMessage() { return "unable to follow " + participantJID.getBase(); } }); }
Example #26
Source File: ContextMenusInSessionArea.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilIsNotFollowing() throws RemoteException { log.trace("waiting to stop following participant: " + participantJID.getBase()); new SWTBot() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return !isFollowing(); } @Override public String getFailureMessage() { return "unable to stop following mode on user" + participantJID.getBase(); } }); }
Example #27
Source File: PackageExplorerView.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilResourceIsShared(final String path) throws RemoteException { RemoteWorkbenchBot.getInstance() .waitLongUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return isResourceShared(path); } @Override public String getFailureMessage() { return "the resource " + path + " is not shared in the current session"; } }); }
Example #28
Source File: BotGefBaseEditor.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public BotGefBaseEditor(final SWTGefBot bot) { super(bot); WorkbenchContentsFinder workbenchContentsFinder = new WorkbenchContentsFinder(); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return workbenchContentsFinder.findActiveEditor() != null; } @Override public String getFailureMessage() { return "There is no active editor"; } },10000,500); final SWTBotEditor botEditor = bot.activeEditor(); gmfEditor = bot.gefEditor(botEditor.getTitle()); }
Example #29
Source File: ConsoleView.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilCurrentConsoleContainsText(final String text) throws RemoteException { view.bot() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return getCurrentConsoleTextWidget().getText().contains(text); } @Override public String getFailureMessage() { return "the console view does not contain the text: " + text; } }, SarosSWTBotPreferences.SAROS_DEFAULT_TIMEOUT); }
Example #30
Source File: PackageExplorerView.java From saros with GNU General Public License v2.0 | 6 votes |
@Override public void waitUntilFileContentSame(final String otherClassContent, final String... fileNodes) throws RemoteException { RemoteWorkbenchBot.getInstance() .waitUntil( new DefaultCondition() { @Override public boolean test() throws Exception { return getFileContent(fileNodes).equals(otherClassContent); } @Override public String getFailureMessage() { return "the content of the file " + Arrays.toString(fileNodes) + " does not match: " + otherClassContent; } }); }