@Override public String mergeXPath(String leftXPathExpression, String rightXPathExpression) { return ElementFinderUtils.conditionalToAllXPathMerge(leftXPathExpression, rightXPathExpression); } };
@Override public String mergeXPath(String leftXPathExpression, String rightXPathExpression) { return ElementFinderUtils.conditionalToAllXPathMerge(leftXPathExpression, rightXPathExpression); } };
@Test public void conditionalToAllXPathMerge__should_remove_last_condition_of_the_left_expression_if_it_was_just_true() { String mergedXPath = ElementFinderUtils.conditionalToAllXPathMerge(".//*[self::a]/*[true()]", "newStuff"); assertThat(mergedXPath, is("(.//*[self::a]/*)[newStuff]")); }
@Test public void conditionalToAllXPathMerge__should_merge_new_expression_with_left_expression_around_parenthesis() { String mergedXPath = ElementFinderUtils.conditionalToAllXPathMerge(".//*[self::a]/*[@color = 'blue']", "newStuff"); assertThat(mergedXPath, is("(.//*[self::a]/*[@color = 'blue'])[newStuff]")); }