From 67e78a3187fc4bde55030af04358c76b239bf51d Mon Sep 17 00:00:00 2001 From: anttil <anttil> Date: Tue, 11 Sep 2012 07:30:45 +0000 Subject: [PATCH] SWE-2 / SP-263: Fixed delays and bugs of browser grid parsing SVN: 26578 --- .../cisd/openbis/uitest/SampleTest.java | 6 +- .../cisd/openbis/uitest/infra/Browsable.java | 4 +- .../openbis/uitest/infra/SeleniumTest.java | 13 +++- .../matcher/BrowserListsElementMatcher.java | 3 +- .../matcher/CellContainsLinkMatcher.java | 49 +++++++++++++ .../cisd/openbis/uitest/page/BrowserPage.java | 31 ++++++-- .../cisd/openbis/uitest/page/Cell.java | 71 +++++++++++++++++++ .../cisd/openbis/uitest/page/Page.java | 4 ++ .../page/dialog/AddVocabularyDialog.java | 1 + .../uitest/page/tab/SampleBrowser.java | 8 +-- .../cisd/openbis/uitest/type/Experiment.java | 6 +- .../cisd/openbis/uitest/type/Project.java | 6 +- .../openbis/uitest/type/PropertyType.java | 6 +- .../uitest/type/PropertyTypeAssignment.java | 13 ++-- .../cisd/openbis/uitest/type/Sample.java | 12 +++- .../cisd/openbis/uitest/type/SampleType.java | 6 +- .../cisd/openbis/uitest/type/Space.java | 6 +- .../cisd/openbis/uitest/type/Vocabulary.java | 6 +- 18 files changed, 216 insertions(+), 35 deletions(-) create mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/matcher/CellContainsLinkMatcher.java create mode 100644 ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/Cell.java diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/SampleTest.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/SampleTest.java index 19dc41b684e..579cac00e38 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/SampleTest.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/SampleTest.java @@ -16,7 +16,6 @@ package ch.systemsx.cisd.openbis.uitest; -import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import org.testng.annotations.Test; @@ -78,9 +77,8 @@ public class SampleTest extends SeleniumTest Sample sample = create(aSample().ofType(sampleType).withProperty(vocabularyType, "mouse")); - assertThat(true, is(true)); - // assertThat(sampleBrowser().getDataOf(sample), - // containsLink("http://ask.com/web?q=mouse")); + assertThat(sampleBrowser().allSpaces().dataOf(sample).get(vocabularyType.getLabel()), + containsLink("MOUSE", "http://www.ask.com/web?q=MOUSE")); } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/Browsable.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/Browsable.java index b956ad9579d..31522034ed4 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/Browsable.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/Browsable.java @@ -18,12 +18,14 @@ package ch.systemsx.cisd.openbis.uitest.infra; import java.util.Map; +import ch.systemsx.cisd.openbis.uitest.page.Cell; + /** * @author anttil */ public interface Browsable { - public boolean isRepresentedBy(Map<String, String> row); + public boolean isRepresentedBy(Map<String, Cell> row); } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/SeleniumTest.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/SeleniumTest.java index ba92e9b1dc9..743b6d1376e 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/SeleniumTest.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/SeleniumTest.java @@ -35,10 +35,12 @@ import org.testng.annotations.BeforeMethod; import org.testng.annotations.BeforeSuite; import ch.systemsx.cisd.openbis.uitest.infra.matcher.BrowserListsElementMatcher; +import ch.systemsx.cisd.openbis.uitest.infra.matcher.CellContainsLinkMatcher; import ch.systemsx.cisd.openbis.uitest.infra.matcher.PageMatcher; import ch.systemsx.cisd.openbis.uitest.infra.matcher.RegisterSampleFormContainsInputsForPropertiesMatcher; import ch.systemsx.cisd.openbis.uitest.infra.matcher.SampleBrowserSampleTypeDropDownMenuMatcher; import ch.systemsx.cisd.openbis.uitest.page.BrowserPage; +import ch.systemsx.cisd.openbis.uitest.page.Cell; import ch.systemsx.cisd.openbis.uitest.page.Page; import ch.systemsx.cisd.openbis.uitest.page.tab.PropertyTypeAssignmentBrowser; import ch.systemsx.cisd.openbis.uitest.page.tab.PropertyTypeBrowser; @@ -63,6 +65,8 @@ import ch.systemsx.cisd.openbis.uitest.type.VocabularyBuilder; public abstract class SeleniumTest { + public static int IMPLICIT_WAIT = 20; + public static WebDriver driver; private PageProxy pageProxy; @@ -81,7 +85,7 @@ public abstract class SeleniumTest System.setProperty("webdriver.firefox.profile", "default"); */ driver = new FirefoxDriver(); - driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS); + driver.manage().timeouts().implicitlyWait(IMPLICIT_WAIT, TimeUnit.SECONDS); delete(new File("targets/dist")); driver.manage().deleteAllCookies(); @@ -114,7 +118,7 @@ public abstract class SeleniumTest })); openbis.login(User.ADMIN); - // this is here because of space dropdown does not work properly soon after login + // this is because of BIS-184 sampleBrowser().allSpaces(); } @@ -227,6 +231,11 @@ public abstract class SeleniumTest return new RegisterSampleFormContainsInputsForPropertiesMatcher(fields); } + protected Matcher<Cell> containsLink(String text, String url) + { + return new CellContainsLinkMatcher(text, url); + } + protected <T> T create(Builder<T> builder) { return builder.build(); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/matcher/BrowserListsElementMatcher.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/matcher/BrowserListsElementMatcher.java index 79cc3f3681a..73ced742d95 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/matcher/BrowserListsElementMatcher.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/matcher/BrowserListsElementMatcher.java @@ -23,6 +23,7 @@ import org.hamcrest.TypeSafeMatcher; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; import ch.systemsx.cisd.openbis.uitest.page.BrowserPage; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -46,7 +47,7 @@ public class BrowserListsElementMatcher extends @Override public boolean matchesSafely(BrowserPage browser) { - for (Map<String, String> row : browser.getTableContent()) + for (Map<String, Cell> row : browser.getTableContent()) { if (this.expected.isRepresentedBy(row)) { diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/matcher/CellContainsLinkMatcher.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/matcher/CellContainsLinkMatcher.java new file mode 100644 index 00000000000..f9afc3543c6 --- /dev/null +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/infra/matcher/CellContainsLinkMatcher.java @@ -0,0 +1,49 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.uitest.infra.matcher; + +import org.hamcrest.Description; +import org.hamcrest.TypeSafeMatcher; + +import ch.systemsx.cisd.openbis.uitest.page.Cell; + +/** + * @author anttil + */ +public class CellContainsLinkMatcher extends TypeSafeMatcher<Cell> +{ + + private Cell expected; + + public CellContainsLinkMatcher(String text, String url) + { + expected = new Cell(text, url); + } + + @Override + public void describeTo(Description description) + { + description.appendText(this.expected.toString()); + } + + @Override + public boolean matchesSafely(Cell item) + { + return expected.equals(item); + } + +} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/BrowserPage.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/BrowserPage.java index 04b1fad63ff..8af404a7792 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/BrowserPage.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/BrowserPage.java @@ -27,6 +27,7 @@ import java.util.Map; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebElement; +import ch.systemsx.cisd.openbis.uitest.infra.Browsable; import ch.systemsx.cisd.openbis.uitest.infra.SeleniumTest; /** @@ -52,31 +53,51 @@ public abstract class BrowserPage extends NavigationPage return visibleElements; } - public Collection<Map<String, String>> getTableContent() + public Collection<Map<String, Cell>> getTableContent() { - List<Map<String, String>> content = new ArrayList<Map<String, String>>(); + List<Map<String, Cell>> content = new ArrayList<Map<String, Cell>>(); List<WebElement> columnNames = arrange(getVisible(getColumns())); List<WebElement> gridValues = arrange(getVisible(getData())); int index = 0; - Map<String, String> map = new HashMap<String, String>(); + Map<String, Cell> map = new HashMap<String, Cell>(); for (WebElement element : gridValues) { String columnName = columnNames.get(index % columnNames.size()).getText(); - map.put(columnName, element.getText()); + + List<WebElement> a = new ArrayList<WebElement>(this.findElements(element, ".//A")); + if (a.size() > 0) + { + map.put(columnName, new Cell(element.getText(), a.get(0).getAttribute("href"))); + } else + { + map.put(columnName, new Cell(element.getText())); + } index++; if (index % columnNames.size() == 0) { content.add(map); - map = new HashMap<String, String>(); + map = new HashMap<String, Cell>(); } } return content; } + public Map<String, Cell> dataOf(Browsable browsable) + { + for (Map<String, Cell> row : getTableContent()) + { + if (browsable.isRepresentedBy(row)) + { + return row; + } + } + throw new IllegalStateException("Could not find " + browsable + " from " + toString()); + } + private List<WebElement> arrange(Collection<WebElement> elements) { List<WebElement> sorted = new ArrayList<WebElement>(elements); diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/Cell.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/Cell.java new file mode 100644 index 00000000000..067026d3b62 --- /dev/null +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/Cell.java @@ -0,0 +1,71 @@ +/* + * Copyright 2012 ETH Zuerich, CISD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package ch.systemsx.cisd.openbis.uitest.page; + +/** + * @author anttil + */ +public class Cell +{ + private final String text; + + private final String url; + + public Cell(String text) + { + this(text, null); + } + + public Cell(String text, String url) + { + this.text = text; + this.url = url; + } + + public String getText() + { + return text; + } + + public String getUrl() + { + return url; + } + + public boolean hasLink() + { + return this.url != null; + } + + @Override + public String toString() + { + return "Cell[text=" + text + ", url=" + url + "]"; + } + + @Override + public boolean equals(Object o) + { + if (!(o instanceof Cell)) + { + return false; + } + + Cell cell = (Cell) o; + return toString().equals(cell.toString()); + } +} diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/Page.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/Page.java index 38aa9352c0d..5cd5b005422 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/Page.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/Page.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; +import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; @@ -83,7 +84,10 @@ public abstract class Page public Collection<WebElement> findElements(WebElement element, String xpath) { + SeleniumTest.driver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS); Collection<WebElement> elements = element.findElements(By.xpath(xpath)); + SeleniumTest.driver.manage().timeouts().implicitlyWait(SeleniumTest.IMPLICIT_WAIT, + TimeUnit.MILLISECONDS); List<WebElement> wrapped = new ArrayList<WebElement>(); for (WebElement e : elements) { diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/dialog/AddVocabularyDialog.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/dialog/AddVocabularyDialog.java index a4f2ab7cde6..f541facf274 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/dialog/AddVocabularyDialog.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/dialog/AddVocabularyDialog.java @@ -51,6 +51,7 @@ public class AddVocabularyDialog extends Page { this.terms.sendKeys(term + ", "); } + this.url.clear(); this.url.sendKeys(vocabulary.getUrl()); } diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleBrowser.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleBrowser.java index c99db8a7b64..9afef8da26f 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleBrowser.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/page/tab/SampleBrowser.java @@ -31,14 +31,14 @@ public class SampleBrowser extends BrowserPage @FindBys( { - @FindBy(id = "openbis_sample-type-browser-grid"), - @FindBy(xpath = "//*[contains(@class, \"x-grid\") and contains(@class, \"-header \")]") }) + @FindBy(id = "openbis_sample-browser_main-grid"), + @FindBy(xpath = ".//*[contains(@class, \"x-grid\") and contains(@class, \"-header \")]") }) private List<WebElement> columns; @FindBys( { - @FindBy(id = "openbis_sample-type-browser-grid"), - @FindBy(xpath = "//*[contains(@class, \"x-grid\") and contains(@class, \"-col \")]") }) + @FindBy(id = "openbis_sample-browser_main-grid"), + @FindBy(xpath = ".//*[contains(@class, \"x-grid\") and contains(@class, \"-col \")]") }) private List<WebElement> data; @FindBy(id = "openbis_sample-browser_main_add-button") diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Experiment.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Experiment.java index e16241275ed..2c210ccbc0b 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Experiment.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Experiment.java @@ -20,6 +20,7 @@ import java.util.Map; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; import ch.systemsx.cisd.openbis.uitest.infra.EntityType; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -40,9 +41,10 @@ public class Experiment implements EntityType, Browsable } @Override - public boolean isRepresentedBy(Map<String, String> row) + public boolean isRepresentedBy(Map<String, Cell> row) { - return code.equalsIgnoreCase(row.get("Code")); + Cell codeCell = row.get("Code"); + return codeCell != null && codeCell.getText().equalsIgnoreCase(this.code); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Project.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Project.java index 4115f6737ad..53d6be94459 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Project.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Project.java @@ -19,6 +19,7 @@ package ch.systemsx.cisd.openbis.uitest.type; import java.util.Map; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -39,9 +40,10 @@ public class Project implements Browsable } @Override - public boolean isRepresentedBy(Map<String, String> row) + public boolean isRepresentedBy(Map<String, Cell> row) { - return this.code.equalsIgnoreCase(row.get("Code")); + Cell codeCell = row.get("Code"); + return codeCell != null && codeCell.getText().equalsIgnoreCase(this.code); } public String getCode() diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/PropertyType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/PropertyType.java index 714b3ae27d7..1b598d9d3ef 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/PropertyType.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/PropertyType.java @@ -19,6 +19,7 @@ package ch.systemsx.cisd.openbis.uitest.type; import java.util.Map; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -47,9 +48,10 @@ public class PropertyType implements Browsable } @Override - public boolean isRepresentedBy(Map<String, String> row) + public boolean isRepresentedBy(Map<String, Cell> row) { - return this.code.equalsIgnoreCase(row.get("Code")); + Cell codeCell = row.get("Code"); + return codeCell != null && codeCell.getText().equalsIgnoreCase(this.code); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/PropertyTypeAssignment.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/PropertyTypeAssignment.java index 558d237154f..d955b48545b 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/PropertyTypeAssignment.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/PropertyTypeAssignment.java @@ -20,6 +20,7 @@ import java.util.Map; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; import ch.systemsx.cisd.openbis.uitest.infra.EntityType; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -45,11 +46,15 @@ public class PropertyTypeAssignment implements Browsable } @Override - public boolean isRepresentedBy(Map<String, String> row) + public boolean isRepresentedBy(Map<String, Cell> row) { - System.out.println("Searching from " + row); - return propertyType.getCode().equalsIgnoreCase(row.get("Property Type Code")) && - entityType.getCode().equalsIgnoreCase(row.get("Entity Type")); + Cell propertyTypeCode = row.get("Property Type Code"); + Cell entityTypeCode = row.get("Entity Type"); + + return propertyTypeCode != null && + entityTypeCode != null && + propertyTypeCode.getText().equalsIgnoreCase(propertyType.getCode()) && + entityTypeCode.getText().equalsIgnoreCase(entityType.getCode()); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Sample.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Sample.java index 5ffab7cd54c..eed120698b9 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Sample.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Sample.java @@ -21,6 +21,7 @@ import java.util.Map; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; import ch.systemsx.cisd.openbis.uitest.infra.EntityType; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -52,9 +53,16 @@ public class Sample implements EntityType, Browsable } @Override - public boolean isRepresentedBy(Map<String, String> row) + public boolean isRepresentedBy(Map<String, Cell> row) { - return code.equalsIgnoreCase(row.get("Code")); + Cell codeCell = row.get("Code"); + return codeCell != null && codeCell.getText().equalsIgnoreCase(this.code); + } + + @Override + public String toString() + { + return "Sample " + this.code; } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/SampleType.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/SampleType.java index 27d437da3a9..39634922934 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/SampleType.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/SampleType.java @@ -21,6 +21,7 @@ import java.util.Map; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; import ch.systemsx.cisd.openbis.uitest.infra.EntityType; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -66,9 +67,10 @@ public class SampleType implements Browsable, EntityType } @Override - public boolean isRepresentedBy(Map<String, String> row) + public boolean isRepresentedBy(Map<String, Cell> row) { - return this.code.equalsIgnoreCase(row.get("Code")); + Cell codeCell = row.get("Code"); + return codeCell != null && codeCell.getText().equalsIgnoreCase(this.code); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Space.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Space.java index 7147b89d8f6..45b62eaaab7 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Space.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Space.java @@ -19,6 +19,7 @@ package ch.systemsx.cisd.openbis.uitest.type; import java.util.Map; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -36,9 +37,10 @@ public class Space implements Browsable } @Override - public boolean isRepresentedBy(Map<String, String> row) + public boolean isRepresentedBy(Map<String, Cell> row) { - return this.code.equalsIgnoreCase(row.get("Code")); + Cell codeCell = row.get("Code"); + return codeCell != null && codeCell.getText().equalsIgnoreCase(this.code); } @Override diff --git a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Vocabulary.java b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Vocabulary.java index 86909cd8ad8..761ce2cfcf2 100644 --- a/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Vocabulary.java +++ b/ui-test/source/java/ch/systemsx/cisd/openbis/uitest/type/Vocabulary.java @@ -20,6 +20,7 @@ import java.util.Map; import java.util.Set; import ch.systemsx.cisd.openbis.uitest.infra.Browsable; +import ch.systemsx.cisd.openbis.uitest.page.Cell; /** * @author anttil @@ -43,9 +44,10 @@ public class Vocabulary implements Browsable } @Override - public boolean isRepresentedBy(Map<String, String> row) + public boolean isRepresentedBy(Map<String, Cell> row) { - return this.code.equalsIgnoreCase(row.get("Code")); + Cell codeCell = row.get("Code"); + return codeCell != null && codeCell.getText().equalsIgnoreCase(this.code); } @Override -- GitLab