Add inferno in todoapp benchmark
This commit is contained in:
parent
02e7b40c07
commit
d571dd2e56
26 changed files with 8148 additions and 5 deletions
99
bench/implementations/inferno/test/memory.js
Normal file
99
bench/implementations/inferno/test/memory.js
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
'use strict';
|
||||
|
||||
var drool = require('drool');
|
||||
var exceptions = require('./memory-exceptions.json');
|
||||
var argv = require('optimist').default('laxMode', false).default('browser', 'chrome').argv;
|
||||
var driverConfig = {
|
||||
chromeOptions: 'no-sandbox'
|
||||
};
|
||||
|
||||
if (typeof process.env.CHROME_PATH !== 'undefined') {
|
||||
driverConfig.chromeBinaryPath = process.env.CHROME_PATH;
|
||||
}
|
||||
|
||||
var driver = drool.start(driverConfig);
|
||||
|
||||
function idApp() {
|
||||
return driver.findElement(drool.webdriver.By.css('#todoapp'))
|
||||
.then(function () { return true; })
|
||||
.thenCatch(function () { return false; });
|
||||
}
|
||||
|
||||
function newTodoSelector() {
|
||||
return idApp().then(function (isId) {
|
||||
if (isId) {
|
||||
return '#new-todo';
|
||||
}
|
||||
|
||||
return '.new-todo';
|
||||
});
|
||||
}
|
||||
|
||||
function listSelector() {
|
||||
return idApp().then(function (isId) {
|
||||
if (isId) {
|
||||
return '#todo-list li';
|
||||
}
|
||||
|
||||
return '.todo-list li';
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
drool.flow({
|
||||
repeatCount: 5,
|
||||
setup: function () {
|
||||
driver.get('http://localhost:8000/index.html');
|
||||
},
|
||||
action: function (name) {
|
||||
driver.wait(function () {
|
||||
driver.sleep(500);
|
||||
return driver.findElement(drool.webdriver.By.css(newTodoSelector(name)))
|
||||
.sendKeys('find magical goats', drool.webdriver.Key.ENTER)
|
||||
.thenCatch(function () {
|
||||
return false;
|
||||
})
|
||||
.then(function () {
|
||||
return driver.findElement(drool.webdriver.By.css(listSelector(name))).isDisplayed()
|
||||
.then(function () {
|
||||
return true;
|
||||
});
|
||||
});
|
||||
}, 10000);
|
||||
|
||||
driver.wait(function () {
|
||||
return driver.findElement(drool.webdriver.By.css(listSelector(name))).click()
|
||||
.thenCatch(function () {
|
||||
return false;
|
||||
})
|
||||
.then(function () {
|
||||
return true;
|
||||
});
|
||||
});
|
||||
|
||||
driver.findElement(drool.webdriver.By.css('.destroy')).click();
|
||||
}.bind(null, 'inferno'),
|
||||
assert: function (after, initial) {
|
||||
var nodeIncrease = (after.nodes - initial.nodes);
|
||||
var listenerIncrease = (after.jsEventListeners - initial.jsEventListeners);
|
||||
var memoryExceptions = exceptions['inferno'] || {};
|
||||
|
||||
console.log(this + ', ' + nodeIncrease + ', ' +
|
||||
(after.jsHeapSizeUsed - initial.jsHeapSizeUsed) + ', ' + listenerIncrease);
|
||||
|
||||
//https://code.google.com/p/chromium/issues/detail?id=516153
|
||||
if (nodeIncrease > memoryExceptions.nodes || 0) {
|
||||
throw new Error('Node Count leak detected!');
|
||||
}
|
||||
|
||||
if (listenerIncrease > memoryExceptions.listeners || 0) {
|
||||
throw new Error('Event Listener leak detected!');
|
||||
}
|
||||
|
||||
}.bind('inferno')
|
||||
}, driver);
|
||||
|
||||
driver.quit();
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue