2
modules/benchpress/test/firefox_extension/conf.dart
Normal file
2
modules/benchpress/test/firefox_extension/conf.dart
Normal file
@ -0,0 +1,2 @@
|
||||
library benchpress.test.firefox_extension.conf;
|
||||
//empty as we don't have a version for dart
|
@ -1,3 +1,4 @@
|
||||
/// <reference path="../../../angular2/typings/node/node.d.ts" />
|
||||
var testHelper = require('../../src/firefox_extension/lib/test_helper.js');
|
||||
|
||||
// Where to save profile results (parent folder must exist)
|
||||
@ -8,11 +9,7 @@ exports.config = {
|
||||
|
||||
specs: ['spec.js'],
|
||||
|
||||
getMultiCapabilities: function() {
|
||||
return testHelper.getFirefoxProfileWithExtension();
|
||||
},
|
||||
getMultiCapabilities: function() { return testHelper.getFirefoxProfileWithExtension(); },
|
||||
|
||||
params: {
|
||||
profileSavePath: testHelper.getAbsolutePath(PROFILE_SAVE_PATH)
|
||||
}
|
||||
params: {profileSavePath: testHelper.getAbsolutePath(PROFILE_SAVE_PATH)}
|
||||
};
|
2
modules/benchpress/test/firefox_extension/spec.dart
Normal file
2
modules/benchpress/test/firefox_extension/spec.dart
Normal file
@ -0,0 +1,2 @@
|
||||
library benchpress.test.firefox_extension.spec;
|
||||
//no dart implementation
|
@ -1,3 +1,7 @@
|
||||
/// <reference path="../../../angular2/typings/node/node.d.ts" />
|
||||
/// <reference path="../../../angular2/typings/angular-protractor/angular-protractor.d.ts" />
|
||||
/// <reference path="../../../angular2/typings/jasmine/jasmine.d.ts" />
|
||||
|
||||
var fs = require('fs');
|
||||
|
||||
var validateFile = function() {
|
||||
@ -5,7 +9,7 @@ var validateFile = function() {
|
||||
var content = fs.readFileSync(browser.params.profileSavePath, 'utf8');
|
||||
// TODO(hankduan): This check not very useful. Ideally we want to validate
|
||||
// that the file contains all the events that we are looking for. Pending
|
||||
// on data transformer.
|
||||
// on data transformer.
|
||||
expect(content).toContain('forceGC');
|
||||
// Delete file
|
||||
fs.unlinkSync(browser.params.profileSavePath);
|
||||
@ -21,14 +25,13 @@ var validateFile = function() {
|
||||
};
|
||||
|
||||
describe('firefox extension', function() {
|
||||
it ('should measure performance', function() {
|
||||
browser.sleep(3000); // wait for extension to load
|
||||
it('should measure performance', function() {
|
||||
browser.sleep(3000); // wait for extension to load
|
||||
|
||||
browser.driver.get('http://www.angularjs.org');
|
||||
|
||||
browser.executeScript('window.startProfiler()').then(function() {
|
||||
console.log('started measuring perf');
|
||||
});
|
||||
browser.executeScript('window.startProfiler()')
|
||||
.then(function() { console.log('started measuring perf'); });
|
||||
|
||||
browser.executeScript('window.forceGC()');
|
||||
|
||||
@ -38,13 +41,10 @@ describe('firefox extension', function() {
|
||||
|
||||
browser.executeScript('window.forceGC()');
|
||||
|
||||
var script =
|
||||
'window.stopAndRecord("' + browser.params.profileSavePath + '")';
|
||||
browser.executeScript(script).then(function() {
|
||||
console.log('stopped measuring perf');
|
||||
});
|
||||
var script = 'window.stopAndRecord("' + browser.params.profileSavePath + '")';
|
||||
browser.executeScript(script).then(function() { console.log('stopped measuring perf'); });
|
||||
|
||||
// wait for it to finish, then validate file.
|
||||
browser.sleep(3000).then(validateFile);
|
||||
// wait for it to finish, then validate file.
|
||||
browser.sleep(3000).then(validateFile);
|
||||
})
|
||||
});
|
Reference in New Issue
Block a user