selenium-022

Tests drag and drop.

Test is expected to pass.

It requires the following features: selenium or selenium-chrome.

The pipeline

<p:declare-step xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:p="http://www.w3.org/ns/xproc" name="main" version="3.0">
   <p:import href="https://xmlcalabash.com/ext/library/selenium.xpl"/>
   <p:output port="result" sequence="true"/>
   <p:option name="WHOST" select="'http://localhost:8246'" static="true"/>
   <!-- Does not work in firefox; no-sandbox needed when run in (some?) docker containers  -->
   <cx:selenium browser="chrome">
      <p:with-option name="arguments" select="('--headless', '--no-sandbox')"/>
      <p:with-input>
         <p:inline content-type="text/plain">script version 0.2 .
page "{$WHOST}/apps/mouse.html" .

find $eof by id = "eof" .
scroll to $eof .
pause PT0.25S .

find $drag by id = "drag" .
find $target by class = "anotherplace" .
drag and drop $drag to $target .

find $message by id = "message" .
scroll to $message .
pause PT0.25S .

find $message by id = "message" .
output $message to result.
      </p:inline>
      </p:with-input>
   </cx:selenium>
</p:declare-step>

Schematron validation

<s:schema xmlns:s="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
   <s:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
   <s:pattern>
      <s:rule context="/">
         <s:assert test="h:p">The result isn’t a p.</s:assert>
         <s:assert test="h:p = 'Dragged to anotherplace.'">The result is wrong</s:assert>
      </s:rule>
   </s:pattern>
</s:schema>

Revision history

23 May 2025, Norm Tovey-Walsh

Added static options for web server host and port.

09 Feb 2025, Norm Tovey-Walsh

Created test.