<?xml version="1.0" encoding="utf-8"?>
<t:test xmlns:t="http://xproc.org/ns/testsuite/3.0"
        xml:base="/selenium-009.xml"
        name="selenium-009.xml"
        expected="pass"
        features="selenium">
   <t:info>
      <t:title>selenium-009</t:title>
      <t:revision-history>
         <t:revision>
            <t:date>2025-05-23</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Added static options for web server host and port.</p>
            </t:description>
         </t:revision>
         <t:revision>
            <t:date>2025-02-09</t:date>
            <t:author>
               <t:name>Norm Tovey-Walsh</t:name>
            </t:author>
            <t:description xmlns="http://www.w3.org/1999/xhtml">
               <p>Created test.</p>
            </t:description>
         </t:revision>
      </t:revision-history>
   </t:info>
   <t:description xmlns="http://www.w3.org/1999/xhtml">
      <p>Tests that Selenium can find an element by class.</p>
   </t:description>
   <t: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"/>
         <cx:selenium>
            <p:with-option name="arguments" select="('--headless')"/>
            <p:with-input>
               <p:inline content-type="text/plain">script version 0.2 .
page "{$WHOST}/apps/find.html" .
find $span by class = "one" .
output $span to result.
      </p:inline>
            </p:with-input>
         </cx:selenium>
      </p:declare-step>
   </t:pipeline>
   <t:schematron>
      <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:span">The result isn’t an span.</s:assert>
               <s:assert test="h:span = 'one or two'">The wrong element was selected.</s:assert>
            </s:rule>
         </s:pattern>
      </s:schema>
   </t:schematron>
</t:test>
