Skip to content

Commit 47e81aa

Browse files
authored
Merge pull request #1 from jvelilla/WD_Eiffel_112018
Updated Eiffel Web Driver to use JSON_SERIALIZER and JSON_DESERIALIZE…
2 parents ee276d6 + 38a59b9 commit 47e81aa

Some content is hidden

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

66 files changed

+648
-480
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

examples/examples.ecf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
<exclude>/CVS$</exclude>
88
<exclude>/.svn$</exclude>
99
</file_rule>
10-
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
10+
<option warning="true">
1111
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
1212
</option>
13+
1314
<setting name="console_application" value="true"/>
1415
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
1516
<library name="selenium" location="..\selenium-safe.ecf"/>

selenium-safe.ecf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="ISO-8859-1"?>
2-
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="selenium" uuid="F76D19F7-509C-47B1-B2EA-46FCB05F9893" library_target="selenium">
2+
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-18-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-18-0 http://www.eiffel.com/developers/xml/configuration-1-18-0.xsd" name="selenium" uuid="F76D19F7-509C-47B1-B2EA-46FCB05F9893" library_target="selenium">
33
<target name="selenium">
44
<root all_classes="true"/>
5-
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all" syntax="standard">
6-
<assertions precondition="true" postcondition="true" check="true" invariant="true" supplier_precondition="true"/>
5+
<option warning="true">
6+
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
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: 33 additions & 24 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,48 +24,58 @@ 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
2928
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)
29+
if attached {JSON_OBJECT} a_json as j then
30+
create Result.make_empty
31+
if attached {JSON_STRING} j.item (version_key) as l_item then
32+
Result.set_version (l_item.unescaped_string_32)
33+
end
34+
if attached {JSON_STRING} j.item (revision_key) as l_item then
35+
Result.set_revision (l_item.unescaped_string_32)
36+
end
37+
if attached {JSON_STRING} j.item (time_key) as l_item then
38+
Result.set_time (l_item.unescaped_string_32)
39+
end
3340
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-
4341
end
4442

45-
to_json (o: like object): JSON_OBJECT
43+
to_json (obj: detachable ANY; ctx: JSON_SERIALIZER_CONTEXT): JSON_VALUE
44+
local
45+
jo: JSON_OBJECT
4646
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)
47+
if attached {SE_BUILD_VALUE} obj as o then
48+
create jo.make_with_capacity (3)
49+
if attached o.version as l_version then
50+
jo.put_string (l_version, version_key)
51+
end
52+
if attached o.revision as l_revision then
53+
jo.put_string (l_revision, revision_key)
54+
end
55+
if attached o.time as l_time then
56+
jo.put_string (l_time, time_key)
57+
end
58+
Result := jo
59+
else
60+
create {JSON_NULL} Result
61+
end
5162
end
5263

5364
feature {NONE} -- Implementation
5465

55-
56-
5766
version_key: JSON_STRING
5867
once
59-
create Result.make_json ("version")
68+
create Result.make_from_string ("version")
6069
end
6170

6271
time_key: JSON_STRING
6372
once
64-
create Result.make_json ("time")
73+
create Result.make_from_string ("time")
6574
end
6675

6776
revision_key: JSON_STRING
6877
once
69-
create Result.make_json ("revision")
78+
create Result.make_from_string ("revision")
7079
end
7180

7281
end

0 commit comments

Comments
 (0)