chore(benchpress): add ff extension test to ci

Closes #2229
This commit is contained in:
Hank Duan 2015-06-01 16:17:28 -07:00 committed by Tobias Bosch
parent ba7956f521
commit 5fa54a92bc
3 changed files with 8 additions and 12 deletions

View File

@ -5,8 +5,6 @@ var testHelper = require('../../src/firefox_extension/lib/test_helper.js');
var PROFILE_SAVE_PATH = './perfProfile.json'; var PROFILE_SAVE_PATH = './perfProfile.json';
exports.config = { exports.config = {
seleniumAddress: 'http://127.0.0.1:4444/wd/hub',
specs: ['spec.js'], specs: ['spec.js'],
getMultiCapabilities: function() { return testHelper.getFirefoxProfileWithExtension(); }, getMultiCapabilities: function() { return testHelper.getFirefoxProfileWithExtension(); },

View File

@ -7,9 +7,9 @@ var fs = require('fs');
var validateFile = function() { var validateFile = function() {
try { try {
var content = fs.readFileSync(browser.params.profileSavePath, 'utf8'); var content = fs.readFileSync(browser.params.profileSavePath, 'utf8');
// TODO(hankduan): This check not very useful. Ideally we want to validate // TODO(hankduan): This check is not very useful. Ideally we want to
// that the file contains all the events that we are looking for. Pending // validate that the file contains all the events that we are looking for.
// on data transformer. // Pending on data transformer.
expect(content).toContain('forceGC'); expect(content).toContain('forceGC');
// Delete file // Delete file
fs.unlinkSync(browser.params.profileSavePath); fs.unlinkSync(browser.params.profileSavePath);
@ -25,22 +25,18 @@ var validateFile = function() {
}; };
describe('firefox extension', function() { describe('firefox extension', function() {
var TEST_URL = 'http://localhost:8001/examples/src/hello_world/index.html';
it('should measure performance', function() { it('should measure performance', function() {
browser.sleep(3000); // wait for extension to load browser.sleep(3000); // wait for extension to load
browser.driver.get('http://www.angularjs.org'); browser.driver.get(TEST_URL);
browser.executeScript('window.startProfiler()') browser.executeScript('window.startProfiler()')
.then(function() { console.log('started measuring perf'); }); .then(function() { console.log('started measuring perf'); });
browser.executeScript('window.forceGC()'); browser.executeScript('window.forceGC()');
// Run some commands
element(by.model('yourName')).sendKeys('Hank');
expect(element(by.binding('yourName')).getText()).toEqual('Hello Hank!');
browser.executeScript('window.forceGC()');
var script = 'window.stopAndRecord("' + browser.params.profileSavePath + '")'; var script = 'window.stopAndRecord("' + browser.params.profileSavePath + '")';
browser.executeScript(script).then(function() { console.log('stopped measuring perf'); }); browser.executeScript(script).then(function() { console.log('stopped measuring perf'); });

View File

@ -30,3 +30,5 @@ fi
./node_modules/.bin/protractor protractor-js.conf.js $OPTIONS ./node_modules/.bin/protractor protractor-js.conf.js $OPTIONS
./node_modules/.bin/protractor protractor-js.conf.js $OPTIONS --benchmark --dryrun ./node_modules/.bin/protractor protractor-js.conf.js $OPTIONS --benchmark --dryrun
./node_modules/.bin/protractor dist/js/cjs/benchpress/test/firefox_extension/conf.js