Initial import Selenium binding
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
note
|
||||
description: "Summary description for {SE_BUILD_VALUE_JSON_CONVERTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SE_BUILD_VALUE_JSON_CONVERTER
|
||||
inherit
|
||||
SE_JSON_CONVERTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create object.make_empty
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
object: SE_BUILD_VALUE
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
from_json (j: like to_json): detachable like object
|
||||
do
|
||||
create Result.make_empty
|
||||
if attached {STRING_32} json_to_object (j.item (version_key),Void) as l_item then
|
||||
Result.set_version(l_item)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (revision_key), Void) as l_item then
|
||||
Result.set_revision(l_item)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (time_key),Void) as l_item then
|
||||
Result.set_time(l_item)
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
to_json (o: like object): JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (json.value (o.version), version_key)
|
||||
Result.put (json.value (o.revision), revision_key)
|
||||
Result.put (json.value (o.time), time_key)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
|
||||
version_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("version")
|
||||
end
|
||||
|
||||
time_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("time")
|
||||
end
|
||||
|
||||
revision_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("revision")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,185 @@
|
||||
note
|
||||
description: "Summary description for {SE_CAPABILITIES_JSON_CONVERTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SE_CAPABILITIES_JSON_CONVERTER
|
||||
|
||||
inherit
|
||||
|
||||
SE_JSON_CONVERTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create object.make
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
object: SE_CAPABILITIES
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
from_json (j: like to_json): detachable like object
|
||||
do
|
||||
create Result.make
|
||||
if attached {STRING_32} json_to_object (j.item (browser_name_key), Void) as l_item then
|
||||
Result.set_browser_name(l_item)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (version_key), Void) as l_item then
|
||||
Result.set_version(l_item)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (platform_key), Void) as l_item then
|
||||
Result.set_platform(l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (javascriptenabled_key), Void) as l_item then
|
||||
Result.set_javascript_enabled(l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (takesscreenshot_key), Void) as l_item then
|
||||
Result.set_takes_screenshot(l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (handlesalerts_key ), Void) as l_item then
|
||||
Result.set_handles_alerts(l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (locationcontextenabled_key ), Void) as l_item then
|
||||
Result.set_location_context_enabled (l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (applicationcacheenabled_key ), Void) as l_item then
|
||||
Result.set_application_cache_enabled (l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (browserconnectionenabled_key ), Void) as l_item then
|
||||
Result.set_browser_connection_enabled (l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (cssselectorsenabled_key ), Void) as l_item then
|
||||
Result.set_css_selectors_enabled (l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (webstorageenabled_key ), Void) as l_item then
|
||||
Result.set_web_storage_enabled (l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (rotatable_key ), Void) as l_item then
|
||||
Result.set_rotatable (l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (acceptsslcerts_key ), Void) as l_item then
|
||||
Result.set_accept_ssl_certs (l_item)
|
||||
end
|
||||
if attached {BOOLEAN} json_to_object (j.item (nativeevents_key ), Void) as l_item then
|
||||
Result.set_native_events (l_item)
|
||||
end
|
||||
|
||||
-- if attached {WEB_DRIVER_PROXY} json_to_object (j.item (proxy_key), {WEB_DRIVER_PROXY}) as lv then
|
||||
-- Result.set_proxy(lv)
|
||||
-- end
|
||||
|
||||
end
|
||||
|
||||
to_json (o: like object): JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (json.value (o.browser_name),browser_name_key)
|
||||
Result.put (json.value (o.version),version_key)
|
||||
Result.put (json.value (o.platform),platform_key)
|
||||
Result.put (json.value (o.is_javascript_enabled),javascriptenabled_key)
|
||||
Result.put (json.value (o.takes_screenshot),takesscreenshot_key)
|
||||
Result.put (json.value (o.handles_alerts),handlesalerts_key)
|
||||
Result.put (json.value (o.is_database_enabled),databaseenabled_key)
|
||||
Result.put (json.value (o.is_location_context_enabled),locationcontextenabled_key)
|
||||
Result.put (json.value (o.is_application_cache_enabled),applicationcacheenabled_key)
|
||||
Result.put (json.value (o.is_browser_connection_enabled),browserconnectionenabled_key)
|
||||
Result.put (json.value (o.is_css_selectors_enabled),cssselectorsenabled_key)
|
||||
Result.put (json.value (o.is_web_storage_enabled),webstorageenabled_key)
|
||||
Result.put (json.value (o.is_rotatable),rotatable_key)
|
||||
Result.put (json.value (o.accept_ssl_certs),acceptsslcerts_key)
|
||||
Result.put (json.value (o.native_events),nativeevents_key)
|
||||
--Result.put (json.value (o.proxy),proxy_key)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
browser_name_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("browserName")
|
||||
end
|
||||
|
||||
version_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("version")
|
||||
end
|
||||
|
||||
platform_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("platform")
|
||||
end
|
||||
|
||||
javascriptEnabled_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("javascriptEnabled")
|
||||
end
|
||||
|
||||
takesScreenshot_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("takesScreenshot")
|
||||
end
|
||||
|
||||
handlesAlerts_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("handlesAlerts")
|
||||
end
|
||||
|
||||
databaseEnabled_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("databaseEnabled")
|
||||
end
|
||||
|
||||
locationContextEnabled_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("locationContextEnabled")
|
||||
end
|
||||
|
||||
applicationCacheEnabled_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("applicationCacheEnabled")
|
||||
end
|
||||
|
||||
browserConnectionEnabled_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("browserConnectionEnabled")
|
||||
end
|
||||
|
||||
cssSelectorsEnabled_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("cssSelectorsEnabled")
|
||||
end
|
||||
|
||||
webStorageEnabled_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("webStorageEnabled")
|
||||
end
|
||||
|
||||
rotatable_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("rotatable")
|
||||
end
|
||||
|
||||
acceptSslCerts_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("acceptSslCerts")
|
||||
end
|
||||
|
||||
nativeEvents_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("nativeEvents")
|
||||
end
|
||||
|
||||
proxy_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("proxy")
|
||||
end
|
||||
|
||||
end
|
||||
@@ -0,0 +1,51 @@
|
||||
note
|
||||
description: "Summary description for {SE_JAVA_VALUE_JSON_CONVERTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SE_JAVA_VALUE_JSON_CONVERTER
|
||||
inherit
|
||||
SE_JSON_CONVERTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create object.make_empty
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
object: SE_JAVA_VALUE
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
from_json (j: like to_json): detachable like object
|
||||
do
|
||||
create Result.make_empty
|
||||
if attached {STRING_32} json_to_object (j.item (version_key), Void) as l_item then
|
||||
Result.set_version(l_item)
|
||||
end
|
||||
end
|
||||
|
||||
to_json (o: like object): JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (json.value (o.version), version_key)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
|
||||
version_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("version")
|
||||
end
|
||||
|
||||
end
|
||||
27
library/test/selenium/src/converter/se_json_converter.e
Normal file
27
library/test/selenium/src/converter/se_json_converter.e
Normal file
@@ -0,0 +1,27 @@
|
||||
note
|
||||
description: "Summary description for {SE_JSON_CONVERTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
deferred class
|
||||
SE_JSON_CONVERTER
|
||||
|
||||
inherit
|
||||
JSON_CONVERTER
|
||||
|
||||
feature -- Convertion
|
||||
|
||||
json_to_object (j: detachable JSON_VALUE; a_type: detachable TYPE [detachable ANY]): detachable ANY
|
||||
local
|
||||
l_classname: detachable STRING
|
||||
do
|
||||
if a_type /= Void then
|
||||
l_classname := a_type.name
|
||||
if l_classname.item (1) = '!' then
|
||||
l_classname := l_classname.substring (2, l_classname.count)
|
||||
end
|
||||
end
|
||||
Result := json.object (j, l_classname)
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,73 @@
|
||||
note
|
||||
description: "Summary description for {SE_OS_VALUE_JSON_CONVERTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SE_OS_VALUE_JSON_CONVERTER
|
||||
inherit
|
||||
SE_JSON_CONVERTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create object.make_empty
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
object: SE_OS_VALUE
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
from_json (j: like to_json): detachable like object
|
||||
do
|
||||
create Result.make_empty
|
||||
if attached {STRING_32} json_to_object (j.item (version_key), Void) as l_item then
|
||||
Result.set_version(l_item)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (name_key), Void) as l_item then
|
||||
Result.set_name(l_item)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (architecture_key), Void) as l_item then
|
||||
Result.set_architecture(l_item)
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
to_json (o: like object): JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (json.value (o.architecture), architecture_key)
|
||||
Result.put (json.value (o.name), name_key)
|
||||
Result.put (json.value (o.version), version_key)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
|
||||
version_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("version")
|
||||
end
|
||||
|
||||
name_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("name")
|
||||
end
|
||||
|
||||
architecture_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("arch")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,73 @@
|
||||
note
|
||||
description: "Summary description for {SE_RESPONSE_JSON_CONVERTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SE_RESPONSE_JSON_CONVERTER
|
||||
inherit
|
||||
SE_JSON_CONVERTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create object.make_empty
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
object: SE_RESPONSE
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
from_json (j: like to_json): detachable like object
|
||||
do
|
||||
create Result.make_empty
|
||||
if attached {STRING_32} json_to_object (j.item (session_key), Void) as l_item then
|
||||
Result.set_session_id(l_item)
|
||||
end
|
||||
if attached {INTEGER_32} json_to_object (j.item (status_key), Void) as l_item then
|
||||
Result.set_status(l_item)
|
||||
end
|
||||
if attached {JSON_VALUE} j.item (value_key) as l_item then
|
||||
Result.set_value(l_item.representation)
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
to_json (o: like object): JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (json.value (o.session_id),session_key)
|
||||
Result.put (json.value (o.status), status_key)
|
||||
Result.put (json.value (o.value), value_key)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
|
||||
session_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("sessionId")
|
||||
end
|
||||
|
||||
status_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("status")
|
||||
end
|
||||
|
||||
value_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("value")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
101
library/test/selenium/src/converter/se_status_json_converter.e
Normal file
101
library/test/selenium/src/converter/se_status_json_converter.e
Normal file
@@ -0,0 +1,101 @@
|
||||
note
|
||||
description: "A converter for SE_STATUS"
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SE_STATUS_JSON_CONVERTER
|
||||
|
||||
inherit
|
||||
SE_JSON_CONVERTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create object
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
object: SE_STATUS
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
from_json (j: like to_json): detachable like object
|
||||
do
|
||||
create Result
|
||||
if attached {INTEGER_8} json_to_object (j.item (status_key), Void) as l_ucs then
|
||||
Result.set_status (l_ucs.out)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (session_id_key), Void) as l_ucs then
|
||||
Result.set_session_id (l_ucs)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (state_key), Void) as l_ucs then
|
||||
Result.set_state (l_ucs)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (class_name_key), Void) as l_ucs then
|
||||
Result.set_class_name (l_ucs)
|
||||
end
|
||||
if attached {INTEGER_32} json_to_object (j.item (hash_code_key), Void) as l_ucs then
|
||||
Result.set_hash_code (l_ucs.out)
|
||||
end
|
||||
if attached {SE_STATUS_VALUE} json_to_object (j.item (value_key), {SE_STATUS_VALUE}) as lv then
|
||||
Result.set_value(lv)
|
||||
end
|
||||
end
|
||||
|
||||
to_json (o: like object): JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (json.value (o.status), status_key)
|
||||
Result.put (json.value (o.session_id), session_id_key)
|
||||
Result.put (json.value (o.value), value_key)
|
||||
Result.put (json.value (o.state), state_key)
|
||||
Result.put (json.value (o.class_name), class_name_key)
|
||||
Result.put (json.value (o.hash_code), hash_code_key)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
|
||||
|
||||
status_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("status")
|
||||
end
|
||||
|
||||
session_id_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("sessionId")
|
||||
end
|
||||
|
||||
value_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("value")
|
||||
end
|
||||
|
||||
state_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("state")
|
||||
end
|
||||
|
||||
class_name_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("class")
|
||||
end
|
||||
|
||||
hash_code_key : JSON_STRING
|
||||
once
|
||||
create Result.make_json ("hCode")
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2012, Javier Velilla, Jocelyn Fiat and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
end
|
||||
@@ -0,0 +1,70 @@
|
||||
note
|
||||
description: "Summary description for {SE_STATUS_VALUE_JSON_CONVERTER}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SE_STATUS_VALUE_JSON_CONVERTER
|
||||
inherit
|
||||
SE_JSON_CONVERTER
|
||||
|
||||
create
|
||||
make
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make
|
||||
do
|
||||
create object.make_empty
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
object: SE_STATUS_VALUE
|
||||
|
||||
feature -- Conversion
|
||||
|
||||
from_json (j: like to_json): detachable like object
|
||||
do
|
||||
create Result.make_empty
|
||||
if attached {SE_OS_VALUE} json_to_object (j.item (os_key), {SE_OS_VALUE}) as l_item then
|
||||
Result.set_os_value(l_item)
|
||||
end
|
||||
if attached {SE_JAVA_VALUE} json_to_object (j.item (java_key), {SE_JAVA_VALUE}) as l_item then
|
||||
Result.set_java_value(l_item)
|
||||
end
|
||||
if attached {SE_BUILD_VALUE} json_to_object (j.item (build_key), {SE_BUILD_VALUE}) as l_item then
|
||||
Result.set_build_value(l_item)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
to_json (o: like object): JSON_OBJECT
|
||||
do
|
||||
create Result.make
|
||||
Result.put (json.value (o.os_value), os_key)
|
||||
Result.put (json.value (o.java_value), java_key)
|
||||
Result.put (json.value (o.build_value), build_key)
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
|
||||
|
||||
os_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("os")
|
||||
end
|
||||
|
||||
java_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("java")
|
||||
end
|
||||
|
||||
build_key: JSON_STRING
|
||||
once
|
||||
create Result.make_json ("build")
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user