WebKit Bugzilla
Attachment 347010 Details for
Bug 181644
: WebDriver: several element_send_keys tests are failing since added
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
wd-send-keys.diff (text/plain), 9.98 KB, created by
Carlos Garcia Campos
on 2018-08-13 04:30:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Carlos Garcia Campos
Created:
2018-08-13 04:30:30 PDT
Size:
9.98 KB
patch
obsolete
>diff --git a/Source/WebDriver/ChangeLog b/Source/WebDriver/ChangeLog >index 7c012d3e6ab..bf598e90e88 100644 >--- a/Source/WebDriver/ChangeLog >+++ b/Source/WebDriver/ChangeLog >@@ -1,3 +1,24 @@ >+2018-08-13 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ WebDriver: several element_send_keys tests are failing since added >+ https://bugs.webkit.org/show_bug.cgi?id=181644 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is because we are implementing an old version of the spec that received a "value" parameter to send keys >+ command, instead of the "text" one. >+ >+ 14.3 Element Send Keys >+ https://w3c.github.io/webdriver/#element-send-keys >+ >+ * Session.cpp: >+ (WebDriver::Session::virtualKeyForKey): Receive a single character instead of a sequence. >+ (WebDriver::Session::elementSendKeys): It now receives a String and passes every character to virtualKeyForKey. >+ (WebDriver::Session::performActions): Pass first character of sequence to virtualKeyForKey. >+ * Session.h: >+ * WebDriverService.cpp: >+ (WebDriver::WebDriverService::elementSendKeys): Get text as a String, instead of value as an array. >+ > 2018-08-12 Carlos Garcia Campos <cgarcia@igalia.com> > > WebDriver: do not handle prompts that appear while running scripts >diff --git a/Source/WebDriver/Session.cpp b/Source/WebDriver/Session.cpp >index e766585bd0a..5c52e15cc3d 100644 >--- a/Source/WebDriver/Session.cpp >+++ b/Source/WebDriver/Session.cpp >@@ -1579,12 +1579,12 @@ void Session::elementClear(const String& elementID, Function<void (CommandResult > }); > } > >-String Session::virtualKeyForKeySequence(const String& keySequence, KeyModifier& modifier) >+String Session::virtualKeyForKey(UChar key, KeyModifier& modifier) > { > // §17.4.2 Keyboard Actions. > // https://www.w3.org/TR/webdriver/#keyboard-actions > modifier = KeyModifier::None; >- switch (keySequence[0]) { >+ switch (key) { > case 0xE001U: > return "Cancel"_s; > case 0xE002U: >@@ -1717,14 +1717,14 @@ String Session::virtualKeyForKeySequence(const String& keySequence, KeyModifier& > return String(); > } > >-void Session::elementSendKeys(const String& elementID, Vector<String>&& keys, Function<void (CommandResult&&)>&& completionHandler) >+void Session::elementSendKeys(const String& elementID, const String& text, Function<void (CommandResult&&)>&& completionHandler) > { > if (!m_toplevelBrowsingContext) { > completionHandler(CommandResult::fail(CommandResult::ErrorCode::NoSuchWindow)); > return; > } > >- handleUserPrompts([this, elementID, keys = WTFMove(keys), completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { >+ handleUserPrompts([this, elementID, text, completionHandler = WTFMove(completionHandler)](CommandResult&& result) mutable { > if (result.isError()) { > completionHandler(WTFMove(result)); > return; >@@ -1751,19 +1751,21 @@ void Session::elementSendKeys(const String& elementID, Vector<String>&& keys, Fu > parameters->setString("frameHandle"_s, m_currentBrowsingContext.value()); > parameters->setString("function"_s, focusScript); > parameters->setArray("arguments"_s, WTFMove(arguments)); >- m_host->sendCommandToBackend("evaluateJavaScriptFunction"_s, WTFMove(parameters), [this, protectedThis = makeRef(*this), keys = WTFMove(keys), completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) mutable { >+ m_host->sendCommandToBackend("evaluateJavaScriptFunction"_s, WTFMove(parameters), [this, protectedThis = makeRef(*this), text, completionHandler = WTFMove(completionHandler)](SessionHost::CommandResponse&& response) mutable { > if (response.isError || !response.responseObject) { > completionHandler(CommandResult::fail(WTFMove(response.responseObject))); > return; > } > > unsigned stickyModifiers = 0; >+ auto textLength = text.length(); > Vector<KeyboardInteraction> interactions; >- interactions.reserveInitialCapacity(keys.size()); >- for (const auto& key : keys) { >+ interactions.reserveInitialCapacity(textLength); >+ for (unsigned i = 0; i < textLength; ++i) { >+ auto key = text[i]; > KeyboardInteraction interaction; > KeyModifier modifier; >- auto virtualKey = virtualKeyForKeySequence(key, modifier); >+ auto virtualKey = virtualKeyForKey(key, modifier); > if (!virtualKey.isNull()) { > interaction.key = virtualKey; > if (modifier != KeyModifier::None) { >@@ -1774,7 +1776,7 @@ void Session::elementSendKeys(const String& elementID, Vector<String>&& keys, Fu > interaction.type = KeyboardInteractionType::KeyRelease; > } > } else >- interaction.text = key; >+ interaction.text = String(&key, 1); > interactions.uncheckedAppend(WTFMove(interaction)); > } > >@@ -2299,7 +2301,7 @@ void Session::performActions(Vector<Vector<Action>>&& actionsByTick, Function<vo > break; > case Action::Subtype::KeyDown: { > KeyModifier modifier; >- auto virtualKey = virtualKeyForKeySequence(action.key.value(), modifier); >+ auto virtualKey = virtualKeyForKey(action.key.value()[0], modifier); > if (!virtualKey.isNull()) > currentState.pressedVirtualKey = virtualKey; > else >diff --git a/Source/WebDriver/Session.h b/Source/WebDriver/Session.h >index 72ab07dba75..d3fbcb777ed 100644 >--- a/Source/WebDriver/Session.h >+++ b/Source/WebDriver/Session.h >@@ -106,7 +106,7 @@ public: > void isElementDisplayed(const String& elementID, Function<void (CommandResult&&)>&&); > void elementClick(const String& elementID, Function<void (CommandResult&&)>&&); > void elementClear(const String& elementID, Function<void (CommandResult&&)>&&); >- void elementSendKeys(const String& elementID, Vector<String>&& keys, Function<void (CommandResult&&)>&&); >+ void elementSendKeys(const String& elementID, const String& text, Function<void (CommandResult&&)>&&); > void executeScript(const String& script, RefPtr<JSON::Array>&& arguments, ExecuteScriptMode, Function<void (CommandResult&&)>&&); > void getAllCookies(Function<void (CommandResult&&)>&&); > void getNamedCookie(const String& name, Function<void (CommandResult&&)>&&); >@@ -184,7 +184,7 @@ private: > Alternate = 1 << 2, > Meta = 1 << 3, > }; >- String virtualKeyForKeySequence(const String& keySequence, KeyModifier&); >+ String virtualKeyForKey(UChar, KeyModifier&); > void performKeyboardInteractions(Vector<KeyboardInteraction>&&, Function<void (CommandResult&&)>&&); > > struct InputSourceState { >diff --git a/Source/WebDriver/WebDriverService.cpp b/Source/WebDriver/WebDriverService.cpp >index c33646f1115..076ca0040d8 100644 >--- a/Source/WebDriver/WebDriverService.cpp >+++ b/Source/WebDriver/WebDriverService.cpp >@@ -1393,32 +1393,13 @@ void WebDriverService::elementSendKeys(RefPtr<JSON::Object>&& parameters, Functi > if (!elementID) > return; > >- RefPtr<JSON::Array> valueArray; >- if (!parameters->getArray("value"_s, valueArray)) { >- completionHandler(CommandResult::fail(CommandResult::ErrorCode::InvalidArgument)); >- return; >- } >- >- unsigned valueArrayLength = valueArray->length(); >- if (!valueArrayLength) { >- completionHandler(CommandResult::fail(CommandResult::ErrorCode::InvalidArgument)); >- return; >- } >- Vector<String> value; >- value.reserveInitialCapacity(valueArrayLength); >- for (unsigned i = 0; i < valueArrayLength; ++i) { >- if (auto keyValue = valueArray->get(i)) { >- String key; >- if (keyValue->asString(key)) >- value.uncheckedAppend(WTFMove(key)); >- } >- } >- if (!value.size()) { >+ String text; >+ if (!parameters->getString("text"_s, text) || text.isEmpty()) { > completionHandler(CommandResult::fail(CommandResult::ErrorCode::InvalidArgument)); > return; > } > >- m_session->elementSendKeys(elementID.value(), WTFMove(value), WTFMove(completionHandler)); >+ m_session->elementSendKeys(elementID.value(), text, WTFMove(completionHandler)); > } > > static bool findScriptAndArgumentsOrCompleteWithError(JSON::Object& parameters, Function<void (CommandResult&&)>& completionHandler, String& script, RefPtr<JSON::Array>& arguments) >diff --git a/WebDriverTests/ChangeLog b/WebDriverTests/ChangeLog >index 649ff4b3215..4f47164be4f 100644 >--- a/WebDriverTests/ChangeLog >+++ b/WebDriverTests/ChangeLog >@@ -1,3 +1,14 @@ >+2018-08-13 Carlos Garcia Campos <cgarcia@igalia.com> >+ >+ WebDriver: several element_send_keys tests are failing since added >+ https://bugs.webkit.org/show_bug.cgi?id=181644 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Update text expectations. >+ >+ * TestExpectations.json: >+ > 2018-08-12 Michael Catanzaro <mcatanzaro@igalia.com> > > Unreviewed GTK test gardening >diff --git a/WebDriverTests/TestExpectations.json b/WebDriverTests/TestExpectations.json >index 65b74498e27..fdb3d9a4c8c 100644 >--- a/WebDriverTests/TestExpectations.json >+++ b/WebDriverTests/TestExpectations.json >@@ -585,12 +585,6 @@ > "imported/w3c/webdriver/tests/element_send_keys/form_controls.py": { > "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/182331"}} > }, >- "imported/w3c/webdriver/tests/element_send_keys/interactability.py": { >- "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/181644"}} >- }, >- "imported/w3c/webdriver/tests/element_send_keys/scroll_into_view.py": { >- "expected": {"all": {"status": ["FAIL"], "bug": "webkit.org/b/181644"}} >- }, > "imported/w3c/webdriver/tests/execute_script/collections.py": { > "subtests": { > "test_arguments": {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
mcatanzaro
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 181644
: 347010