WebDriver: implement advance user interactions
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 May 2018 06:52:31 +0000 (06:52 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 10 May 2018 06:52:31 +0000 (06:52 +0000)
commitb3c1fb105c56c43e0bc79c6a83132a863a250a72
treedcb1e723a92c259970c2bd6941a59dca0606d10c
parentdf5344a57944fbc27f7e38b469bdcedab5b8e86c
WebDriver: implement advance user interactions
https://bugs.webkit.org/show_bug.cgi?id=174616

Reviewed by Brian Burg.

Source/WebDriver:

Add initial implementation of action commands.

* Actions.h: Added.
(WebDriver::Action::Action):
* CommandResult.cpp:
(WebDriver::CommandResult::CommandResult): Handle MoveTargetOutOfBounds error.
(WebDriver::CommandResult::httpStatusCode const): Ditto.
(WebDriver::CommandResult::errorString const): Ditto.
* CommandResult.h:
* Session.cpp:
(WebDriver::Session::webElementIdentifier): Helper to return the web element id.
(WebDriver::Session::createElement): Use webElementIdentifier().
(WebDriver::Session::extractElementID): Ditto.
(WebDriver::Session::virtualKeyForKeySequence): Add more kay codes includes in the spec.
(WebDriver::mouseButtonForAutomation): Helper to get the mouse button string to pass to automation.
(WebDriver::Session::performMouseInteraction): Use mouseButtonForAutomation().
(WebDriver::Session::getOrCreateInputSource): Ensure an input source for given id and add it to the active input
sources.
(WebDriver::Session::inputSourceState): Return the current input source state for the given id.
(WebDriver::Session::computeInViewCenterPointOfElements): Get the in view center point for the list of elements given.
(WebDriver::automationSourceType): Helper to get the input source type to pass to automation.
(WebDriver::Session::performActions): Process the list of action by tick and generate a list of states to pass
to automation.
(WebDriver::Session::releaseActions): Reset input sources and state table and send a message to automation.
* Session.h:
* WebDriverService.cpp:
(WebDriver::processPauseAction):
(WebDriver::processNullAction):
(WebDriver::processKeyAction):
(WebDriver::actionMouseButton):
(WebDriver::processPointerAction):
(WebDriver::processPointerParameters):
(WebDriver::processInputActionSequence):
(WebDriver::WebDriverService::performActions):
(WebDriver::WebDriverService::releaseActions):
* WebDriverService.h:

Source/WebKit:

Handle origin in case of mouse move transitions.

* UIProcess/Automation/Automation.json: Add MouseMoveOrigin enum and pass it as parameter of InputSourceState
together with optional node handle. Also pass the frame handle to performInteractionSequence command to find the
node in the current browsing context.
* UIProcess/Automation/SimulatedInputDispatcher.cpp:
(WebKit::SimulatedInputKeyFrame::keyFrameToResetInputSources): Ensure we reset the location.
(WebKit::SimulatedInputDispatcher::resolveLocation): Helper to resolve destination location based on current
location and mouse move origin.
(WebKit::SimulatedInputDispatcher::transitionInputSourceToState): Use resolveLocation() in mouse transitions.
(WebKit::SimulatedInputDispatcher::run): Receive and save the frame ID.
(WebKit::SimulatedInputDispatcher::finishDispatching): Reset the frame ID.
* UIProcess/Automation/SimulatedInputDispatcher.h:
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::computeElementLayout): Use even numbers for the callback ID to not conflict with
viewportInViewCenterPointOfElement() callbacks.
(WebKit::WebAutomationSession::didComputeElementLayout): Handle computeElementLayout() or
viewportInViewCenterPointOfElement() requests by calling the right callback depending on whether the ID is odd
or even number.
(WebKit::WebAutomationSession::viewportInViewCenterPointOfElement): Send ComputeElementLayout message to the
WebProcess using odd numbers for the callback ID to not conflict with computeElementLayout() callbacks.
(WebKit::WebAutomationSession::performInteractionSequence): Handle the mouse origin and element handle.
(WebKit::WebAutomationSession::cancelInteractionSequence): Pass the frame ID to the input dispatcher.
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Automation/WebAutomationSessionMacros.h:

WebDriverTests:

Update test expectations.

* TestExpectations.json:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@231632 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebDriver/Actions.h [new file with mode: 0644]
Source/WebDriver/ChangeLog
Source/WebDriver/CommandResult.cpp
Source/WebDriver/CommandResult.h
Source/WebDriver/Session.cpp
Source/WebDriver/Session.h
Source/WebDriver/WebDriverService.cpp
Source/WebDriver/WebDriverService.h
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/Automation/Automation.json
Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.cpp
Source/WebKit/UIProcess/Automation/SimulatedInputDispatcher.h
Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Source/WebKit/UIProcess/Automation/WebAutomationSessionMacros.h
WebDriverTests/ChangeLog
WebDriverTests/TestExpectations.json