Skip to content

Commit

Permalink
Align with skeleton: remove performance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
web-padawan committed Feb 5, 2018
1 parent d8093c1 commit 6c669df
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 123 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ before_script:
- gulp lint version:check
- polymer lint --rules polymer-2 --input ./src/*.html ./theme/**/*.html
- xvfb-run -s '-screen 0 1024x768x24' wct
- travis_retry xvfb-run -s '-screen 0 1024x768x24' gulp perf:run

script:
- if [[ "$TRAVIS_EVENT_TYPE" != "pull_request" && "$TRAVIS_BRANCH" != quick/* ]]; then
Expand Down
72 changes: 0 additions & 72 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,13 @@ var gulp = require('gulp');
var eslint = require('gulp-eslint');
var htmlExtract = require('gulp-html-extract');
var stylelint = require('gulp-stylelint');
var log = require('gulp-util').log;
var polyserve = require('polyserve');
var spawn = require('child_process').spawn;
var which = require('which');
var find = require('gulp-find');
var replace = require('gulp-replace');
var expect = require('gulp-expect-file');
var grepContents = require('gulp-grep-contents');
var clip = require('gulp-clip-empty-files');
var git = require('gulp-git');

var perf = {
lighthouse: './node_modules/.bin/lighthouse',
port: 7777,
element: require('./package.json').name,
dir: 'test/performance',
tests: require('./test/performance/config.json')
};

gulp.task('lint', ['lint:js', 'lint:html', 'lint:css']);

gulp.task('lint:js', function() {
Expand Down Expand Up @@ -69,66 +57,6 @@ gulp.task('lint:css', function() {
}));
});

function runCommand(cmd, cb) {
var args = cmd.split(/\s+/);
var proc = spawn(args.shift(), args);
var stdout = '';
proc.stdout.on('data', data => stdout += data);
proc.on('close', status => cb(status, stdout));
}

function runTest(test, threshold, cb) {
const url = `http://localhost:${perf.port}/components/${perf.element}/${perf.dir}/${test}`;
const command = `node ${perf.lighthouse} --perf --output=json ${url}`;

log(`Performance running test=${test} threshold=${threshold} ...`);
runCommand(command, (status, stdout) => {
var error;
if (status) {
error = `Error: status ${status} while running lighthouse CLI`;
} else {
var results = JSON.parse(stdout);
var total = results.aggregations[0].score[0].overall;

if (total === undefined) {
error = `Error: lighthouse has not produced a valid JSON output`;
} else if (total == 1) {
error = `Error: lighthouse reported score=1. It might be server not running or bad url: ${url}`;
} else if (total < threshold) {
error = `Error: low performance scored ${total}`;
} else {
log(`Performance done test=${test} scored with ${total}`);
}
}
if (error) {
log(error);
perf.failed = true;
}
cb();
});
}

gulp.task('perf:run:server', function() {
polyserve.startServer({port: perf.port});
});

gulp.task('perf:env', function(cb) {
which('google-chrome-stable', (err, path) => {
process.env.LIGHTHOUSE_CHROMIUM_PATH = path;
cb();
});
});

gulp.task('perf:run:tests', ['perf:run:server', 'perf:env'], function(cb) {
perf.tests.reduce((prev, test) => () => runTest(test.name, test.threshold, prev), cb)();
});

gulp.task('perf:run', ['perf:run:tests'], function() {
log('Finished \'perf:run\' with ' + (perf.failed ? 'error' : 'great success'));
process.exitCode = perf.failed ? 1 : 0;
process.exit();
});

gulp.task('version:check', function() {
const expectedVersion = new RegExp('^' + require('./package.json').version + '$');
return gulp.src(['src/*.html'])
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@
"gulp-html-extract": "^0.3.0",
"gulp-replace": "^0.6.1",
"gulp-stylelint": "^6.0.0",
"lighthouse": "~1.6.5",
"polymer-cli": "^1.6.0",
"stylelint": "^8.0.0",
"stylelint-config-vaadin": "latest",
"web-component-tester": "^6.1.5",
"yargs": "latest"
},
"greenkeeper": {
"ignore": [
"lighthouse"
]
}
}
4 changes: 0 additions & 4 deletions test/performance/config.json

This file was deleted.

20 changes: 0 additions & 20 deletions test/performance/horizontal-layout.html

This file was deleted.

20 changes: 0 additions & 20 deletions test/performance/vertical-layout.html

This file was deleted.

0 comments on commit 6c669df

Please sign in to comment.