-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated integration tests to run chrome when tested locally
- Loading branch information
Showing
3 changed files
with
64 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
#!/bin/bash | ||
npm install | ||
./server.sh devserver & | ||
# for local testing | ||
# For local testing, download and install selenium and the chrome driver and | ||
# then make sure the dev server is running | ||
# java -Dwebdriver.chrome.driver=/path/to/chromedriver -jar ~/path/to/selenium-server-standalone-2.25.0.jar | ||
#./node_modules/.bin/mocha -R spec -t 40000 tests/integration/CreateBudget.js | ||
# for sauce testing | ||
|
||
# For sauce testing. This tests using the budget2012-dev site. This will be | ||
# deployed to after a push and should be up to date before this is triggerd by jenkins | ||
./node_modules/.bin/mocha -R spec -t 1200000 tests/integration/CreateBudget.js --with-sauce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,66 +3,73 @@ var should = require('should'); | |
var async = require('async'); | ||
var browser; | ||
|
||
describe('Loading the home page and clicking SAVE & SHARE', function(){ | ||
async.forEachSeries(helper.config.browsers, function(browserEnv, suiteDone){ | ||
|
||
before(function(done){ | ||
helper.startBrowser(function(err, webdriver){ | ||
browser = webdriver; | ||
browser.elementByCssSelector('a[href="/budget/save"]', function(err, el){ | ||
should.exist(el); | ||
browser.clickElement(el, function(err){ | ||
setTimeout(function(){ done(); }, 500); | ||
describe('In ' + browserEnv.browserName + ' load the home page and clicking SAVE & SHARE', function(){ | ||
|
||
before(function(done){ | ||
helper.startBrowser('Create Budget', browserEnv, function(err, webdriver){ | ||
browser = webdriver; | ||
browser.elementByCssSelector('a[href="/budget/save"]', function(err, el){ | ||
should.exist(el); | ||
browser.clickElement(el, function(err){ | ||
setTimeout(function(){ done(); }, 500); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it("should display the 'Save your budget form'", function(done){ | ||
browser.active(function(err, input){ | ||
if (err) return next(err); | ||
browser.getAttribute(input, 'name', function(err, value){ | ||
value.should.equal('yourName'); | ||
done(); | ||
it("should display the 'Save your budget form' and focus on 'Your Name'", function(done){ | ||
browser.active(function(err, input){ | ||
if (err) return next(err); | ||
browser.getAttribute(input, 'name', function(err, value){ | ||
value.should.equal('yourName'); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
describe('with the form filled out and save clicked', function(){ | ||
describe('with the form filled out and save clicked', function(){ | ||
|
||
var details = [ | ||
['yourName', 'B.J. Rossiter' ], | ||
['yourState', 'NSW' ], | ||
['yourEmail', '[email protected]' ], | ||
['budgetDescription', 'testing!' ] | ||
]; | ||
var details = [ | ||
['yourName', 'B.J. Rossiter' ], | ||
['yourState', 'NSW' ], | ||
['yourEmail', '[email protected]' ], | ||
['budgetDescription', 'testing!' ] | ||
]; | ||
|
||
var budgetUrlSel = 'input[name="budget-url"]'; | ||
var budgetUrlSel = 'input[name="budget-url"]'; | ||
|
||
before(function(done){ | ||
async.forEachSeries(details, function(detail, next){ | ||
helper.inputText(browser, detail[0], detail[1], next); | ||
}, function(err){ | ||
should.not.exist(err); | ||
helper.click(browser, 'submit-save-budget', function(err){ | ||
browser.waitForConditionInBrowser("$('" + budgetUrlSel + "').length", function(err, met){ | ||
done(); | ||
before(function(done){ | ||
async.forEachSeries(details, function(detail, next){ | ||
helper.inputText(browser, detail[0], detail[1], next); | ||
}, function(err){ | ||
should.not.exist(err); | ||
helper.click(browser, 'submit-save-budget', function(err){ | ||
browser.waitForConditionInBrowser("$('" + budgetUrlSel + ":visible').length > 0", 3000, 100, function(err, met){ | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it('should display a link to share', function(done){ | ||
browser.elementByCssSelector(budgetUrlSel, function(err, el){ | ||
el.text(function(err, text){ | ||
text.should.match(/^http:.*\/budget\/\S+/); | ||
done(); | ||
it('should display a link to share', function(done){ | ||
browser.elementByCssSelector(budgetUrlSel, function(err, el){ | ||
el.getValue(function(err, text){ | ||
console.log("got text: " + text); | ||
text.should.match(/^http:.*\/budget\/\S+/); | ||
text.should.not.match(/undefined/); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
|
||
}); | ||
|
||
after(function(done){ | ||
browser.quit(done); | ||
suiteDone(); | ||
}); | ||
}); | ||
|
||
after(function(done){ | ||
browser.quit(done); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters