Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
ecommerce-ui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
ecommerce-ui
Commits
b5f638d6
Commit
b5f638d6
authored
Mar 28, 2014
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: added verifyAttribute handling
parent
92606298
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
32 deletions
+70
-32
test/index.html
test/index.html
+70
-32
No files found.
test/index.html
View file @
b5f638d6
...
...
@@ -166,33 +166,33 @@
// oh lord
var
another_string
=
'
<table cellspacing="1" cellpadding="1" border="1" name="SELENIUM-TEST">
'
+
'
<thead>
'
+
'
<tr class="title">
'
+
'
<td>command</td>
'
+
'
<td>selector</td>
'
+
'
<td>value</td>
'
+
//'
<
td
colspan
=
"
3
"
>
SlapOS
UI
Basic
Interaction
<
/td>'
+
'
</tr>
'
+
'
</thead>
'
+
'
<tbody>
'
+
'
<tr>
'
+
'
<td>store</td>
'
+
'
<td><urltool portal_url="" at=""></urltool></td>
'
+
'
<td>base_url</td>
'
+
'
</tr>
'
+
'
<tr>
'
+
'
<td>store</td>
'
+
'
<!-- ERP5TypeTestCase is the default for any UnitTest -->
'
+
'
<td></td>
'
+
'
<td>base_user</td>
'
+
'
</tr>
'
+
'
<tr>
'
+
'
<td>store</td>
'
+
'
<td></td>
'
+
'
<td>base_password</td>
'
+
'
</tr>
'
+
'
<tr>
'
+
'
<table cellspacing="1" cellpadding="1" border="1" name="SELENIUM-TEST">
'
+
'
<thead>
'
+
'
<tr class="title">
'
+
'
<td>command</td>
'
+
'
<td>selector</td>
'
+
'
<td>value</td>
'
+
//'
<
td
colspan
=
"
3
"
>
SlapOS
UI
Basic
Interaction
<
/td>'
+
'
</tr>
'
+
'
</thead>
'
+
'
<tbody>
'
+
'
<tr>
'
+
'
<td>store</td>
'
+
'
<td><urltool portal_url="" at=""></urltool></td>
'
+
'
<td>base_url</td>
'
+
'
</tr>
'
+
'
<tr>
'
+
'
<td>store</td>
'
+
'
<!-- ERP5TypeTestCase is the default for any UnitTest -->
'
+
'
<td></td>
'
+
'
<td>base_user</td>
'
+
'
</tr>
'
+
'
<tr>
'
+
'
<td>store</td>
'
+
'
<td></td>
'
+
'
<td>base_password</td>
'
+
'
</tr>
'
+
'
<tr>
'
+
'
<td>openAndWait</td>
'
+
'
<td>${base_url}</td>
'
+
'
<td></td>
'
+
...
...
@@ -209,12 +209,17 @@
'
</tr>
'
+
'
<tr>
'
+
'
<td>click</td>
'
+
'
<td>//a[.="
Login
"]</td>
'
+
'
<td>//a[.="
Menu
"]</td>
'
+
'
<td></td>
'
+
'
</tr>
'
+
'
<tr>
'
+
'
<td>verifyAttribute</td>
'
+
'
<td>//div[@id="global-panel"]@class</td>
'
+
'
<td>ui-panel-open</td>
'
+
'
</tr>
'
+
'
<tr>
'
+
'
<td>click</td>
'
+
'
<td>//h1[.="
Networks
"]</td>
'
+
'
<td>//h1[.="
My Account
"]</td>
'
+
'
<td></td>
'
+
'
</tr>
'
+
'
<tr>
'
+
...
...
@@ -823,7 +828,8 @@
// (6) add extra column for the comments = QUNIT comment
// (7)
var
tableToParse
,
tag
,
selector
,
val
,
ins
,
find
,
close_async
,
i
,
instruction
,
madeJS
,
add
,
menu_button
,
testForElement
,
countDown
;
instruction
,
madeJS
,
add
,
menu_button
,
testForElement
,
countDown
,
getParam
,
test_value
;
// parse table into objcet
...
...
@@ -831,6 +837,9 @@
$
(
another_string
),
{
"
ignoreHiddenRows
"
:
false
});
getParam
=
function
(
str
)
{
return
str
.
split
(
"
@
"
).
pop
();
};
// extract selector tag
tag
=
function
(
str
)
{
return
str
.
split
(
"
[
"
)[
0
].
replace
(
"
//
"
,
""
);
...
...
@@ -875,6 +884,12 @@
'
$.testHelper.countDown(test, ticker);
'
+
'
}, 1000);
'
+
'
};
'
+
'
$.testHelper.testForAttribute = function(element, attr, value) {
'
+
'
var look = $i.find(element).eq(0).attr(attr);
'
+
'
return $.testHelper.countDown(
'
+
'
look.indexOf(value) > -1
'
+
'
);
'
+
'
};
'
+
'
$.testHelper.testForElement = function(element) {
'
+
'
return $.testHelper.countDown(
'
+
'
$i.find(element).length > 0
'
+
...
...
@@ -884,7 +899,7 @@
len
=
tableToParse
.
length
;
// loop table rows
for
(
i
=
0
;
i
<
8
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
9
;
i
+=
1
)
{
instruction
=
tableToParse
[
i
];
// parse instructions
...
...
@@ -911,10 +926,31 @@
wrap
=
selector
(
ins
);
find
=
tag
(
ins
)
+
wrap
[
0
]
+
val
(
ins
)
+
wrap
[
1
];
madeJS
+=
'
function () {
'
+
'
console.log($("
'
+
find
+
'
"));
$("
'
+
find
+
'
").trigger("click");
'
+
'
$("
'
+
find
+
'
").trigger("click");
'
+
'
},
'
;
break
;
case
"
verifyAttribute
"
:
ins
=
instruction
.
selector
;
wrap
=
selector
(
ins
);
count
+=
1
;
find
=
(
tag
(
ins
)
+
wrap
[
0
]
+
val
(
ins
)
+
wrap
[
1
]).
split
(
"
@
"
)[
0
];
test_value
=
getParam
(
ins
);
madeJS
+=
'
function () {
'
;
switch
(
test_value
)
{
case
'
class
'
:
madeJS
+=
'
var t = $.testHelper.testForAttribute("
'
+
find
+
'
", "
'
+
test_value
+
'
", "
'
+
instruction
.
value
+
'
");
'
;
break
;
}
madeJS
+=
'
}, function (t) {
'
+
'
ok(t, "attribute present");
'
+
'
},
'
;
break
;
case
"
waitForElementPresent
"
:
ins
=
instruction
.
selector
;
wrap
=
selector
(
ins
);
...
...
@@ -929,6 +965,7 @@
}
}
if
(
close_async
)
{
madeJS
+=
'
function() {start();} ]) });
'
;
madeJS
=
madeJS
.
replace
(
/__number__/
,
count
.
toString
());
...
...
@@ -936,6 +973,7 @@
count
=
undefined
;
}
console
.
log
(
madeJS
)
// inject
add
=
d
.
createElement
(
"
script
"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment