Created
February 3, 2014 17:18
-
-
Save asciidisco/8788092 to your computer and use it in GitHub Desktop.
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
// given that the Logout function looks something like this: | |
// contents of functions.js | |
module.exports = { | |
Logout: function (aVar, bVar, test) { | |
console.log('Im logging the 2nd argument, just for fun:', bVar); | |
test | |
.click('#logout' + aVar) | |
.done(); | |
} | |
}; | |
var S2CFunctions = require('./functions'); | |
var domain = "http://www.snip2code.com/" | |
var appName = "Snip2Code" | |
module.exports = { | |
'Snip2code footer': function (test) { | |
test | |
.open(domain) | |
.assert.url(domain, 'URL is as expected') | |
.assert.title().is('Snip2Code', 'It has title') | |
.assert.exists('a[href="/Static/ToS"]', 'ToS exists') | |
.assert.exists('a[href="/Static/Privacy"]', 'Privacy exists') | |
.assert.exists('a[href="/Static/AboutUs"]', 'AboutUs exists') | |
.assert.exists('a[href="mailto:info@snip2code.com"]', 'Mailto exists') | |
.assert.exists('a[href="/Static/Downloads"]', 'Downloads exists') | |
.assert.exists('a[href="http://blog.snip2code.com"]', 'Blog exists') | |
.assert.exists('a[href="/Static/Docs"]', 'API exists') | |
.done(); | |
}, | |
// we can use the native ES5 bind, which can be used to inject arguments into the | |
// function from left to right -> see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind | |
'LogOut': S2CFunctions.Logout.bind(S2CFunctions, '.wannabe-selector', 'I´m a 2nd argument, just for fun'), | |
'Sign Up': function (test) { | |
test | |
.open(domain) | |
.click('#signupBigBt') | |
.assert.title().is('Snip2Code - Sign Up', 'Sign Up is loaded') | |
.assert.url(domain + 'Access/Signup', 'URL is as expected') | |
.done(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment