Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do we need element.followingSiblingBy(tag: string, predicateOrCondition: string | Condition)? #82

Open
yashaka opened this issue Mar 2, 2019 · 0 comments
Labels

Comments

@yashaka
Copy link
Collaborator

yashaka commented Mar 2, 2019

We have:

    get followingSibling(): Element {
        return this.element(by.xpath('./following-sibling::*'));
    }

do we need something like this:

    followingSiblingBy(xpathPredicateOrCondition: string | Condition<Element> = '', tag = '*'): Element {
        if (typeof xpathPredicateOrCondition === 'string') {
            return this.element(by.xpath(`./following-sibling::${tag}${xpathPredicateOrCondition}`));
        }
        return this.all(tag).elementBy(xpathPredicateOrCondition);
    }

The signature also might be like this:

    followingSiblingBy(options: {tag: string, predicate: string, condition: Condition<Element>}= {tag: '*', predicate: '', condition: undefined})

The argument to add is:

  • give user the full power in a more concise helper

The argument against is:

  • it will be needed rarely, why not keep things KISS, and for complicated rare things use just more verbose versions with .all('./following-sibling::div').elementBy(be.visible) or something like that) In fact our "powerful" helper will not be really more concise...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant