0.0.47 • Published 10 years ago
cortado v0.0.47
Usage
Below is a boilerplate config file - place it in [project_path]/.cortado.js
:
module.exports = {
//url to proxy when running tests - important to prevent cross-site security
//issues
proxy: "http://localhost:8080",
//tests to run - these are actually loaded in the browser
scripts: [
__dirname + "/test/**.js"
],
//data-types to cache
cache: {
types: ["json", "png"],
directory: __dirname + "/test2/cache"
},
//files to watch, then reload
watch: [
__dirname + "/public/**",
__dirname + "/test/**"
],
//port to run tests on - open in http://localhost:8083/test
port: 8083,
//full integration
full: true,
//keep the tests alive for dev mode
keepAlive: true,
//called each time browsers are reloaded to run tests
events: {
init: function() {
exec("open http://student.classdojo.dev:8083/test?run");
}
}
}
Next, you can start writing tests using mocha. Here's an example test from [project_path]/tests/login-test.js
:
var assert = require("./helpers/assert"),
xpaths = require("./helpers/xpaths"),
config = require("./helpers/config"),
utils = require("./helpers/utils"),
logout = require("./helpers/logout");
describe("login#", function() {
before(function(next) {
actions.
wait(logout()).
then(next);
});
var p = {},
app = xpaths.app,
user = config.users.withoutPoints.username,
pass = config.users.withoutPoints.password;
/**
*/
it("login button toggles properly depending on input data", function(next) {
actions.
//test incomplete
type(p.un = xpaths.login.usernameInput, "craigers").
type(p.pn = xpaths.login.passwordInput, "").
wait(assert.enabled(p.sub = app.find().eq("@type", "submit"))).
then(next);
});
/**
*/
it("shows a not found error", function(next) {
actions.
type(p.un, String(Date.now())).
type(p.pn, "password").
click(p.sub).
wait(assert.textPresent("Couldn't find a user with that username.")).
then(next);
});
});
Finally, go ahead and run cortado:
cortado start
0.0.47
10 years ago
0.0.46
10 years ago
0.0.45
10 years ago
0.0.44
10 years ago
0.0.43
11 years ago
0.0.41
11 years ago
0.0.40
11 years ago
0.0.39
11 years ago
0.0.38
11 years ago
0.0.37
11 years ago
0.0.36
11 years ago
0.0.34
11 years ago
0.0.33
11 years ago
0.0.32
11 years ago
0.0.31
11 years ago
0.0.30
11 years ago
0.0.29
11 years ago
0.0.28
11 years ago
0.0.26
11 years ago
0.0.25
11 years ago
0.0.23
11 years ago
0.0.22
11 years ago
0.0.21
11 years ago
0.0.20
11 years ago
0.0.19
11 years ago
0.0.18
11 years ago
0.0.17
11 years ago
0.0.16
11 years ago
0.0.13
11 years ago
0.0.12
11 years ago
0.0.11
11 years ago
0.0.10
11 years ago
0.0.9
11 years ago
0.0.7
11 years ago
0.0.6
11 years ago
0.0.3
11 years ago
0.0.2
11 years ago
0.0.0
11 years ago