skrape.it icon indicating copy to clipboard operation
skrape.it copied to clipboard

[FEATURE] add support for DOM tree relevant assertions made with assertJ

Open skrapeit opened this issue 4 years ago • 2 comments

skrape{it} should support well-known assertion libraries by adding custom matchers that are relevant when expecting things in the DOM tree. AssertJ is an well-known and nicely extendable assertion library we want to support.

Please add the following custom matchers that can be used on Element objects

isPresent isNotPresent isPresentTimes(n) hasText("") hasTextContainig("") hasTextStartingWith("") hasTextEndingWith("") hasClass("") hasClassContainig("") hasClassStartingWith("") hasClassEndingWith("") hasAttribute("" to "") hasId("") hasIdContainig("") hasIdStartingWith("") hasIdEndingWith("") isDisabled check if element has attribute disabled hasSrc("") hasSrcContaining("") hasSrcStartingWith("") hasSrcEndingWith("") hasTitle("") hasTitleContainig("") hasTitleStartingWith("") hasTitleEndingWith("") hasHref("") hasHrefContainig("") hasHrefStartingWith("") hasHrefEndingWith("")

skrapeit avatar Sep 26 '19 13:09 skrapeit

Is it normal most of those matchers are also listed in https://github.com/skrapeit/skrape.it/issues/7 ? Do we agree what you want is to implement those, not use the underlying assertj or assertk mechanism ? Thus, there is definitely an overlap (matchers would have to be implemented only once in either this or the other issue).

derlin avatar Oct 05 '21 17:10 derlin

Good point. The idea is to have extension for both assertj and assertk. But since assertk is assertj under the hood I guess you are right and assertj support/custom matchers would also work for assertk (maybe, just a guess didn't had a deeper look so far). From that point of view it would make sense to start with assertj support

@derlin are you willing to take this one?

christian-draeger avatar Oct 05 '21 18:10 christian-draeger