mirror of
https://github.com/google/material-design-lite.git
synced 2024-09-11 12:25:38 +03:00
Add initial automated memory test.
This is the initial automated memory test for the menu component in material design light. Running this file will check to see if any new DOM nodes or listeners have been created, therefore automatically detecting memory leaks.
This commit is contained in:
parent
a752f0e7b5
commit
549844b425
@ -12,6 +12,7 @@
|
||||
"chai": "^2.0.0",
|
||||
"chai-jquery": "^2.0.0",
|
||||
"del": "^1.1.1",
|
||||
"drool": "^0.2.0",
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-autoprefixer": "^2.0.0",
|
||||
"gulp-cache": "^0.2.6",
|
||||
@ -48,6 +49,7 @@
|
||||
"gulp-useref": "^1.0.1",
|
||||
"gulp-util": "^3.0.4",
|
||||
"gulp-zip": "^3.0.2",
|
||||
"humanize": "0.0.9",
|
||||
"jquery": "^2.1.3",
|
||||
"jshint-stylish": "^1.0.0",
|
||||
"merge-stream": "^0.1.7",
|
||||
|
32
test/memory/test.js
Normal file
32
test/memory/test.js
Normal file
@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
var drool = require('drool');
|
||||
var path = require('path');
|
||||
var humanize = require('humanize');
|
||||
var assert = require('assert');
|
||||
var webdriver = require('../../node_modules/drool/node_modules/selenium-webdriver');
|
||||
var driver = drool.start();
|
||||
|
||||
drool.flow({
|
||||
setup: function() {
|
||||
driver.get('file://' + path.join(__dirname, '../../dist/components/menu/demo.html'));
|
||||
},
|
||||
action: function() {
|
||||
driver.findElement(webdriver.By.css('#demo-menu-lower-left')).click();
|
||||
driver.sleep(1000);
|
||||
driver.findElement(webdriver.By.css('#demo-menu-lower-left')).click();
|
||||
},
|
||||
beforeAssert: function() {
|
||||
driver.sleep(1000);
|
||||
},
|
||||
assert: function(after, initial) {
|
||||
console.log('Menu Component Toggle Test');
|
||||
console.log('node delta: ' + (after.nodes - initial.nodes));
|
||||
console.log('heap delta: ' + humanize.filesize(after.jsHeapSizeUsed - initial.jsHeapSizeUsed));
|
||||
console.log('event listener delta: ' + (after.jsEventListeners - initial.jsEventListeners));
|
||||
|
||||
assert.equal(true, after.jsEventListeners <= initial.jsEventListeners);
|
||||
}
|
||||
}, driver);
|
||||
|
||||
driver.quit();
|
Loading…
Reference in New Issue
Block a user