Skip to content

Commit a5346bd

Browse files
committed
Updated Eiffel Web Driver to use JSON_SERIALIZER and JSON_DESERIALIZER instead
of deprecated EJSON class. Updated code to use the new JSON SERIALIZATION/DESERIALIZATION API. Removed deprecated JSON features with the new ones. Updated EIS entries with updated documentation. Updated Code to use DEFAULT_HTTP_CLIENT so we can now use EiffelNet or cURL as implementation.
1 parent ee276d6 commit a5346bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+613
-425
lines changed

examples/example_1.e

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ feature -- Access
2222
if attached l_session as l_s then
2323

2424
-- navigate to www.google.com
25-
web_driver.navigate_to_url (l_s.session_id, "http://www.google.com/")
25+
web_driver.navigate_to_url (l_s.session_id, "https://www.google.com/")
2626

2727
-- Find the text input element by its name
2828
if attached {WEB_ELEMENT} web_driver.search_element (l_s.session_id, (create {SE_BY}).name ("q")) as l_element then
2929
-- search something
30-
web_driver.send_event(l_s.session_id, l_element.element,<<"Eiffel Room">>)
30+
web_driver.send_event(l_s.session_id, l_element.element,<<"Eiffel.org">>)
3131

3232
-- Submit Form
3333
web_driver.element_submit (l_s.session_id, l_element.element)

examples/example_double_click.e

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ feature -- Test
4040
web_driver.start_session_chrome
4141

4242
-- Go to Page under test
43-
web_driver.to_url ("http://dl.dropbox.com/u/55228056/DoubleClickDemo.html")
43+
web_driver.to_url ("http://cookbook.seleniumacademy.com/DoubleClickDemo.html")
4444
create wait.make (web_driver,100)
4545

4646
-- Create a new instance of actions
@@ -49,16 +49,16 @@ feature -- Test
4949
-- Find links
5050
if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).id("message")) as l_element then
5151

52-
if attached l_element.get_css_value ("color") as l_value then
52+
if attached l_element.get_css_value ("background-color") as l_value then
5353
-- check
54-
-- Expected_blue: l_value.same_string ("rgb(0, 0, 255)")
54+
-- Expected_blue: l_value.same_string ("%"rgb(0, 0, 255,1)"%")
5555
-- end
5656
end
5757
actions.double_click (l_element).execute
5858

59-
if attached l_element.get_css_value ("background") as l_value then
59+
if attached l_element.get_css_value ("background-color") as l_value then
6060
-- check
61-
-- Expected_yellow: l_value.same_string ("rgb(255, 255, 0)")
61+
-- Expected_yellow: l_value.same_string ("%"rgb(255, 255, 0,1)"%")
6262
-- end
6363
end
6464
end

examples/example_dragging_arround.e

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ feature {NONE} -- Initialization
2222

2323
default_create
2424
do
25-
-- test_dragging_around
25+
test_dragging_around
2626
test_draggable
2727
end
2828

selenium-safe.ecf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
</option>
88
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
99
<library name="encoding" location="$ISE_LIBRARY\library\encoding\encoding-safe.ecf"/>
10-
<library name="http_client" location="$EIFFEL_LIBRARY\EWF\library\network\http_client\http_client-safe.ecf"/>
11-
<library name="json" location="$EIFFEL_LIBRARY\EWF\contrib\library\text\parser\json\library\json-safe.ecf"/>
10+
<library name="http_client" location="$ISE_LIBRARY\contrib\library\network\http_client\http_client.ecf"/>
11+
<library name="json" location="$ISE_LIBRARY\contrib\library\text\parser\json\library\json.ecf" readonly="false"/>
1212
<library name="time" location="$ISE_LIBRARY\library\time\time-safe.ecf"/>
1313
<cluster name="src" location=".\src\" recursive="true">
1414
<file_rule>
Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
note
22
description: "Summary description for {SE_BUILD_VALUE_JSON_CONVERTER}."
3-
author: ""
43
date: "$Date$"
54
revision: "$Revision$"
65

@@ -25,29 +24,43 @@ feature -- Access
2524

2625
feature -- Conversion
2726

28-
from_json (j: like to_json): detachable like object
27+
from_json (a_json: detachable JSON_VALUE; ctx: JSON_DESERIALIZER_CONTEXT; a_type: detachable TYPE [detachable ANY]): detachable like object
28+
--from_json (j: like to_json): detachable like object
2929
do
30-
create Result.make_empty
31-
if attached {STRING_32} json_to_object (j.item (version_key),Void) as l_item then
32-
Result.set_version(l_item)
30+
if attached {JSON_OBJECT} a_json as j then
31+
create Result.make_empty
32+
if attached {JSON_STRING} j.item (version_key) as l_item then
33+
Result.set_version (l_item.unescaped_string_32)
34+
end
35+
if attached {JSON_STRING} j.item (revision_key) as l_item then
36+
Result.set_revision (l_item.unescaped_string_32)
37+
end
38+
if attached {JSON_STRING} j.item (time_key) as l_item then
39+
Result.set_time (l_item.unescaped_string_32)
40+
end
3341
end
34-
if attached {STRING_32} json_to_object (j.item (revision_key), Void) as l_item then
35-
Result.set_revision(l_item)
36-
end
37-
if attached {STRING_32} json_to_object (j.item (time_key),Void) as l_item then
38-
Result.set_time(l_item)
39-
end
40-
41-
42-
4342
end
4443

45-
to_json (o: like object): JSON_OBJECT
44+
to_json (obj: detachable ANY; ctx: JSON_SERIALIZER_CONTEXT): JSON_VALUE
45+
--to_json (o: like object): JSON_OBJECT
46+
local
47+
jo: JSON_OBJECT
4648
do
47-
create Result.make
48-
Result.put (json.value (o.version), version_key)
49-
Result.put (json.value (o.revision), revision_key)
50-
Result.put (json.value (o.time), time_key)
49+
if attached {SE_BUILD_VALUE} obj as o then
50+
create jo.make_with_capacity (3)
51+
if attached o.version as l_version then
52+
jo.put_string (l_version, version_key)
53+
end
54+
if attached o.revision as l_revision then
55+
jo.put_string (l_revision, revision_key)
56+
end
57+
if attached o.time as l_time then
58+
jo.put_string (l_time, time_key)
59+
end
60+
Result := jo
61+
else
62+
create {JSON_NULL} Result
63+
end
5164
end
5265

5366
feature {NONE} -- Implementation
@@ -56,17 +69,17 @@ feature {NONE} -- Implementation
5669

5770
version_key: JSON_STRING
5871
once
59-
create Result.make_json ("version")
72+
create Result.make_from_string ("version")
6073
end
6174

6275
time_key: JSON_STRING
6376
once
64-
create Result.make_json ("time")
77+
create Result.make_from_string ("time")
6578
end
6679

6780
revision_key: JSON_STRING
6881
once
69-
create Result.make_json ("revision")
82+
create Result.make_from_string ("revision")
7083
end
7184

7285
end

0 commit comments

Comments
 (0)