Skip to content

Instantly share code, notes, and snippets.

View tildedave's full-sized avatar
🌮
Hungry

Dave King tildedave

🌮
Hungry
View GitHub Profile
root@testing:/srv/www/current# npm install
npm WARN package.json [email protected] No repository field.
npm http GET https://registry.npmjs.org/chromedriver
npm http GET https://registry.npmjs.org/datejs
npm http GET https://registry.npmjs.org/gulp-cache
npm http GET https://registry.npmjs.org/event-stream
npm http GET https://registry.npmjs.org/gulp
npm http GET https://registry.npmjs.org/gulp-concat
npm http GET https://registry.npmjs.org/gulp-cssmin
npm http GET https://registry.npmjs.org/dotenv
React.createClass({
getInitialState: function() {
return { loading: true }
},
componentDidMount: function() {
$.getJSON('/my/stuff', function (data) {
this.setState({ stuff: data, loading: false })
}.bind(this))
dave@margaret:~/workspace/isomorphic-react-without-node/duktape-1.0.2$ ./duk init.js react-0.12.2.js test.js
<div data-reactid=".1n7svbvilrt" data-react-checksum="1140200483">This is my content</div>
@tildedave
tildedave / createFacebookTestUser.js
Last active May 25, 2016 22:29
Nightwatch Command for Creating Facebook Test User
var util = require('util');
var events = require('events');
var Promise = require('bluebird');
var request = Promise.promisify(require('request'));
var CreateFacebookTestUser = function() {
events.EventEmitter.call(this);
};
util.inherits(CreateFacebookTestUser, events.EventEmitter);
@tildedave
tildedave / linkMatches.js
Last active August 29, 2015 14:16
Custom assertion for Nightwatch to see if a link has the expected text and destination
var util = require('util');
exports.assertion = function(selector, text, href, msg) {
var DEFAULT_MSG = 'Testing if link <%s> contains text <%s> and ends with href <%s>".';
var MSG_ELEMENT_NOT_FOUND = DEFAULT_MSG + ' ' + '<%s> could not be located.';
var MSG_TEXT_DID_NOT_MATCH = DEFAULT_MSG + ' ' + ' Actual text <%s> did not contain <%s>.';
var MSG_HREF_DID_NOT_MATCH = DEFAULT_MSG + ' ' + ' Actual href <%s> did not end with <%s>.';
this.message = msg || util.format(DEFAULT_MSG, selector, text, href);
var Immutable = require('immutable'),
createStore = require('dispatchr/utils/createStore'),
var ExperimentStore = createStore({
storeName: 'ExperimentStore',
initialize: function() {
this._experiments = Immutable.Map();
},
use JavaScript::V8;
use JSON;
my $v8context = JavaScript::V8::Context->new();
$v8context->bind(f => JSON::false);
my $res = $v8context->eval('(function() { return (f ? 1 : 0) })()');
print "$res\n";
# returns 1, because JSON::false is bound to the empty object and so truthy
my $res = $v8context->eval('typeof f');
INFO Request: POST /wd/hub/session/23f28a8d-e6a7-4025-99cd-4abf6302e4d2/timeouts/async_script
- data: {"ms":10000}
- headers: {"Content-Type":"application/json; charset=utf-8","Content-Length":12}
INFO Response 200 POST /wd/hub/session/23f28a8d-e6a7-4025-99cd-4abf6302e4d2/timeouts/async_script{ sessionId: '23f28a8d-e6a7-4025-99cd-4abf6302e4d2',
status: 0,
state: 'success',
value: null,
class: 'org.openqa.selenium.remote.Response',
hCode: 595100226 }
LOG → Completed command timeoutsAsyncScript (10 ms)
$ TEST_ENVIRONMENT=staging magellan --config=./magellan.jenkins.json --tag desktop
Loaded magellan configuration from: /Users/dave/workspace/tilt-nightwatch/magellan.jenkins.json
Magellan-nightwatch test iterator found nightwatch configuration at: ./nightwatch.conf.js
Using tag filter: [ 'desktop' ]
Running 78 tests with 8 workers with phantomjs
--> Worker 1, mock port: 21000, running test: test/comment_view_spec.js @phantomjs
--> Worker 2, mock port: 21003, running test: test/connect_via_notification_center_spec.js @phantomjs
--> Worker 3, mock port: 21006, running test: test/connect_via_search_center_spec.js @phantomjs
client
.page.homepage().load()
.signUpEmailUser('UserMenu Tester')
.whenDesktop(function() {
client.page.navbar().verifyUserName('UserMenu Tester');
})
.pause(500)
.page.navbar().openUserMenu()
.whenDesktop(function() {
return client.page.navbar().verifyProfileLink();