Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eugene Shen
todomvc
Commits
44053122
Commit
44053122
authored
Nov 09, 2015
by
Sam Saccone
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1510 from davidrunger/assertion-order
correct actual vs. expected order in assertions
parents
5a21b118
65225f4f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
tests/testOperations.js
tests/testOperations.js
+9
-9
No files found.
tests/testOperations.js
View file @
44053122
...
@@ -15,7 +15,7 @@ function TestOperations(page) {
...
@@ -15,7 +15,7 @@ function TestOperations(page) {
}
}
function
testIsVisible
(
elements
,
name
)
{
function
testIsVisible
(
elements
,
name
)
{
assert
.
equal
(
1
,
elements
.
length
);
assert
.
equal
(
elements
.
length
,
1
);
elements
[
0
].
isDisplayed
().
then
(
function
(
isDisplayed
)
{
elements
[
0
].
isDisplayed
().
then
(
function
(
isDisplayed
)
{
assert
(
isDisplayed
,
'
the
'
+
name
+
'
element should be displayed
'
);
assert
(
isDisplayed
,
'
the
'
+
name
+
'
element should be displayed
'
);
});
});
...
@@ -23,7 +23,7 @@ function TestOperations(page) {
...
@@ -23,7 +23,7 @@ function TestOperations(page) {
this
.
assertFocussedElementId
=
function
(
expectedId
)
{
this
.
assertFocussedElementId
=
function
(
expectedId
)
{
page
.
getFocussedElementId
().
then
(
function
(
id
)
{
page
.
getFocussedElementId
().
then
(
function
(
id
)
{
assert
.
notEqual
(
-
1
,
id
.
indexOf
(
expectedId
)
,
'
The focused element did not have the expected id
'
+
expectedId
);
assert
.
notEqual
(
id
.
indexOf
(
expectedId
),
-
1
,
'
The focused element did not have the expected id
'
+
expectedId
);
});
});
};
};
...
@@ -43,7 +43,7 @@ function TestOperations(page) {
...
@@ -43,7 +43,7 @@ function TestOperations(page) {
this
.
assertItemCount
=
function
(
itemCount
)
{
this
.
assertItemCount
=
function
(
itemCount
)
{
page
.
getItemElements
().
then
(
function
(
toDoItems
)
{
page
.
getItemElements
().
then
(
function
(
toDoItems
)
{
assert
.
equal
(
itemCount
,
toDoItems
.
length
,
assert
.
equal
(
toDoItems
.
length
,
itemCount
,
itemCount
+
'
items expected in the todo list,
'
+
toDoItems
.
length
+
'
items observed
'
);
itemCount
+
'
items expected in the todo list,
'
+
toDoItems
.
length
+
'
items observed
'
);
});
});
};
};
...
@@ -51,7 +51,7 @@ function TestOperations(page) {
...
@@ -51,7 +51,7 @@ function TestOperations(page) {
this
.
assertClearCompleteButtonText
=
function
(
buttonText
)
{
this
.
assertClearCompleteButtonText
=
function
(
buttonText
)
{
return
page
.
tryGetClearCompleteButton
()
return
page
.
tryGetClearCompleteButton
()
.
getText
().
then
(
function
(
text
)
{
.
getText
().
then
(
function
(
text
)
{
assert
.
equal
(
buttonText
,
t
ext
);
assert
.
equal
(
text
,
buttonT
ext
);
});
});
};
};
...
@@ -94,13 +94,13 @@ function TestOperations(page) {
...
@@ -94,13 +94,13 @@ function TestOperations(page) {
this
.
assertItemInputFieldText
=
function
(
text
)
{
this
.
assertItemInputFieldText
=
function
(
text
)
{
page
.
getItemInputField
().
getText
().
then
(
function
(
inputFieldText
)
{
page
.
getItemInputField
().
getText
().
then
(
function
(
inputFieldText
)
{
assert
.
equal
(
text
,
inputFieldT
ext
);
assert
.
equal
(
inputFieldText
,
t
ext
);
});
});
};
};
this
.
assertItemText
=
function
(
itemIndex
,
textToAssert
)
{
this
.
assertItemText
=
function
(
itemIndex
,
textToAssert
)
{
page
.
getItemLabelAtIndex
(
itemIndex
).
getText
().
then
(
function
(
text
)
{
page
.
getItemLabelAtIndex
(
itemIndex
).
getText
().
then
(
function
(
text
)
{
assert
.
equal
(
text
ToAssert
,
tex
t
,
assert
.
equal
(
text
,
textToAsser
t
,
'
A todo item with text
\'
'
+
textToAssert
+
'
\'
was expected at index
'
+
'
A todo item with text
\'
'
+
textToAssert
+
'
\'
was expected at index
'
+
itemIndex
+
'
, the text
\'
'
+
text
+
'
\'
was observed
'
);
itemIndex
+
'
, the text
\'
'
+
text
+
'
\'
was observed
'
);
});
});
...
@@ -110,13 +110,13 @@ function TestOperations(page) {
...
@@ -110,13 +110,13 @@ function TestOperations(page) {
this
.
assertItems
=
function
(
textArray
)
{
this
.
assertItems
=
function
(
textArray
)
{
return
page
.
getVisibleLabelText
()
return
page
.
getVisibleLabelText
()
.
then
(
function
(
visibleText
)
{
.
then
(
function
(
visibleText
)
{
assert
.
deepEqual
(
textArray
.
sort
(),
visibleText
.
sort
());
assert
.
deepEqual
(
visibleText
.
sort
(),
textArray
.
sort
());
});
});
};
};
this
.
assertItemCountText
=
function
(
textToAssert
)
{
this
.
assertItemCountText
=
function
(
textToAssert
)
{
page
.
getItemsCountElement
().
getText
().
then
(
function
(
text
)
{
page
.
getItemsCountElement
().
getText
().
then
(
function
(
text
)
{
assert
.
equal
(
text
ToAssert
,
text
.
trim
()
,
'
the item count text was incorrect
'
);
assert
.
equal
(
text
.
trim
(),
textToAssert
,
'
the item count text was incorrect
'
);
});
});
};
};
...
@@ -144,7 +144,7 @@ function TestOperations(page) {
...
@@ -144,7 +144,7 @@ function TestOperations(page) {
this
.
assertFilterAtIndexIsSelected
=
function
(
selectedIndex
)
{
this
.
assertFilterAtIndexIsSelected
=
function
(
selectedIndex
)
{
page
.
findByXpath
(
page
.
getSelectedFilterXPathByIndex
(
selectedIndex
+
1
))
page
.
findByXpath
(
page
.
getSelectedFilterXPathByIndex
(
selectedIndex
+
1
))
.
then
(
function
(
elm
)
{
.
then
(
function
(
elm
)
{
assert
.
notEqual
(
undefined
,
elm
,
'
the filter / route at index
'
+
selectedIndex
+
'
should have been selected
'
);
assert
.
notEqual
(
elm
,
undefined
,
'
the filter / route at index
'
+
selectedIndex
+
'
should have been selected
'
);
});
});
};
};
...
...
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