mirror of
https://github.com/jsbin/jsbin.git
synced 2026-01-25 15:38:56 +00:00
* Move unit tests to a nested folder. This is needed to have them on the same level with e2e tests wich are yet to come. * Install Nightwatch.js * Add Nightwatch config * Add a basic spec for editing JavaScript * Add e2e npm script * Install selenium-standalone, get the latest version post-install * Run selenium automatically when running e2e tests * Rewrite the test to avoid focus issues, on the standalone version of selenium * Update the docs with instructions on how to run e2e tests * Change JSBin -> JS Bin * Move e2e specs into a nested folder * Assert the URL is updated in the integration tests I'm copying and pasting custom assertion from https://github.com/maxgalbu/nightwatch-custom-commands-assertions Alternative would be using npm install, but it's doesn't seem feasible here because we only need this one assertion. Also custom assertions path would have point to the node_modules folder, which would make it hard to add custom assertions. * Mention that JS Bin has to be running for integration tests to succeed in the docs * Run e2e tests with travis-ci * Do not run e2e for pull requests
48 lines
1.0 KiB
JavaScript
48 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.assertion = assertion;
|
|
|
|
var _util = require('util');
|
|
|
|
var _util2 = _interopRequireDefault(_util);
|
|
|
|
function _interopRequireDefault(obj){
|
|
return obj && obj.__esModule ? obj : {default: obj};
|
|
}
|
|
|
|
function assertion(regex, msg){
|
|
this.message = msg || _util2.default.format('Testing if the URL match the regex "%s".', regex);
|
|
this.expected = regex;
|
|
|
|
this.pass = function (value){
|
|
return this.expected.test(value);
|
|
};
|
|
|
|
this.value = function (result){
|
|
return result.value;
|
|
};
|
|
|
|
this.command = function (callback){
|
|
return this.api.url(callback);
|
|
};
|
|
}
|
|
/**
|
|
* Assert that the url matches the regex provided
|
|
*
|
|
* h3 Examples:
|
|
*
|
|
* browser
|
|
* .url("http://www.google.com")
|
|
* .assert.urlMatch(/\.com$/)
|
|
*
|
|
* browser
|
|
* .url("http://www.google.com")
|
|
* .assert.urlMatch(new RegExp("\.com$", "i")
|
|
*
|
|
* @author maxgalbu
|
|
* @param {RegExp} regex - regular expression
|
|
* @param {String} [msg] - output to identify the assertion
|
|
*/ |