Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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());
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
* 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')
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);
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);
});
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();
});
});
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;
});
});
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);
}
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()
})
}