Uploaded image for project: 'ZTL'
  1. ZTL
  2. ZTL-24

doScroll in TestCafe is not working

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 2.0.0
    • Fix Version/s: None
    • Component/s: Core
    • Labels:

      Description

      Steps to Reproduce

      <zk>
      	<window title="Test Scrolling" border="none" width="300px" height="200px">
      		<div style="overflow:auto;" vflex="1">
      			<vlayout>
      				Begin
      				<label value="1 hover me" tooltip="help" />
      				<label value="2 hover me" tooltip="help" />
      				<label value="3 hover me" tooltip="help" />
      				<label value="4 hover me" tooltip="help" />
      				<label value="5 hover me" tooltip="help" />
      				<label value="6 hover me" tooltip="help" />
      				<label value="7 hover me" tooltip="help" />
      				<label value="8 hover me" tooltip="help" />
      				<label value="9 hover me" tooltip="help" />
      				<label value="10 hover me" tooltip="help" />
      				<label value="11 hover me" tooltip="help" />
      				<label value="12 hover me" tooltip="help" />
      				<label value="13 hover me" tooltip="help" />
      				<label value="14 hover me" tooltip="help" />
      				<label value="15 hover me" tooltip="help" />
      				<label value="16 hover me" tooltip="help" />
      				<label value="17 hover me" tooltip="help" />
      				<label value="18 hover me" tooltip="help" />
      				<label value="19 hover me" tooltip="help" />
      				<label value="20 hover me" tooltip="help" />
      				End
      			</vlayout>
      		</div>
      	</window>
      </zk>
      
      class BTest extends ZTL4ScalaTestCase {
        @Test
        def test() {
          runZTL(() => {
            val div = jq("@div")
            verScrollAbs(div, 100) // the problem line
            waitResponse()
            verifyNotEquals(0, div.scrollTop)
          })
        }
      }
      

      Current Result

      Calling verScrollAbs(div, 100) doesn't work, the scrollbar position didn't be changed.

      Expected Result

      Calling verScrollAbs(div, 100) works, the scrollbar position is changed.

      Debug Information

      The wgt is a zk widget. It shouldn't be used for changing scrollTop/Left.
      wgt.$n() is the correct one.

      export async function doScroll(config) {
      	config.locator = await config.locator();
      	await ClientFunction(() => {
      		var target = config.locator,
      			isVert = config.scrollType == 'vertical',
      			percent = config.percent,
      			dist = config.dist,
      			wgt = zk.Widget.$(jq(target)),
                      // omitted...
      		var scrollTarget = (body ? body : (cave ? cave : wgt)); // HERE
      		scrollTarget.scrollTop = Math.abs(dist);
              }, {dependencies: {config}})();
      }
      

      Workaround

      Use Selenium to run test cases.

        Attachments

          Activity

            People

            Assignee:
            rudyhuang rudyhuang
            Reporter:
            rudyhuang rudyhuang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour
                1h