How to use zombie - 10 common examples

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 bergie / VIE / test / nodejs / zombie-qunit.js View on Github external
server.listen(3000, function() {
        var location = "http://localhost:3000/test/index.html";
        var browser = new zombie.Browser({debug: false});
        browser.visit(location, function(err, browser, status) {
            // Start QUnit
            browser.fire('load', browser.window);

            browser.wait(function(err, browser) {
                qunitResults = browser.css('#qunit-tests > li');
                console.log(qunitResults.length);
                server.close();
                callback();
            });
        });
    });
};
github TheFive / osmbc / test / testutil.js View on Github external
}
  }
  // there is a difference, so create the actual data as file
  // do easier fix the test.
  fs.writeFileSync(actualFile, string, "UTF8");
  if (stopOnError) {
    should(string).eql(expected, "HTML File " + name + " is different.");
  } else {
    if (string !== expected) {
      errorList.push("HTML File " + name + " is different.");
    }
  }
};


Browser.Assert.prototype.expectHtml = function expectHtml(givenPath, name, cb) {
  console.warn("Browser.Assert.prototype.expectHtml is deprecated");

  if (typeof name === "function") {
    cb = name;
    name = givenPath;
    givenPath = "screens";
  }
  let expected = "not read yet";
  let expectedFile = path.join(__dirname, givenPath, name + ".html");
  let actualFile   = path.join(__dirname, givenPath, name + "_actual.html");
  let string = this.html();
  try {
    expected = fs.readFileSync(expectedFile, "UTF8");
  } catch (err) {
    console.error(err);
  }
github TheFive / osmbc / test / testutil.js View on Github external
// there is a difference, so create the actual data as file
  // do easier fix the test.
  fs.writeFileSync(actualFile, string, "UTF8");
  should(string).eql(expected, "HTML File " + name + " is different.");
  return cb();
};


process.on("unhandledRejection", (reason, p) => {
  console.error("Unhandled Rejection at: Promise", p, "reason:", reason);
  console.error(reason.stack);
  // application specific logging, throwing an error, or other logic here
});


Browser.extend(function(browser) {
  browser.on("request", function (req) {
    if (browser.location) {
      req.headers.set("Referer", browser.location.href);
    }
  });
});



exports.nockLoginPage = nockLoginPage;
github bergie / zombie-qunit / test / zombie-qunit.js View on Github external
server.listen(3000, function() {
        var location = "http://localhost:3000/qunit/index.html";
        var browser = new zombie.Browser({
            debug: false,
            userAgent: 'Zombie'
        });
        browser.visit(location, function(err, browser, status) {
            // Start QUnit
            browser.fire('load', browser.window);

            // If you have long tests, tweak the wait time here
            browser.wait(2000, function(err, browser) {
                qunitResults = browser.queryAll('#qunit-tests > li');
                server.close();
                callback();
            });
        });
    });
};
github bergie / create / test / nodejs / zombie-qunit.js View on Github external
server.listen(3000, function() {
        var location = "http://localhost:3000/test/index.html";
        var browser = new zombie.Browser({
            debug: false,
            userAgent: 'Zombie'
        });
        browser.visit(location, function(err, browser, status) {
            // Start QUnit
            browser.fire('load', browser.window);
            browser.wait(20000, function(err, browser) {
                qunitResults = browser.queryAll('#qunit-tests > li');
                server.close();
                callback();
            });
        });
    });
};
github darkwire / darkwire.io / test / app.js View on Github external
describe('Darkwire', () => {

  const browser = new Browser();

  before((done) => {
    browser.on('active', () => {
      // browser.evaluate needs a string, so this regex just extracts the body of the function as a string
      browser.evaluate(helpers.polyfillCrypto.toString().match(/function[^{]+\{([\s\S]*)\}$/)[1]);
    });

    browser.visit('/', done);
  });

  describe('Navigate to /', () => {
    it('should be running released version', () => {
      browser.assert.text('#appVersion', APPVER);
    });

    it('should be successful', () => {
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 / zombie.js View on Github external
var Browser = require('zombie');
var graph = require('fbgraph');

var city = 'Hamburg, Germany';


Browser.localhost('https://www.facebook.com');

var browser = Browser.create();

browser.visit('/login.php')
  .then( function (error) {

    // FB login
    browser.fill('email', 'haw-mi@wegwerfemail.de');
    browser.fill('pass', 'geheim123');
    return browser.pressButton('login');
  })
  .done( function(error) {

    // Form submitted, new page loaded.
    //browser.assert.success();

    // Suchfeld befüllen
    //console.log(browser.text('._586j'));
github trevorquinn / econstats / server.js View on Github external
var retrieveUnemployment = function(callback) {
    // Screen scrape BLS web page for latest unemployment information
    zombie.visit("http://data.bls.gov/timeseries/LNS14000000", function(err,
            browser, status) {
        var unemploymentData = [];

        // Grab the unemployment table
        var ths = browser.querySelectorAll("table.regular-data tbody th");
        for ( var i = 0; i < ths.length; i++) {
            var unemploymentEntry = {};

            // Grab each row header and use it to set the year
            var th = ths.item(i);
            var year = th.innerHTML.trim();

            // Grab each cell in the row and use it to set the month and
            // unemployment rate
            var tds = th.parentNode.getElementsByTagName("td");
            for ( var j = 0; j < tds.length && j < 12; j++) {
github trevorquinn / econstats / server.js View on Github external
var retrieveEarnings = function(callback) {
    // Screen scrape BLS web page for latest unemployment information
    zombie.visit("http://data.bls.gov/cgi-bin/srgate", function(err,
            browser, status) {
        var earningsData = [];

        // Fill in a text area with the name "series_id" with the series for
        // weekly earnings, press the submit button, then press the "Retrieve Data"
        // button on the resulting page
        browser.
            fill("series_id", "LES1252881600").
            pressButton(".submit-button", function(err, browser, status) {
                browser.pressButton("Retrieve Data", function(err, browser, status) {
                    // Define the processing function for earnings data 
                    var ths = browser.querySelectorAll("table.regular-data tbody th");
                    for ( var i = 0; i < ths.length; i++) {
                        var earningsEntry = {};

                        var th = ths.item(i);

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