Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

some files

  • Loading branch information...
commit 3f996b0f89cc63f0c7b7b0beb558df1fa85ec090 0 parents
@substack authored
6 argv.js
@@ -0,0 +1,6 @@
+var test = require('testling');
+
+test('argv test', function (t) {
+ t.log(process.argv);
+ t.end();
+});
19 builtins.js
@@ -0,0 +1,19 @@
+var test = require('testling');
+
+test('keys', function (t) {
+ t.plan(1);
+ setTimeout(function () {
+ t.deepEqual(
+ Object.keys({ a : 1, b : 2 }),
+ [ 'a','b' ]
+ );
+ t.end();
+ }, 500);
+});
+
+test('json', function (t) {
+ t.plan(2);
+ t.deepEqual(JSON.parse('[1,2]'), [1,2]);
+ t.equal(JSON.stringify({a:3,b:4}), '{"a":3,"b":4}');
+ t.end();
+});
1  foo.js
@@ -0,0 +1 @@
+module.exports = 5;
13 google.js
@@ -0,0 +1,13 @@
+var test = require('testling');
+
+test('google live search', function (t) {
+ t.createWindow('http://google.com', function (win, $) {
+ $('lst-ib').val('beep boop');
+ $('tsf').submit();
+
+ setTimeout(function () {
+ t.equal(win.document.title, 'beep boop - Google Search');
+ t.end();
+ }, 4000);
+ });
+});
8 jquery.js
@@ -0,0 +1,8 @@
+var test = require('testling');
+
+test('check the title', function (t) {
+ t.createWindow('http://substack.net', function (win, $) {
+ t.equal($('title').text(), 'The Universe of Discord');
+ t.end();
+ });
+});
18 link.js
@@ -0,0 +1,18 @@
+var test = require('testling');
+
+test('click a link', function (t) {
+ t.createWindow('http://substack.net', function (win, $) {
+ t.equal(win.document.title, 'The Universe of Discord');
+ $('a[href="/about"]').click();
+
+ t.log(win.location.href);
+ setTimeout(function () {
+ t.log(win.location.href);
+ t.equal(
+ win.document.title,
+ 'About Me! :: The Universe of Discord'
+ );
+ t.end();
+ }, 3000);
+ });
+});
12 proxy_check.js
@@ -0,0 +1,12 @@
+var test = require('testling');
+
+test('proxy check', function (t) {
+ t.createWindow('http://substack.net', function (win) {
+ t.equal(win.document.title, 'The Universe of Discord');
+ win.location.href = 'http://google.com';
+ setTimeout(function () {
+ t.equal(win.document.title, 'Google');
+ t.end();
+ }, 1000);
+ });
+});
6 test.js
@@ -0,0 +1,6 @@
+var test = require('testling');
+
+test('json parse', function (t) {
+ t.deepEqual(JSON.parse('[1,2]'), [1,2]);
+ t.end();
+});
6 throw.js
@@ -0,0 +1,6 @@
+var test = require('testling');
+
+test('throw', function (t) {
+ throw 'beep';
+ t.end();
+});
9 timeout.js
@@ -0,0 +1,9 @@
+var test = require('testling');
+
+test('setTimeout', function (t) {
+ t.plan(1);
+ setTimeout(function () {
+ t.ok(true);
+ t.end();
+ }, 100);
+});
13 wait.js
@@ -0,0 +1,13 @@
+var test = require('testling');
+
+test('waiting...', function (t) {
+ var ix = 0;
+ var iv = setInterval(function () {
+ ix += 5;
+ t.log(ix)
+ if (ix >= 20) {
+ clearInterval(iv);
+ t.end();
+ }
+ }, 5 * 1000);
+});
15 window.js
@@ -0,0 +1,15 @@
+var test = require('testling');
+
+test('moo', function (t) {
+ t.log(window.navigator.appName);
+
+ t.createWindow('http://substack.net', function (win) {
+ t.equal(win.document.title, 'The Universe of Discord');
+ t.end();
+ });
+});
+
+test('foo', function (t) {
+ t.equal(2, 2);
+ t.end();
+});
16 xhr.js
@@ -0,0 +1,16 @@
+var test = require('testling');
+var json = typeof JSON === 'object' ? JSON : require('jsonify');
+var path = require('path');
+
+test('xhr', function (t) {
+ t.log(process.argv);
+ var href = process.argv[2];
+ if (!href) t.fail('Usage: ?argv=[webform url]');
+
+ t.createWindow(href, function (win, $) {
+ setTimeout(function () {
+ t.equal($('#res').text(), 'welcome!');
+ t.end();
+ }, 500);
+ });
+});
Please sign in to comment.
Something went wrong with that request. Please try again.