Skip to content

Latest commit

 

History

History
76 lines (55 loc) · 2.76 KB

2.3.0.md

File metadata and controls

76 lines (55 loc) · 2.76 KB

2.3.0

Changes affecting all DomZipper implementations:

  • Greatly simply the DomZipper base abstractions.

    • DomZipper is now the minimal interface
    • DomZipperBase is the helper abstract class that most implementations can extend for more out-of-the-box functionality.
  • Add to all DomZippers

    • Methods to ensure that DOM doesn't change in the middle of an observation:
      • def startConsistencyCheck(): () => F[Unit]
      • def ensureConsistency[A](f: this.type => A): F[A]
    • def prepare[B](f: Self[F, A] => B): () => B for eagerly validating the DOM path then extracting effectful functions
  • DomZippers are now comonads, meaning the following methods now exist:

    • def extract: A
    • def map[B](f: A => B): Self[F, B]
    • def extend[B](f: Self[F, A] => B): Self[F, B]
    • def duplicate: Self[F, Self[F, A]]
    • def unmap: Self[F, Dom] -- not part of comonad but related; it undoes all .map and .extend application
  • When .collect and .children queries fail, they now include path & html info in the error msg (like descent failures).

New DomZipper implementations

  • Add a dom-zipper-jsoup module to use Jsoup for in-memory HTML in the JVM

  • Add a DomZippersFastAndSlow for fusing two different zippers over identical content; one as a slow source-of-truth zipper with real DOM, and another as a fast inspection-only zipper.

Selenium

  • Add FastDomZipperSelenium as a Jsoup-backed fast alternative to using Selenium for observation. This typically results in a speedup between 5-50x!

  • Add extension methods to Selenium WebDriver:

    • def addStyleTag(content: String): Unit
    • def disableCssAnimation(...): Unit
    • def onShutdownQuit(): Unit
  • .dom is now .dom()

  • Add to MultiBrowser:

    • def onShutdownClose(quit: Boolean = true): Unit
    • def onShutdownCloseRoot(): Unit

JavaScript

  • Revise the JS DomZipper implementations:

    • The {,Html}DomZipper{,At,Root} set of types have all been replaced by a single, simple DomZipperJs
    • You no longer specify the DOM type of the focus and children at the zipper level, but as you extract the DOM (eg. instead of .asHtml.dom use .domAsHtml)
  • Add extension methods to dom.Document:

    • def addStyleTag(content: String): Unit
    • def disableCssAnimation(...): Unit

Changes to core

  • Add .withPreActionAssertion to Dsl instances to perform an assertion just before executing any actions.

Migration

find . -type f -name '*.scala' -exec perl -pi -e '
  s/\b(?:Html)?DomZipper(?:At[A-Za-z0-9_.\[\]]+)?\b/DomZipperJs/g;
  s/(?<=[. ])htmlDomZipper\b/domZipper/g;
  s/(?<=[. ])as *(\[[ a-zA-Z0-9.]+\]) *\.? *dom\b/domAs$1/g;
  s/\. *as([A-Za-z0-9_.\[\]]+) *\. *(doms?)\b/.$2As$1/g;
  s/ *\. *asHtml\b//g;
' {} +