Skip to content

Commit 279f69b

Browse files
committed
aggiunto test per pageobject
1 parent d113766 commit 279f69b

File tree

6 files changed

+39
-1
lines changed

6 files changed

+39
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"gulp": "^3.8.11",
2828
"gulp-coffee": "^2.3.1",
2929
"gulp-markdox": "git://github.com/maxgalbu/gulp-markdox.git#markdox-master",
30-
"gulp-plumber": "^0.6.6",
30+
"gulp-plumber": "^1.0.1",
3131
"gulp-rename": "^1.2.0",
3232
"gulp-util": "^3.0.4",
3333
"mockserver-client": "^1.0.3",

tests/html/pageObjects.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<html>
2+
<head>
3+
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
4+
<script type="text/javascript">
5+
$(document).ready(function() {
6+
$("#button").on("click", function() {
7+
$("#div").show();
8+
});
9+
});
10+
</script>
11+
</head>
12+
<body>
13+
<div class="myclass"></div>
14+
<div class="myclass"></div>
15+
<div class="myclass">
16+
<button type="button" id="button">click me</button>
17+
<div id="div" style="display:none">invisible</div>
18+
</div>
19+
</body>
20+
</html>

tests/nightwatch.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"output_folder": false,
44
"custom_commands_path": "../js/commands",
55
"custom_assertions_path": "../js/assertions",
6+
"page_objects_path": "./page_objects",
67

78
"selenium": {
89
"start_process": true,

tests/page_objects/test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = {
2+
url: 'http://localhost:9999/pageObjects',
3+
elements: {
4+
thatButton: 'div:eq(2) #button'
5+
}
6+
};

tests/runTests.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ var easyimg = require("easyimage");
33
var baseurl = "http://localhost:9999";
44

55
module.exports = {
6+
"test page objects": function(browser) {
7+
var pageObject = browser.page.test();
8+
9+
pageObject.navigate()
10+
.jqueryClick("@thatButton")
11+
.assert.visible("#div");
12+
13+
browser.end();
14+
},
15+
616
"test elementHasChildren": function(browser) {
717
return browser
818
.url(baseurl+"/children")

tests/setMocks.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function monkeyPatch(mockSrvClnt)
3131
}
3232

3333
monkeyPatchedMSC = monkeyPatch(mockServerClient("localhost", 9999));
34+
monkeyPatchedMSC.mockHTMLResponse('/pageObjects', "html/pageObjects.html");
3435
monkeyPatchedMSC.mockHTMLResponse('/urlMatch', "html/urlMatch.html");
3536
monkeyPatchedMSC.mockHTMLResponse('/jqueryClick', "html/jqueryClick.html");
3637
monkeyPatchedMSC.mockHTMLResponse('/jqueryElement', "html/jqueryElement.html");

0 commit comments

Comments
 (0)