From bc855ed6489beeff85250359fa4c1e3ac64bfceb Mon Sep 17 00:00:00 2001 From: Neelanjan Sen <14229985+Fawke@users.noreply.github.com> Date: Tue, 8 Oct 2019 00:26:04 +0530 Subject: [PATCH] Circle CI runs e2e tests on every push (#4200) * run functional tests on circle ci on push to any remote branch * remove extraneous key from config file * add test.localhost as alias to 127.0.0.1 * check 0: execute circle-ci * move /etc/config to a separate command * change bid partner to rubicon * test appnexus bid adapter in ci * comment browserstack command * remove console.log statement * test1: circle-ci * change reference dev -> prod while loading prebid * add console.log statement * check-2: circle-ci * comment browserstack testing * change bid adapter * change bid adapter * remove test case for checking targeting keys * remove the ci flag * uncomment test for checking correct generation of targeting keys * swap AN -> Rubicon for testing targeting keys --- .circleci/config.yml | 5 ++++ gulpfile.js | 29 +++++++++++++++---- .../basic_w_custom_adserver_translation.html | 4 +-- .../basic_w_requireExactDuration.html | 4 +-- .../basic_wo_brandCategoryExclusion.html | 4 +-- .../basic_wo_requireExactDuration.html | 4 +-- test/pages/banner.html | 16 +++++----- test/pages/native.html | 2 +- test/pages/outstream.html | 2 +- test/pages/video.html | 2 +- test/spec/e2e/banner/basic_banner_ad.spec.js | 20 ++++++------- wdio.conf.js | 8 ++++- 12 files changed, 66 insertions(+), 34 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca6713bb587..73ec23aa740 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,6 +34,7 @@ jobs: key: v1-dependencies-{{ checksum "package.json" }} - run: sudo npm install -g gulp-cli + # Download and run BrowserStack local - run: name : Download BrowserStack Local binary and start it. @@ -48,3 +49,7 @@ jobs: - run: name: BrowserStack testing command: gulp test --browserstack --nolintfix + # run e2e tests + - run: + name: Functional testing + command: echo "127.0.0.1 test.localhost" | sudo tee -a /etc/hosts && gulp e2e-test --host=test.localhost --file=./test/spec/e2e/banner/basic_banner_ad.spec.js diff --git a/gulpfile.js b/gulpfile.js index 24c628ef228..2566b52de59 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -214,16 +214,35 @@ function bundle(dev, moduleArr) { // If --browserstack is given, it will run the full suite of currently supported browsers. // If --browsers is given, browsers can be chosen explicitly. e.g. --browsers=chrome,firefox,ie9 // If --notest is given, it will immediately skip the test task (useful for developing changes with `gulp serve --notest`) + function test(done) { if (argv.notest) { done(); } else if (argv.e2e) { let wdioCmd = path.join(__dirname, 'node_modules/.bin/wdio'); let wdioConf = path.join(__dirname, 'wdio.conf.js'); - let wdioOpts = [ - wdioConf - ]; - return execa(wdioCmd, wdioOpts, { stdio: 'inherit' }); + let wdioOpts; + + if (argv.file) { + wdioOpts = [ + wdioConf, + `--spec`, + `${argv.file}` + ] + } else { + wdioOpts = [ + wdioConf + ]; + } + execa(wdioCmd, wdioOpts, { stdio: 'inherit' }) + .then(stdout => { + done(); + process.exit(0); + }) + .catch(err => { + done(new Error(`Tests failed with error: ${err}`)); + process.exit(1); + }); } else { var karmaConf = karmaConfMaker(false, argv.browserstack, argv.watch, argv.file); @@ -315,7 +334,7 @@ gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid)); gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test))); gulp.task('default', gulp.series(clean, makeWebpackPkg)); -gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-dev', watch), test)) +gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), test)) // other tasks gulp.task(bundleToStdout); gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenating pre-built files with no build step diff --git a/integrationExamples/longform/basic_w_custom_adserver_translation.html b/integrationExamples/longform/basic_w_custom_adserver_translation.html index 995ea822da4..8f4d46c3079 100644 --- a/integrationExamples/longform/basic_w_custom_adserver_translation.html +++ b/integrationExamples/longform/basic_w_custom_adserver_translation.html @@ -5,7 +5,7 @@ Prebid Freewheel Integration Demo - + + + + + @@ -38,9 +38,11 @@ } }, bids: [{ - bidder: 'appnexus', + bidder: "rubicon", params: { - placementId: 13144370 + accountId: 14062, + siteId: 70608, + zoneId: 498816 } }] }]; @@ -74,7 +76,7 @@ googletag .defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0') .addService(googletag.pubads()); - + googletag.pubads().enableSingleRequest(); googletag.enableServices(); }); @@ -84,9 +86,9 @@

Prebid.js Banner Ad Unit Test

- +
diff --git a/test/pages/native.html b/test/pages/native.html index 0823f486848..f382ab8aad7 100644 --- a/test/pages/native.html +++ b/test/pages/native.html @@ -7,7 +7,7 @@ Prebid.js Native Example - + diff --git a/test/pages/outstream.html b/test/pages/outstream.html index 56e443a519b..2a0543095cd 100644 --- a/test/pages/outstream.html +++ b/test/pages/outstream.html @@ -7,7 +7,7 @@ Prebid.js Video Outstream Example - + diff --git a/test/pages/video.html b/test/pages/video.html index e040b65fe23..3fabeb14b94 100644 --- a/test/pages/video.html +++ b/test/pages/video.html @@ -16,7 +16,7 @@ - +