Code Search for Developers
 
 
  

htmlunit-set-select-field-success.xml from Jameleon at Krugle


Show htmlunit-set-select-field-success.xml syntax highlighted

<?xml version="1.0" ?>
<!--
    Jameleon HtmlUnit plug-in - A plug-in that uses HtmlUnit to drive web sites
    Copyright (C) 2006 Christian W. Hargraves (engrean@hotmail.com)
    
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111AssertLevel.NO_FUNCTION07 USA
-->

<testcase xmlns="jelly:jameleon" xmlns:jy="jelly:core" name="set text field success">

  <test-case-summary>Tests the htmlunit-set-select-field tag</test-case-summary>
  <test-case-author>Christian Hargraves</test-case-author>
  <test-case-level>ACCEPTANCE</test-case-level>
  <functional-point-tested>htmlunit-set-select-field</functional-point-tested>
  <application-tested>htmlunit-plugin</application-tested>

  <htmlunit-session baseUrl="file:./tst/html/forms.html" beginSession="true">

    <htmlunit-validate
        functionId="Validate that forms page was successfully loaded"
        xpath="//form[@name='testform1']/select[@name='sf_single_values']/option[@value='1' and not(@selected)]"
        title="forms page"/>

    <htmlunit-set-select-field
        functionId="Set select field by the option's value attribute"
        form="testform1"
        fieldName="sf_single_values"
        optionValue="1"
        selected="true"/>

    <htmlunit-validate
        functionId="Validate that option is now selected after being set from it's value attribute"
        xpath="//form[@name='testform1']/select[@name='sf_single_values']/option[@value='1' and @selected]"/>

    <htmlunit-set-select-field
        functionId="Set select field by the option's displayed text"
        form="testform1"
        fieldName="sf_single_values"
        optionText="two"
        selected="true"/>
    <htmlunit-validate
        functionId="Validate that previous selected option is no longer selected"
        xpath="//form[@name='testform1']/select[@name='sf_single_values']/option[@value='1' and not(@selected)]"/>
    <htmlunit-validate
        functionId="Validate that option is now selected after being set from it's displayed text"
        xpath="//form[@name='testform1']/select[@name='sf_single_values']/option[@value='2' and @selected]"/>

    <htmlunit-set-select-field
        functionId="Set select field by the option's index number"
        form="testform1"
        fieldName="sf_single_values"
        optionIndex="3"
        selected="true"/>
    <htmlunit-validate
        functionId="Validate that previous selected option is no longer selected"
        xpath="//form[@name='testform1']/select[@name='sf_single_values']/option[@value='2' and not(@selected)]"/>
    <htmlunit-validate
        functionId="Validate that option is now selected after being set from it's position in the list"
        xpath="//form[@name='testform1']/select[@name='sf_single_values']/option[@value='3' and @selected]"/>

    <htmlunit-set-select-field
        functionId="Select the first value in a field that supports multiple values"
        form="testform1"
        fieldName="sf_multiple_values"
        optionValue="1"
        selected="true"/>

    <htmlunit-validate
        functionId="Validate that 1st option is now selected after being set from it's value attribute"
        xpath="//form[@name='testform1']/select[@name='sf_multiple_values']/option[@value='1' and @selected]"/>

    <htmlunit-set-select-field
        functionId="Select the 2nd value in a field that supports multiple values"
        form="testform1"
        fieldName="sf_multiple_values"
        optionText="three"
        selected="true"/>

    <htmlunit-validate
        functionId="Validate that 1st option is still selected after being set from it's value attribute"
        xpath="//form[@name='testform1']/select[@name='sf_multiple_values']/option[@value='1' and @selected]"/>
    <htmlunit-validate
        functionId="Validate that 2nd option is not set"
        xpath="//form[@name='testform1']/select[@name='sf_multiple_values']/option[@value='2' and not(@selected)]"/>
    <htmlunit-validate
        functionId="Validate that 3rd option is selected after being set from it's optionText"
        xpath="//form[@name='testform1']/select[@name='sf_multiple_values']/option[@value='3' and @selected]"/>

    <htmlunit-set-select-field
        functionId="Select the select field's option defined by the provided XPath"
        xpath="//form[@name='testform1']/select[@name='sf_multiple_values']/option[text()='two']"
        selected="true"/>

    <htmlunit-validate
        functionId="Validate that 1st option is still selected after being set from it's value attribute"
        xpath="//form[@name='testform1']/select[@name='sf_multiple_values']/option[@value='1' and @selected]"/>
    <htmlunit-validate
        functionId="Validate that 2nd option is now set"
        xpath="//form[@name='testform1']/select[@name='sf_multiple_values']/option[@value='2' and @selected]"/>
    <htmlunit-validate
        functionId="Validate that 3rd option is selected after being set from it's optionText"
        xpath="//form[@name='testform1']/select[@name='sf_multiple_values']/option[@value='3' and @selected]"/>

  </htmlunit-session>

</testcase>





See more files for this project here

Jameleon

Jameleon is a data-driven automated testing tool that is easily extensible via plug-ins. Features of applications are automated in Java and tied together independently in XML, creating self-documenting automated test cases.

Project homepage: http://sourceforge.net/projects/jameleon
Programming language(s): Java,XML
License: other

  fineGrainedTests.xml
  htmlunit-click-success.xml
  htmlunit-custom-tag-test.xml
  htmlunit-navigate-success.xml
  htmlunit-record-alerts.xml
  htmlunit-set-checkbox-success.xml
  htmlunit-set-file-field-success.xml
  htmlunit-set-hidden-field-success.xml
  htmlunit-set-password-field-success.xml
  htmlunit-set-radio-button-success.xml
  htmlunit-set-select-field-success.xml
  htmlunit-set-text-area-success.xml
  htmlunit-set-text-field-success.xml
  htmlunit-test-on-load.xml
  htmlunit-validate-textPresent-success.xml
  htmlunit-validate-title-success.xml
  htmlunit-validate-xpath-success.xml
  sampleTest.xml