Run e2e on full APIs guru list only on tags

This commit is contained in:
Roman Hotsiy 2016-01-20 18:31:32 +02:00
parent f64d4180a6
commit 528b1c4728
2 changed files with 23 additions and 2 deletions

View File

@ -82,9 +82,21 @@ function fixFFTest(done) {
})
}
/* picks each n-th property from object */
function eachNth(obj, n) {
let res = {};
Object.keys(obj).forEach((k, idx) => {
if (idx % n === 0) {
res[k] = obj[k];
}
});
return res;
}
module.exports = {
loadJson: loadJson,
verifyNoBrowserErrors: verifyNoBrowserErrors,
scrollToEl: scrollToEl,
fixFFTest: fixFFTest
fixFFTest: fixFFTest,
eachNth: eachNth
}

View File

@ -2,6 +2,7 @@
const verifyNoBrowserErrors = require('./helpers').verifyNoBrowserErrors;
const scrollToEl = require('./helpers').scrollToEl;
const fixFFTest = require('./helpers').fixFFTest;
const eachNth = require('./helpers').eachNth;
const URL = 'index.html';
@ -35,7 +36,7 @@ basicTests(null, 'Extended Petstore');
describe('Scroll sync', () => {
let specUrl = URL;
beforeEach((done) => {
browser.get(specUrl);
fixFFTest(done);
@ -59,6 +60,14 @@ describe('APIs.guru specs test', ()=> {
delete apisGuruList['googleapis.com:mirror']; // bad urls in images
delete apisGuruList['googleapis.com:discovery']; // non-string references
// run quick version of e2e test on all builds except releases
if (process.env.TRAVIS && !process.env.TRAVIS_TAG) {
console.log('Running on short APIs guru list');
apisGuruList = eachNth(apisGuruList, 10);
} else {
console.log('Running on full APIs guru list')
}
for (let apiName of Object.keys(apisGuruList)) {
let apiInfo = apisGuruList[apiName].versions[apisGuruList[apiName].preferred];
let url = apiInfo.swaggerUrl;