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
Sven Franck
todomvc
Commits
4a4016ff
Commit
4a4016ff
authored
Jan 29, 2014
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update browser-tests JS style
parent
d7be11ee
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
841 additions
and
819 deletions
+841
-819
browser-tests/Gruntfile.js
browser-tests/Gruntfile.js
+14
-15
browser-tests/allTests.js
browser-tests/allTests.js
+46
-27
browser-tests/knownIssues.js
browser-tests/knownIssues.js
+87
-87
browser-tests/page.js
browser-tests/page.js
+146
-146
browser-tests/pageLaxMode.js
browser-tests/pageLaxMode.js
+19
-19
browser-tests/test.js
browser-tests/test.js
+371
-370
browser-tests/testOperations.js
browser-tests/testOperations.js
+158
-155
No files found.
browser-tests/Gruntfile.js
View file @
4a4016ff
module
.
exports
=
function
(
grunt
)
{
module
.
exports
=
function
(
grunt
)
{
'
use strict
'
;
grunt
.
loadNpmTasks
(
'
grunt-simple-mocha
'
);
grunt
.
loadNpmTasks
(
'
grunt-simple-mocha
'
);
var
gruntConfig
=
{
grunt
.
initConfig
({
simplemocha
:
{
simplemocha
:
{
options
:
{
options
:
{
reporter
:
'
mocha-known-issues-reporter
'
reporter
:
'
mocha-known-issues-reporter
'
},
},
files
:
{
files
:
{
src
:
'
allTests.js
'
src
:
'
allTests.js
'
}
}
}
}
};
});
grunt
.
initConfig
(
gruntConfig
);
// build tasks
// build tasks
grunt
.
registerTask
(
'
test
'
,
[
'
simplemocha
'
]);
grunt
.
registerTask
(
'
test
'
,
[
'
simplemocha
'
]);
};
};
browser-tests/allTests.js
View file @
4a4016ff
var
testSuite
=
require
(
'
./test.js
'
),
'
use strict
'
;
fs
=
require
(
'
fs
'
),
argv
=
require
(
'
optimist
'
).
default
(
'
laxMode
'
,
false
).
argv
,
rootUrl
=
"
http://localhost:8000/
"
,
frameworkNamePattern
=
/^
[
a-z-_
]
+$/
;
// collect together the framework names from each of the subfolders
var
testSuite
=
require
(
'
./test.js
'
);
var
list
=
fs
.
readdirSync
(
"
../architecture-examples/
"
)
var
fs
=
require
(
'
fs
'
);
.
map
(
function
(
folderName
)
{
return
{
name
:
folderName
,
path
:
"
architecture-examples/
"
+
folderName
}
});
var
argv
=
require
(
'
optimist
'
).
default
(
'
laxMode
'
,
false
).
argv
;
var
rootUrl
=
'
http://localhost:8000/
'
;
list
=
list
.
concat
(
fs
.
readdirSync
(
"
../labs/architecture-examples/
"
)
var
frameworkNamePattern
=
/^
[
a-z-_
]
+$/
;
.
map
(
function
(
folderName
)
{
return
{
name
:
folderName
,
path
:
"
labs/architecture-examples/
"
+
folderName
}
}));
list
=
list
.
concat
(
fs
.
readdirSync
(
"
../labs/dependency-examples/
"
)
.
map
(
function
(
folderName
)
{
return
{
name
:
folderName
,
path
:
"
labs/dependency-examples/
"
+
folderName
}
}));
list
=
list
.
concat
(
fs
.
readdirSync
(
"
../dependency-examples/
"
)
// collect together the framework names from each of the subfolders
.
map
(
function
(
folderName
)
{
return
{
name
:
folderName
,
path
:
"
dependency-examples/
"
+
folderName
}
}));
var
list
=
fs
.
readdirSync
(
'
../architecture-examples/
'
)
.
map
(
function
(
folderName
)
{
return
{
name
:
folderName
,
path
:
'
architecture-examples/
'
+
folderName
};
})
.
concat
(
fs
.
readdirSync
(
'
../labs/architecture-examples/
'
)
.
map
(
function
(
folderName
)
{
return
{
name
:
folderName
,
path
:
'
labs/architecture-examples/
'
+
folderName
};
})
)
.
concat
(
fs
.
readdirSync
(
'
../labs/dependency-examples/
'
)
.
map
(
function
(
folderName
)
{
return
{
name
:
folderName
,
path
:
'
labs/dependency-examples/
'
+
folderName
};
})
)
.
concat
(
fs
.
readdirSync
(
'
../dependency-examples/
'
)
.
map
(
function
(
folderName
)
{
return
{
name
:
folderName
,
path
:
'
dependency-examples/
'
+
folderName
};
})
);
// apps that are not hosted at the root of their folder need to be handled explicitly
// apps that are not hosted at the root of their folder need to be handled explicitly
var
exceptions
=
[
var
exceptions
=
[
{
name
:
"
chaplin-brunch
"
,
path
:
"
labs/dependency-examples/chaplin-brunch/public
"
}
{
name
:
'
chaplin-brunch
'
,
path
:
'
labs/dependency-examples/chaplin-brunch/public
'
}
];
];
list
=
list
.
map
(
function
(
framework
)
{
var
exception
=
exceptions
.
filter
(
function
(
exFramework
)
{
return
exFramework
.
name
===
framework
.
name
});
list
=
list
.
map
(
function
(
framework
)
{
return
exception
.
length
>
0
?
exception
[
0
]
:
framework
;
var
exception
=
exceptions
.
filter
(
function
(
exFramework
)
{
return
exFramework
.
name
===
framework
.
name
;
});
return
exception
.
length
>
0
?
exception
[
0
]
:
framework
;
});
});
// filter out any folders that are not frameworks (.e.g hidden files)
// filter out any folders that are not frameworks (.e.g hidden files)
list
=
list
.
filter
(
function
(
framework
)
{
return
frameworkNamePattern
.
test
(
framework
.
name
);
});
list
=
list
.
filter
(
function
(
framework
)
{
return
frameworkNamePattern
.
test
(
framework
.
name
);
});
// if a specific framework has been named, just run this one
// if a specific framework has been named, just run this one
if
(
argv
.
framework
)
{
if
(
argv
.
framework
)
{
list
=
list
.
filter
(
function
(
framework
)
{
return
framework
.
name
===
argv
.
framework
});
list
=
list
.
filter
(
function
(
framework
)
{
return
framework
.
name
===
argv
.
framework
;
});
}
}
// run the tests for each framework
// run the tests for each framework
var
testIndex
=
1
;
list
.
forEach
(
function
(
framework
)
{
list
.
forEach
(
function
(
framework
)
{
testSuite
.
todoMVCTest
(
testSuite
.
todoMVCTest
(
framework
.
name
,
framework
.
name
,
rootUrl
+
framework
.
path
+
"
/index.html
"
,
argv
.
speedMode
,
argv
.
laxMode
);
rootUrl
+
framework
.
path
+
'
/index.html
'
,
argv
.
speedMode
,
argv
.
laxMode
);
});
});
browser-tests/knownIssues.js
View file @
4a4016ff
This diff is collapsed.
Click to expand it.
browser-tests/page.js
View file @
4a4016ff
This diff is collapsed.
Click to expand it.
browser-tests/pageLaxMode.js
View file @
4a4016ff
var
webdriver
=
require
(
'
selenium-webdriver
'
),
'
use strict
'
;
Page
=
require
(
"
./page
"
);
function
PageLaxMode
(
browser
)
{
var
webdriver
=
require
(
'
selenium-webdriver
'
);
Page
.
apply
(
this
,
[
browser
]
);
var
Page
=
require
(
'
./page
'
);
this
.
tryGetToggleForItemAtIndex
=
function
(
index
)
{
module
.
exports
=
function
PageLaxMode
(
browser
)
{
// the specification dictates that the checkbox should have the 'toggle' CSS class. Some implementations deviate from
Page
.
apply
(
this
,
[
browser
]);
// this, hence in lax mode we simply look for any checkboxes within the specified 'li'.
var
xpath
=
this
.
xPathForItemAtIndex
(
index
)
+
"
//input[@type='checkbox']
"
;
return
browser
.
findElements
(
webdriver
.
By
.
xpath
(
xpath
));
}
this
.
getEditInputForItemAtIndex
=
function
(
index
)
{
this
.
tryGetToggleForItemAtIndex
=
function
(
index
)
{
// the specification dictates that the input element that allows the user to edit a todo item should have a CSS
// the specification dictates that the checkbox should have the 'toggle' CSS class. Some implementations deviate from
// class of 'edit'. In lax mode, we also look for an input of type 'text'.
// this, hence in lax mode we simply look for any checkboxes within the specified 'li'.
var
xpath
=
this
.
xPathForItemAtIndex
(
index
)
+
'
//input[@type="checkbox"]
'
;
return
browser
.
findElements
(
webdriver
.
By
.
xpath
(
xpath
));
};
var
xpath
=
"
(
"
+
this
.
xPathForItemAtIndex
(
index
)
+
"
//input[@type='text']
"
+
"
|
"
+
this
.
getEditInputForItemAtIndex
=
function
(
index
)
{
this
.
xPathForItemAtIndex
(
index
)
+
"
//input[contains(@class,'edit')]
"
+
"
)
"
;
// the specification dictates that the input element that allows the user to edit a todo item should have a CSS
return
browser
.
findElement
(
webdriver
.
By
.
xpath
(
xpath
));
// class of 'edit'. In lax mode, we also look for an input of type 'text'.
}
}
module
.
exports
=
PageLaxMode
;
var
xpath
=
'
(
'
+
this
.
xPathForItemAtIndex
(
index
)
+
'
//input[@type="text"]
'
+
'
|
'
+
\ No newline at end of file
this
.
xPathForItemAtIndex
(
index
)
+
'
//input[contains(@class,"edit")]
'
+
'
)
'
;
return
browser
.
findElement
(
webdriver
.
By
.
xpath
(
xpath
));
};
};
browser-tests/test.js
View file @
4a4016ff
This diff is collapsed.
Click to expand it.
browser-tests/testOperations.js
View file @
4a4016ff
This diff is collapsed.
Click to expand it.
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