Skip to content

Commit

Permalink
Merge pull request Chore-Swap#92 from ashishdommety/master
Browse files Browse the repository at this point in the history
added nightmare tests
  • Loading branch information
ashishdommety committed Aug 25, 2017
2 parents 0bcf607 + 9ce2b0b commit 3982a00
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"devDependencies": {
"chai": "^4.1.1",
"mocha": "^3.5.0",
"nightmare": "^2.10.0"
"nightmare": "^2.10.0",
"nightmare-wait-for-url": "0.0.2"
}
}
22 changes: 22 additions & 0 deletions test/home_page_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
var Nightmare = require("nightmare");
var nightmare = Nightmare({ show: true });

require('nightmare-wait-for-url')

nightmare
.goto("https://student-skill-swap.herokuapp.com/homepage")
// .click("form[action*='/search'] [name=btnK]")
.wait("#add_button")
.click("#add_button")
.wait(3000)
.url()
.evaluate(function() {
return ("clicked button on homepage!");
})
.end()
.then(function(result) {
console.log("Search success: " + result);
})
.catch(function(error) {
console.error("Search failed: ", error);
});
11 changes: 4 additions & 7 deletions test/night_test.js → test/landing_page_test.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
var Nightmare = require("nightmare");

var nightmare = Nightmare({ show: true });

require('nightmare-wait-for-url')

nightmare
.goto("https://student-skill-swap.herokuapp.com/")
.goto("https://student-skill-swap.herokuapp.com")
// .click("form[action*='/search'] [name=btnK]")
.wait("#iron_box")
.click("#iron_box")
.wait(3000)
.click("#broom")
.wait(3000)
.evaluate(function() {
//search through page to get actual details.
// you can also use .innerText to get the innerHTML
return ("you clicked the iron box svg!");
return ("clicked svg on landing page!");
})
.end()
.then(function(result) {
Expand Down
21 changes: 21 additions & 0 deletions test/update_skills_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var Nightmare = require("nightmare");
var nightmare = Nightmare({ show: true });

require('nightmare-wait-for-url')

nightmare
.goto("https://student-skill-swap.herokuapp.com/update-skills")
// .click("form[action*='/search'] [name=btnK]")
.wait("#done_deleting")
.click("#done_deleting")
.evaluate(function() {
// return window.location.;
return ("clicked button on update-skills");
})
.end()
.then(function(result) {
console.log("Search success: " + result);
})
.catch(function(error) {
console.error("Search failed: ", error);
});

0 comments on commit 3982a00

Please sign in to comment.