How to use the zombie.localhost function in zombie

To help you get started, we’ve selected a few zombie examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frictionlessdata / datapackage-ui / tests / index.js View on Github external
var config = require('../datapackagist/src/scripts/config');
var datapackage;
var definitionsJSON;
var fromRemoteJSON;
var fs = require('fs');
var nock = require('nock')
var path = require('path');
var registryListCSV;
var tabularProfileJSON;
var dataDir = path.join('.', 'tests', 'data');
var jtsInfer = require('json-table-schema').infer;
var sinon = require('sinon');
var url = require('url');
var CSV = require('../datapackagist/src/scripts/components/ui/csv-resource');
process.env.NODE_ENV = 'test';
Browser.localhost('127.0.0.1', 3000);

describe('DataPackagist core', function() {
  var browser = new Browser({maxWait: 50000});
  //browser.debug();

  var registryListSelector = '#registry-list [data-id=list-container] option';

  // ensure we have time for request to reoslve, etc.
  this.timeout(25000);

  before(function(done) {
    fs.readFile(path.join(dataDir, 'registry-list.json'), function(error, data) {
      registryListCSV = data.toString();

      fs.readFile(path.join(dataDir, 'definitions.json'), function(error, definitionsData) {
        definitionsJSON = JSON.parse(definitionsData.toString());
github repat / Grafari / backend / testzombie.js View on Github external
var Zombie = require("zombie")
var fs = require("fs")

Zombie.localhost('https://www.facebook.com')
var browser = Zombie.create();

exports.browser = browser

if (fs.existsSync("./cookies.tmp")) {
    console.log("Loading cookies from file...") //And omitting login
    fs.readFile("./cookies.tmp", function(err, cookies) {
        browser.loadCookies(cookies.toString())
        browser.visit("/search/males", function(e) { //Browser must visit a page
            if (e)
                console.log("Error while loading file: " + JSON.stringify(e))
            else
                console.log("Page loaded")
        })
    })
} else { //Default login procedure
github adonisjs / adonis-framework / test / acceptance / app.spec.js View on Github external
* Copyright(c) 2015-2015 Harminder Virk
 * MIT Licensed
*/

const Browser = require('zombie')
const Route = require('../../src/Route')
const chai = require('chai')
const expect = chai.expect
const server = require('./setup')
const Helpers = require('../../src/Helpers')
const Ioc = require('adonis-fold').Ioc
const queryString = require('querystring')
const Middleware = require('../../src/Middleware')
require('co-mocha')

Browser.localhost('localhost', 3333)
const browser = new Browser()

describe('App Exceptations', function () {
  before(function () {
    server().listen('0.0.0.0', 3333)
    Ioc.autoload(Helpers.appNameSpace(), Helpers.appPath())
  })

  beforeEach(function () {
    Middleware.new()
    Route.new()
  })

  it('should respond to http request with plain text', function * () {
    Route.get('/', function * (request, response) {
      response.send('Hello zombie')
github contently / xdomain-cookies / test / test_suite.js View on Github external
vm = require('vm'),
	Browser = require('zombie');

const 	TEST_COOKIE_NAME = 'test_cookie', 
		HTML_DOMAIN_1 = 'test_domain_site1.com',
		HTML_DOMAIN_2 = 'test_domain_site2.com',
		IFRAME_DOMAIN = 'test_domain_iframe.com',
		EXPECTED_UNSET_COOKIE_VAL = 'test1234',
		EXPECTED_SET_COOKIE_VAL = 'preset1234',
		JS_VAR_EXISTING_VAL = 'existing_cookie_val',
		JS_VAR_FINAL_VAL = 'final_cookie_val',
		JS_CAPTURED_ERRORS = 'js_errors',
		POSTMESSAGE_WAIT_MS = 50;

Browser.localhost(HTML_DOMAIN_1,3005);
Browser.localhost(HTML_DOMAIN_2,3005);
Browser.localhost(IFRAME_DOMAIN,3005);

Browser.extend(function(browser) {
  browser.on('console', function(level, message) {
    //console.log(message);
  });
  browser.on('log', function(level, message) {
    //console.log(message);
  });
});

describe("Iframe shared cookie (http)", function(){
	this.timeout(5000);

	before(function() {
		this.server = app.startHttpApp(3005);
github contently / xdomain-cookies / test / test_suite.js View on Github external
Browser = require('zombie');

const 	TEST_COOKIE_NAME = 'test_cookie', 
		HTML_DOMAIN_1 = 'test_domain_site1.com',
		HTML_DOMAIN_2 = 'test_domain_site2.com',
		IFRAME_DOMAIN = 'test_domain_iframe.com',
		EXPECTED_UNSET_COOKIE_VAL = 'test1234',
		EXPECTED_SET_COOKIE_VAL = 'preset1234',
		JS_VAR_EXISTING_VAL = 'existing_cookie_val',
		JS_VAR_FINAL_VAL = 'final_cookie_val',
		JS_CAPTURED_ERRORS = 'js_errors',
		POSTMESSAGE_WAIT_MS = 50;

Browser.localhost(HTML_DOMAIN_1,3005);
Browser.localhost(HTML_DOMAIN_2,3005);
Browser.localhost(IFRAME_DOMAIN,3005);

Browser.extend(function(browser) {
  browser.on('console', function(level, message) {
    //console.log(message);
  });
  browser.on('log', function(level, message) {
    //console.log(message);
  });
});

describe("Iframe shared cookie (http)", function(){
	this.timeout(5000);

	before(function() {
		this.server = app.startHttpApp(3005);
	});
github nock / nock / tests / test_browserify.js View on Github external
test('run bundle', function(t) {
  Browser.localhost('server.com', 8080);

  var browser = new Browser();

  browser.on('error', function(err) {
    throw err
  });

  browser.visit('/', function() {
    browser.assert.text('#content', 'boop');
    t.end();
  });
});
github WorldBank-Transport / ram-backend / test / test-server.js View on Github external
before(function() {
    //this.server = http.createServer(app).listen(8888);
    Browser.localhost('localhost', 8888);
    this.browser = new Browser();
    this.browser.on('authenticate', function(authentication) {
      authentication.username = credentials.user;
      authentication.password = credentials.pass;
    });
  });
github mderazon / node-deeplink / test / lib / browser.js View on Github external
module.exports = function(ua) {
  const obj = {};
  Browser.localhost('localhost', 3000);
  const browser = new Browser();
  browser.userAgent = ua;
  const app = express();
  let server;

  obj.go = (url, opts, callback) => {
    app.get('/', deeplink(opts));

    server = app.listen(3000);

    let loc = 0;
    browser.on('event', (e, target) => {
      if (target.location && e.type === 'load') {
        if (loc === 1) {
          callback(target.location.href);
        }
github repat / Grafari / backend / lib / browser.js View on Github external
function initModule(callback) {
    if (exports.debug)
        console.log("Starting browser module in debug mode")

    //Initialization
    Zombie.localhost('https://www.facebook.com')


    //start five browsers
    startBrowser(function(err, browser) {
        if (err)
            return callback(err)

        //populate worker-pool
        worker.push(browser)
        for (var c = 1; c < WORKERS; ++c)
            worker.push(browser.fork()) //Create an independent browser copy (already logged in)

        callback()
    })
}

zombie

Insanely fast, full-stack, headless browser testing using Node.js

MIT
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis