Skip to content

Commit

Permalink
chore(*) add docs e2e testing support for travis
Browse files Browse the repository at this point in the history
* gulp build and npm run test-e2e rely on WITH_DOCS env var
* WITH_DOCS env var declared in .travis.yml

That way, doesn't change user workflow, but I still can test properly the doc generation
  • Loading branch information
topheman committed Sep 18, 2015
1 parent 3877873 commit f8429b7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ addons:
sauce_connect: true
env:
global:
#You don't need the WITH_DOCS variable (this is only for me to launch the e2e tests of the generated doc internally)
- WITH_DOCS=true
- secure: lVqaKzskSfk4RQRYWhb/9eF9iY/18+ZDD3+85tCZVQP/SNRybvAUm9TgCJP8T1JYU4xjmKeXsglg6XHabjbTOqHDo76vKk47rtFD8MOz5/GjGaC0fPNbHgjrXcinMquv1P1tJRle31kLf+BBtrj1LAl/PgoGTTm63OhXDiO6ijVoIVgSLHXWHJVSDu2FsEgAn+rO0nQkMUHgAHs1V1ocy+kZjRf+rIMSn7K6Va/sY0dN7r/efB3yQCBDxCKarORCU+ixDtwEApplWr+8p/IXsb4P3NQ80dmIBzYOd++cAVe1GfmMYcqBgZMg7+EjY14RoL+XwPimu7fQ2GhhQbzFrvJYb73a/CSfaMbtvO2oCCLAbfiPuijt7DhuuWJbhtKHTaJ+HHiEExVk6DA9VrQz1dIBgFD8FtblRskxkTRFsIyQGxdqnpoU/gCNL2MoluBtYTMai6TrcDNxZ+U1zlCTGyWbHr8hy/WUW7nW48KS2LlHbNjBlCw6G+WKy2IotyMOahqS+Fnksk0/QeHNAjUYy8lIpG/hZvdalJW8GsMszyeOrw3Pt6pXkjf7U74oLTmimhkHB8WjjV/FtXS70VG0aI3ALRJLSVJlGj1t0NCYI5Lf6CpkpwK0f7/OTs6R5WVpxuo9f4rhJngNPkyEj8HWp2wquihuS1VAvxtvHOPZOd4=
- secure: fVv0ZWvXcF83t7nLsBYKaXqwMQ3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yTYk046uHB+jrJ4Clf3n/inZL+h8eh55IyxBOFDmNOBn3qBMIW2WX+siJ2uScCPf2BQQrpVt3GtnKA/dAz4cSfYWPcwVw3vnPC99Rxj4sI9tC0r0kSEXGWpJruUUk3lZvHaFDYoqbZywoDNlAgCMB0149MGa/M9l/5YICIJB3q6UQwHDBNoXJFp7AG0T9f2XOQQ8nEbJvs39F4uSWaFLwdd2W4alJjXpe8ABUO/HofedvPlrrJHOgQNx/zYZj9ZK5y0skJsikaRBBQM=
Expand Down
6 changes: 5 additions & 1 deletion gulp/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ LOG(COLORS.yellow('### Running in ' + environment + ' ###'));

export const ENV = environment;

export const WITH_DOCS = util.env['with-docs'];
export const WITH_DOCS = util.env['with-docs'] || process.env.WITH_DOCS;

if(WITH_DOCS){
LOG(COLORS.yellow('### Running in --with-docs mode ###'));
}

/**
* @warn this is still in progress
Expand Down
14 changes: 11 additions & 3 deletions protractor.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,21 @@ var IS_ANGULAR = (pkg.config ? (pkg.config.isAngular ? pkg.config.isAngular : fa
var argv = require('minimist')(process.argv.slice(2));
var PORT = argv.port || (pkg.config ? (pkg.config.port ? pkg.config.port : null) : null) || 9000;
var BASE_URL = argv['base-url'] || 'http://localhost';
var WITH_DOCS = argv['with-docs'] || process.env.WITH_DOCS;
console.log('[INFOS] Testing on ' + BASE_URL + ':' + PORT);

var specs = [
'test/e2e/spec/**/*.spec.js'
];

if(WITH_DOCS){
console.log('[INFOS] Running in --with-docs mode (will run the test that will check for /docs to make sure they were correctly generated)');
specs.push('test/e2e/spec/docs.specs.conditional.js');
}

var config = {
framework: 'jasmine2',
specs: [
'test/e2e/spec/**/*.spec.js'
],
specs: specs,
onPrepare: function () {
browser.ignoreSynchronization = !IS_ANGULAR;
/**
Expand Down
26 changes: 26 additions & 0 deletions test/e2e/spec/docs.specs.conditional.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
'use strict';

/**
* This test is only run when the --with-docs flag is active : `npm run test-e2e -- --with-docs`
* or when WITH_DOCS env variable is declared at true
*
* It's only meant to be run against a built version (also built with the flag --with-docs or WITH_DOCS env variable declared)
*
* This is not a documented feature. This is more to ensure on travis that not only:
* - the doc generates correctly without failing
* - but it also generates a correct output
*/

// before each 'it' of the following describe:
describe('Docs home page /docs', () => {
beforeEach(() => {
//go to page (if not yet)
goToUrl('/docs');
});
it('should have a title', () => {
expect(browser.getTitle()).toEqual('vanilla-es6-jspm');
});
it('should have a title in the header', () => {
expect(element(by.css('h1.blue-main-title')).getText()).toEqual('vanilla-es6-jspm');
});
});

0 comments on commit f8429b7

Please sign in to comment.