Comparing version 3.3.0 to 4.0.0
@@ -69,3 +69,3 @@ /* | ||
// Modules are required following the order, but they should loosely depend on each other | ||
var allModules = ["event", "logger", "config", "reports", "middlewares", "classes", "utils", "launcher", "server", "campaign", "core", "testPage", "plugins"]; | ||
var allModules = ["event", "logger", "config", "reports", "middlewares", "classes", "utils", "launcher", "server", "campaign", "core", "testPage", "testTypes", "plugins"]; | ||
exposeModules.apply(this, allModules); | ||
@@ -72,0 +72,0 @@ |
@@ -63,9 +63,8 @@ /* | ||
launcherProcesss.removeListener("exit", onLauncherExit); | ||
try { | ||
if (launcherProcesss.connected) { | ||
launcherProcesss.send("stop"); | ||
} | ||
} catch (error) { | ||
// attester-launcher can already be in the process of stopping when sending the stop message | ||
// in that case, sending the message can raise an exception that we can safely ignore | ||
if (launcherProcesss.connected) { | ||
launcherProcesss.send("stop", function (error) { | ||
// avoid error if the stop command does not arrive | ||
// attester-launcher can already be in the process of stopping when sending the stop message | ||
// in that case, sending the message can raise an exception that we can safely ignore | ||
}); | ||
} | ||
@@ -72,0 +71,0 @@ launcherProcesss = null; |
@@ -18,2 +18,3 @@ /* | ||
var url = require('../util/url'); | ||
var testTypes = require('../attester/testTypes'); | ||
var Logger = require('../logging/logger.js'); | ||
@@ -28,4 +29,6 @@ | ||
var module; | ||
if (locals.hasOwnProperty(type)) { | ||
var module = testTypes.getTestType(type); | ||
if (module) { | ||
// nothing to do | ||
} else if (locals.hasOwnProperty(type)) { | ||
module = require(locals[type]); | ||
@@ -32,0 +35,0 @@ } else { |
@@ -5,3 +5,3 @@ { | ||
"description": "Command line tool to run Javascript tests in several web browsers.", | ||
"version": "3.3.0", | ||
"version": "4.0.0", | ||
"homepage": "http://github.com/ariatemplates/attester", | ||
@@ -30,45 +30,45 @@ "repository": { | ||
"dependencies": { | ||
"attester-launcher": "0.2.0", | ||
"attester-launcher": "0.3.0", | ||
"attester-results-ui": "0.4.2", | ||
"colors": "0.6.2", | ||
"compression": "1.7.1", | ||
"connect": "3.6.5", | ||
"eventemitter2": "2.1.3", | ||
"compression": "1.7.4", | ||
"connect": "3.7.0", | ||
"eventemitter2": "6.4.3", | ||
"exit": "0.1.2", | ||
"js-yaml": "3.10.0", | ||
"json3": "3.3.2", | ||
"lodash": "4.17.4", | ||
"js-yaml": "3.14.0", | ||
"json3": "3.3.3", | ||
"lodash": "4.17.15", | ||
"minimatch": "3.0.4", | ||
"node-coverage": "2.0.0", | ||
"node-coverage": "2.1.0", | ||
"noder-js": "1.6.2", | ||
"optimist": "0.6.1", | ||
"q": "1.5.0", | ||
"q": "1.5.1", | ||
"semver": "2.3.1", | ||
"send": "0.16.1", | ||
"serve-favicon": "2.4.5", | ||
"serve-static": "1.13.1", | ||
"sockjs": "0.3.18", | ||
"sockjs-client": "1.1.4", | ||
"error-stack-parser": "2.0.2", | ||
"ua-parser-js": "0.7.14", | ||
"send": "0.17.1", | ||
"serve-favicon": "2.5.0", | ||
"serve-static": "1.14.1", | ||
"sockjs": "0.3.20", | ||
"sockjs-client": "1.4.0", | ||
"error-stack-parser": "2.0.6", | ||
"ua-parser-js": "0.7.21", | ||
"uglify-js": "2.7.3" | ||
}, | ||
"devDependencies": { | ||
"ariatemplates": "1.7.22", | ||
"ariatemplates": "2.4.0", | ||
"chai": "1.9.2", | ||
"expect.js": "0.3.1", | ||
"grunt": "1.0.1", | ||
"grunt": "1.1.0", | ||
"grunt-jsbeautifier": "0.2.13", | ||
"grunt-cli": "1.2.0", | ||
"grunt-contrib-jshint": "1.1.0", | ||
"grunt-contrib-watch": "1.0.0", | ||
"jasmine-node": "1.14.5", | ||
"grunt-cli": "1.3.2", | ||
"grunt-contrib-jshint": "2.1.0", | ||
"grunt-contrib-watch": "1.1.0", | ||
"jasmine": "3.5.0", | ||
"mocha": "1.8.1", | ||
"js-beautify": "1.7.4", | ||
"rimraf": "2.6.2", | ||
"xml2js": "0.4.19" | ||
"js-beautify": "1.11.0", | ||
"rimraf": "3.0.2", | ||
"xml2js": "0.4.23" | ||
}, | ||
"scripts": { | ||
"grunt-test": "node grunt-cli test", | ||
"jasmine-test": "jasmine-node --forceexit --captureExceptions spec", | ||
"jasmine-test": "jasmine --config=spec/jasmine.json", | ||
"test": "npm run grunt-test && npm run jasmine-test" | ||
@@ -75,0 +75,0 @@ }, |
Attester | ||
======== | ||
[![Build Status](https://secure.travis-ci.org/attester/attester.png)](https://travis-ci.org/attester/attester) | ||
[![Build status](https://github.com/attester/attester/workflows/ci/badge.svg?branch=master&event=push)](https://github.com/attester/attester/actions?query=branch%3Amaster+event%3Apush) | ||
[![Dependencies](https://david-dm.org/attester/attester.svg?style=flat)](https://david-dm.org/attester/attester) | ||
@@ -6,0 +6,0 @@ [![devDependencies](https://david-dm.org/attester/attester/dev-status.svg?style=flat)](https://david-dm.org/attester/attester#info=devDependencies) |
@@ -24,2 +24,5 @@ /* globals expect, describe, it, beforeEach, afterEach */ | ||
var expectedObject = { | ||
predictableUrls: undefined, | ||
campaignNumber: undefined, | ||
liveResults: undefined, | ||
resources: { | ||
@@ -26,0 +29,0 @@ "/here": ["there", "nowhere"], |
@@ -1,2 +0,1 @@ | ||
/*globals describe, it, runs, waitsFor, expect*/ | ||
/* | ||
@@ -38,33 +37,26 @@ * Copyright 2012 Amadeus s.a.s. | ||
var itRuns = function (options) { | ||
it(options.testCase, function () { | ||
var finished = false; | ||
runs(function () { | ||
utils.runFromCommandLine(options, function (code, testExecution, errorMessages) { | ||
expect(code).toEqual(options.exitCode); | ||
if (options.results) { | ||
expect(testExecution).toEqual(options.results); | ||
} | ||
if (options.hasErrors) { | ||
for (var i = 0; i < options.hasErrors.length; i += 1) { | ||
var indexOfError = findErrorMessage(options.hasErrors[i], errorMessages); | ||
if (indexOfError === -1) { | ||
throw new Error("Error " + options.hasErrors[i] + " was not found in logs."); | ||
} else { | ||
// error found, remove it | ||
errorMessages.splice(indexOfError, 1); | ||
} | ||
it(options.testCase, function (done) { | ||
utils.runFromCommandLine(options, function (code, testExecution, errorMessages) { | ||
expect(code).toEqual(options.exitCode); | ||
if (options.results) { | ||
expect(testExecution).toEqual(options.results); | ||
} | ||
if (options.hasErrors) { | ||
for (var i = 0; i < options.hasErrors.length; i += 1) { | ||
var indexOfError = findErrorMessage(options.hasErrors[i], errorMessages); | ||
if (indexOfError === -1) { | ||
throw new Error("Error " + options.hasErrors[i] + " was not found in logs."); | ||
} else { | ||
// error found, remove it | ||
errorMessages.splice(indexOfError, 1); | ||
} | ||
if (errorMessages.length > 0) { | ||
throw new Error("Unexpected error message " + errorMessages[0]); | ||
} | ||
} | ||
if (errorMessages.length > 0) { | ||
throw new Error("Unexpected error message " + errorMessages[0]); | ||
} | ||
} | ||
finished = true; | ||
}); | ||
done(); | ||
}); | ||
waitsFor(function () { | ||
return finished; | ||
}, (options.timeout || defaultTimeout) + 100, 'attester to complete'); | ||
}); | ||
}, options.timeout || defaultTimeout); | ||
}; | ||
@@ -209,3 +201,3 @@ | ||
exitCode: 1, | ||
timeout: 20000, | ||
timeout: 40000, | ||
args: ['--config.resources./', atTestsRoot, '--config.resources./', atFrameworkPath, '--config.tests.aria-templates.classpaths.includes', 'test.attester.ShouldFailOnPhantomJS', '--config.coverage.files.rootDirectory', atTestsRoot, '--config.browsers', 'PhantomJS', '--config.browsers', 'Firefox', '--launcher-config', path.join(__dirname, 'attester-launcher', 'local-browsers.yml')], | ||
@@ -212,0 +204,0 @@ results: { |
@@ -1,2 +0,1 @@ | ||
/*globals describe, it, runs, waitsFor, expect*/ | ||
/* | ||
@@ -22,45 +21,30 @@ * Copyright 2012 Amadeus s.a.s. | ||
it("after disconnect", function () { | ||
it("after disconnect", function (done) { | ||
// this test starts attester with a first test which disconnects the browser | ||
// then it checks that attester is waiting for a browser to connect | ||
// instead of automatically making tasks timeout | ||
var attesterFinished = false; | ||
var phantomFinished = false; | ||
var okToContinue = false; | ||
runs(function () { | ||
utils.runFromCommandLine({ | ||
testCase: "timeout after disconnect", | ||
timeout: 20000, | ||
args: ['--max-task-restarts', '0', '--config.tests.mocha.files.includes', 'spec/test-type/mocha/extraScripts/disconnect.js', '--config.tests.mocha.files.includes', 'spec/test-type/mocha/sample-tests/**/*Test.js', '--task-timeout', '500'] | ||
}, function (code, testExecution, errorMessages) { | ||
attesterFinished = true; | ||
expect(errorMessages.length).toEqual(1); | ||
expect(errorMessages[0]).toContain("Browser was disconnected"); | ||
expect(testExecution).toEqual({ | ||
run: 3, | ||
failures: 0, | ||
errors: 1, | ||
skipped: 0 | ||
}); | ||
utils.runFromCommandLine({ | ||
testCase: "timeout after disconnect", | ||
timeout: 20000, | ||
args: ['--max-task-restarts', '0', '--config.tests.mocha.files.includes', 'spec/test-type/mocha/extraScripts/disconnect.js', '--config.tests.mocha.files.includes', 'spec/test-type/mocha/sample-tests/**/*Test.js', '--task-timeout', '500'] | ||
}, function (code, testExecution, errorMessages) { | ||
expect(phantomFinished).toEqual(true); | ||
expect(errorMessages.length).toEqual(1); | ||
expect(errorMessages[0]).toContain("Browser was disconnected"); | ||
expect(testExecution).toEqual({ | ||
run: 3, | ||
failures: 0, | ||
errors: 1, | ||
skipped: 0 | ||
}); | ||
setTimeout(function () { | ||
okToContinue = true; | ||
}, 6000); | ||
done(); | ||
}); | ||
waitsFor(function () { | ||
return attesterFinished || okToContinue; | ||
}, 7000, 'some time'); | ||
runs(function () { | ||
setTimeout(function () { | ||
utils.startPhantom([path.join(__dirname, '../../lib/browsers/phantomjs-control-script.js'), "--auto-exit", "--auto-exit-polling=2000", "http://localhost:7777/__attester__/slave.html"], function () {}, function (code) { | ||
phantomFinished = true; | ||
}); | ||
}); | ||
waitsFor(function () { | ||
return attesterFinished && phantomFinished; | ||
}, 7000, 'attester and phantom to complete'); | ||
runs(function () { | ||
expect(attesterFinished).toEqual(true); | ||
expect(phantomFinished).toEqual(true); | ||
}); | ||
}); | ||
}, 6000); | ||
}, 20000); | ||
}); |
@@ -27,3 +27,4 @@ /* globals expect, describe, it */ | ||
os: undefined, | ||
displayAs: undefined | ||
displayAs: undefined, | ||
flags: undefined | ||
}); | ||
@@ -37,3 +38,4 @@ }); | ||
os: undefined, | ||
displayAs: undefined | ||
displayAs: undefined, | ||
flags: undefined | ||
}); | ||
@@ -47,3 +49,4 @@ }); | ||
os: undefined, | ||
displayAs: undefined | ||
displayAs: undefined, | ||
flags: undefined | ||
}); | ||
@@ -57,3 +60,4 @@ }); | ||
os: "Windows 7", | ||
displayAs: undefined | ||
displayAs: undefined, | ||
flags: undefined | ||
}); | ||
@@ -67,3 +71,4 @@ }); | ||
os: "Windows 7", | ||
displayAs: undefined | ||
displayAs: undefined, | ||
flags: undefined | ||
}); | ||
@@ -77,3 +82,4 @@ }); | ||
os: undefined, | ||
displayAs: "Firefox Nightly" | ||
displayAs: "Firefox Nightly", | ||
flags: undefined | ||
}); | ||
@@ -87,3 +93,4 @@ }); | ||
os: "Desktop Linux", | ||
displayAs: "Chrome Canary Linux" | ||
displayAs: "Chrome Canary Linux", | ||
flags: undefined | ||
}); | ||
@@ -96,3 +103,5 @@ }); | ||
browserVersion: "11", | ||
flags: "JAWS" | ||
flags: "JAWS", | ||
os: undefined, | ||
displayAs: undefined | ||
}); | ||
@@ -106,3 +115,4 @@ }); | ||
flags: "JAWS", | ||
displayAs: "IEJAWS" | ||
displayAs: "IEJAWS", | ||
os: undefined | ||
}); | ||
@@ -115,3 +125,5 @@ }); | ||
flags: "JAWS", | ||
displayAs: "IEJAWS" | ||
displayAs: "IEJAWS", | ||
os: undefined, | ||
browserVersion: undefined | ||
}); | ||
@@ -137,3 +149,4 @@ }); | ||
os: "Desktop Linux", | ||
displayAs: "Chrome Canary 30" | ||
displayAs: "Chrome Canary 30", | ||
flags: undefined | ||
}); | ||
@@ -147,3 +160,4 @@ }); | ||
os: "Desktop Linux", | ||
displayAs: "Chrome/Linux" | ||
displayAs: "Chrome/Linux", | ||
flags: undefined | ||
}); | ||
@@ -150,0 +164,0 @@ }); |
@@ -25,3 +25,3 @@ /* | ||
describe("Complete test suite", function () { | ||
it("runs properly", function () { | ||
it("runs properly", function (done) { | ||
var options = { | ||
@@ -41,17 +41,8 @@ testCase: 'full/campaign.yaml', | ||
}; | ||
var finished = false; | ||
runs(function () { | ||
utils.runFromCommandLine(options, function (code, testExecution, errorMessages) { | ||
expect(code).toEqual(0); | ||
expect(testExecution).toEqual(options.results); | ||
expect(errorMessages.length).toEqual(0); | ||
finished = true; | ||
}); | ||
}); | ||
waitsFor(function () { | ||
return finished; | ||
}, options.timeout + 100, 'attester to complete'); | ||
utils.runFromCommandLine(options, function (code, testExecution, errorMessages) { | ||
expect(code).toEqual(0); | ||
expect(testExecution).toEqual(options.results); | ||
expect(errorMessages.length).toEqual(0); | ||
runs(function () { | ||
// Check the output has been written correctly | ||
@@ -79,4 +70,6 @@ | ||
rimraf.sync(path.join(__dirname, "out")); | ||
done(); | ||
}); | ||
}); | ||
}, 10000); | ||
}); |
@@ -82,2 +82,7 @@ /* | ||
} | ||
}, function (res) { | ||
if (res.classpath == null) { | ||
delete res.classpath; | ||
} | ||
return res; | ||
}); | ||
@@ -84,0 +89,0 @@ |
@@ -19,49 +19,56 @@ /* | ||
describe("Page generator", function () { | ||
beforeEach(function () { | ||
this.addMatchers({ | ||
toLookLikeTag: function (expectedTag) { | ||
this.message = function () { | ||
return "Tag " + this.actual + " doesn't look like expected " + expectedTag; | ||
}; | ||
function lookLikeTagCompare(actual, expectedTag) { | ||
// check the opening tag | ||
var opening = expectedTag.match(/^(<[a-z]+ )/)[1]; | ||
if (actual.indexOf(opening) !== 0) { | ||
return false; | ||
} | ||
// check the opening tag | ||
var opening = expectedTag.match(/^(<[a-z]+ )/)[1]; | ||
if (this.actual.indexOf(opening) !== 0) { | ||
return false; | ||
} | ||
// check the closing tag | ||
var closing = expectedTag.match(/(<\/[a-z]+>)$/)[1]; | ||
if (actual.indexOf(closing) !== actual.length - closing.length) { | ||
return false; | ||
} | ||
// check the closing tag | ||
var closing = expectedTag.match(/(<\/[a-z]+>)$/)[1]; | ||
if (this.actual.indexOf(closing) !== this.actual.length - closing.length) { | ||
return false; | ||
} | ||
// what is left is the attributes and the content | ||
var splitActual = actual.substring(opening.length, actual.length - closing.length).split(">"); | ||
var splitExpected = expectedTag.substring(opening.length, expectedTag.length - closing.length).split(">"); | ||
// what is left is the attributes and the content | ||
var splitActual = this.actual.substring(opening.length, this.actual.length - closing.length).split(">"); | ||
var splitExpected = expectedTag.substring(opening.length, expectedTag.length - closing.length).split(">"); | ||
// check the body tag | ||
if (splitActual[1].trim() !== splitExpected[1].trim()) { | ||
return false; | ||
} | ||
// check the body tag | ||
if (splitActual[1].trim() !== splitExpected[1].trim()) { | ||
// check the attributes in any order | ||
if (splitActual[0] === splitExpected[0]) { | ||
return true; | ||
} else { | ||
var actual = splitActual[0].split(" ").sort(); | ||
var expected = splitExpected[0].split(" ").sort(); | ||
if (actual.length !== expected.length) { | ||
return false; | ||
} | ||
for (var i = 0; i < expected.length; i += 1) { | ||
if (expected[i] !== actual[i]) { | ||
return false; | ||
} | ||
} | ||
} | ||
// check the attributes in any order | ||
if (splitActual[0] === splitExpected[0]) { | ||
return true; | ||
} else { | ||
var actual = splitActual[0].split(" ").sort(); | ||
var expected = splitExpected[0].split(" ").sort(); | ||
return true; | ||
} | ||
if (actual.length !== expected.length) { | ||
return false; | ||
beforeEach(function () { | ||
jasmine.addMatchers({ | ||
toLookLikeTag: function () { | ||
return { | ||
compare: function (actual, expected) { | ||
var result = {}; | ||
result.pass = lookLikeTagCompare(actual, expected); | ||
result.message = result.pass ? "Tag " + actual + " looks like expected " + expected : "Tag " + actual + " doesn't look like expected " + expected; | ||
return result; | ||
} | ||
for (var i = 0; i < expected.length; i += 1) { | ||
if (expected[i] !== actual[i]) { | ||
return false; | ||
} | ||
} | ||
} | ||
return true; | ||
}; | ||
} | ||
@@ -68,0 +75,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1041033
242
12628
+ Addedattester-launcher@0.3.0(transitive)
+ Addedcompression@1.7.4(transitive)
+ Addedconnect@3.7.0(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addederror-stack-parser@2.0.6(transitive)
+ Addedeventemitter2@6.4.3(transitive)
+ Addedeventsource@1.1.2(transitive)
+ Addedfinalhandler@1.1.2(transitive)
+ Addedhttp-errors@1.7.3(transitive)
+ Addedjs-yaml@3.14.0(transitive)
+ Addedjson3@3.3.3(transitive)
+ Addedlodash@4.17.15(transitive)
+ Addedmime@1.6.0(transitive)
+ Addedminimist@1.2.5(transitive)
+ Addedms@2.1.12.1.3(transitive)
+ Addednode-coverage@2.1.0(transitive)
+ Addedq@1.5.1(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedselenium-webdriver@4.0.0-alpha.7(transitive)
+ Addedsend@0.17.1(transitive)
+ Addedserve-favicon@2.5.0(transitive)
+ Addedserve-static@1.14.1(transitive)
+ Addedsetprototypeof@1.1.1(transitive)
+ Addedsockjs@0.3.20(transitive)
+ Addedsockjs-client@1.4.0(transitive)
+ Addedtoidentifier@1.0.0(transitive)
+ Addedua-parser-js@0.7.21(transitive)
+ Addeduuid@3.4.0(transitive)
+ Addedwebsocket-driver@0.6.5(transitive)
+ Addedws@7.3.0(transitive)
- Removedasync-limiter@1.0.1(transitive)
- Removedattester-launcher@0.2.0(transitive)
- Removedcompression@1.7.1(transitive)
- Removedconnect@3.6.5(transitive)
- Removederror-stack-parser@2.0.2(transitive)
- Removedeventemitter2@2.1.3(transitive)
- Removedeventsource@0.1.6(transitive)
- Removedfinalhandler@1.0.6(transitive)
- Removedhttp-errors@1.6.3(transitive)
- Removedhttp-parser-js@0.5.9(transitive)
- Removedjs-yaml@3.10.0(transitive)
- Removedjson3@3.3.2(transitive)
- Removedlodash@4.17.4(transitive)
- Removedmime@1.4.1(transitive)
- Removedminimist@1.2.0(transitive)
- Removednode-coverage@2.0.0(transitive)
- Removedoriginal@1.0.2(transitive)
- Removedq@1.5.0(transitive)
- Removedsax@1.4.1(transitive)
- Removedselenium-webdriver@3.6.0(transitive)
- Removedsend@0.16.1(transitive)
- Removedserve-favicon@2.4.5(transitive)
- Removedserve-static@1.13.1(transitive)
- Removedsetprototypeof@1.1.0(transitive)
- Removedsockjs@0.3.18(transitive)
- Removedsockjs-client@1.1.4(transitive)
- Removedua-parser-js@0.7.14(transitive)
- Removedultron@1.1.1(transitive)
- Removeduuid@2.0.3(transitive)
- Removedwebsocket-driver@0.7.4(transitive)
- Removedws@3.2.0(transitive)
- Removedxml2js@0.4.23(transitive)
- Removedxmlbuilder@11.0.1(transitive)
Updatedattester-launcher@0.3.0
Updatedcompression@1.7.4
Updatedconnect@3.7.0
Updatederror-stack-parser@2.0.6
Updatedeventemitter2@6.4.3
Updatedjs-yaml@3.14.0
Updatedjson3@3.3.3
Updatedlodash@4.17.15
Updatednode-coverage@2.1.0
Updatedq@1.5.1
Updatedsend@0.17.1
Updatedserve-favicon@2.5.0
Updatedserve-static@1.14.1
Updatedsockjs@0.3.20
Updatedsockjs-client@1.4.0
Updatedua-parser-js@0.7.21