@Override public boolean test() { items = table.getItems(); for (TableItem item : items) { if (!item.getSWTWidget().isDisposed() && matcher.matches(item.getText())) { item.select(); return true; } } return false; }
public ServiceTestClassWizard selectMixin(String... mixin) { Table table = new DefaultTable(); List<TableItem> items = table.getItems(); for (TableItem item : items) { String text = item.getText(); for (int i = 0; i < mixin.length; i++) { if (mixin[i] != null && mixin[i].equals(text)) { item.setChecked(true); } } } return this; }
@Override public String description() { StringBuffer message = new StringBuffer(); message.append("an item matching ").append(matcher.toString()).append(" in\n"); for (TableItem item : items) { String text = null; if (!item.getSWTWidget().isDisposed()) { text = item.getText(); } message.append("\t").append(text).append("\n"); } return message.toString(); }
@Test public void testImageTab() { pullImage(this.imageName); DockerImagesTab imageTab = new DockerImagesTab(); imageTab.activate(); imageTab.refresh(); new WaitWhile(new JobIsRunning(), TimePeriod.NORMAL); String idFromTable = ""; String repoTagsFromTable = ""; String createdFromTable = ""; String sizeFromTable = ""; for (TableItem item : imageTab.getTableItems()) { if (item.getText(1).contains(imageName)) { idFromTable = item.getText(); repoTagsFromTable = item.getText(1); createdFromTable = item.getText(2); sizeFromTable = item.getText(3).replaceAll(".", "").replaceAll(" MB", ""); item.click(); } } idFromTable = idFromTable.replace("sha256:", ""); PropertiesView propertiesView = new PropertiesView(); propertiesView.open(); propertiesView.selectTab("Info"); String idProp = propertiesView.getProperty("Id").getPropertyValue(); String repoTagsProp = propertiesView.getProperty("RepoTags").getPropertyValue(); String createdProp = propertiesView.getProperty("Created").getPropertyValue(); String sizeProp = propertiesView.getProperty("VirtualSize").getPropertyValue(); assertTrue("Id in table and in Properties do not match!", idProp.contains(idFromTable)); assertTrue( "RepoTags in table and in Properties do not match!", repoTagsProp.equals(repoTagsFromTable)); assertTrue( "Created in table and in Properties do not match!", createdProp.equals(createdFromTable)); assertTrue("Size in table and in Properties do not match!", sizeProp.startsWith(sizeFromTable)); }