Skip to content

Commit

Permalink
Merge pull request #389 from PubMatic-OpenWrap/test_br_b2_20200506145340
Browse files Browse the repository at this point in the history
Prebid upgarde automate- test pull request created through git api please ignore it
  • Loading branch information
pm-shashank-jain authored May 6, 2020
2 parents 89cc83f + f01989b commit 9f451f6
Show file tree
Hide file tree
Showing 33 changed files with 11,565 additions and 555 deletions.
107 changes: 79 additions & 28 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
'use strict';

var _ = require('lodash');
console.time('Loading Plugins in Prebid');
var argv = require('yargs').argv;
var gulp = require('gulp');
var gutil = require('gulp-util');
var connect = require('gulp-connect');
var webpack = require('webpack');
var webpackStream = require('webpack-stream');
var uglify = require('gulp-uglify');
var gulpClean = require('gulp-clean');
var KarmaServer = require('karma').Server;
var karmaConfMaker = require('./karma.conf.maker');
var opens = require('opn');
var webpackConfig = require('./webpack.conf');
var helpers = require('./gulpHelpers');
// var gutil = require('gulp-util');
// var connect = require('gulp-connect');
// var webpack = require('webpack');
// var webpackStream = require('webpack-stream');
// var uglify = require('gulp-uglify');
// var gulpClean = require('gulp-clean');
// var KarmaServer = require('karma').Server;
// var karmaConfMaker = require('./karma.conf.maker');
// var opens = require('opn');
// var webpackConfig = require('./webpack.conf');
// var helpers = require('./gulpHelpers');
var concat = require('gulp-concat');
var header = require('gulp-header');
var footer = require('gulp-footer');
// var header = require('gulp-header');
// var footer = require('gulp-footer');
var replace = require('gulp-replace');
var shell = require('gulp-shell');
var eslint = require('gulp-eslint');
var gulpif = require('gulp-if');
var sourcemaps = require('gulp-sourcemaps');
var through = require('through2');
var fs = require('fs');
var jsEscape = require('gulp-js-escape');
// var shell = require('gulp-shell');
// var eslint = require('gulp-eslint');
// var gulpif = require('gulp-if');
// var sourcemaps = require('gulp-sourcemaps');
// var through = require('through2');
// var fs = require('fs');
// var jsEscape = require('gulp-js-escape');
const path = require('path');
const execa = require('execa');

var prebid = require('./package.json');
var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + ' */\n';
var port = 9999;
console.timeEnd('Loading Plugins in Prebid');
const mockServerPort = 4444;
const host = argv.host ? argv.host : 'localhost';
const { spawn } = require('child_process');
Expand All @@ -48,6 +48,7 @@ function bundleToStdout() {
bundleToStdout.displayName = 'bundle-to-stdout';

function clean() {
var gulpClean = require('gulp-clean');
return gulp.src(['build'], {
read: false,
allowEmpty: true
Expand All @@ -57,13 +58,18 @@ function clean() {

// Dependant task for building postbid. It escapes postbid-config file.
function escapePostbidConfig() {
var jsEscape = require('gulp-js-escape');

gulp.src('./integrationExamples/postbid/oas/postbid-config.js')
.pipe(jsEscape())
.pipe(gulp.dest('build/postbid/'));
};
escapePostbidConfig.displayName = 'escape-postbid-config';

function lint(done) {
var eslint = require('gulp-eslint');
var gulpif = require('gulp-if');

if (argv.nolint) {
return done();
}
Expand All @@ -79,6 +85,9 @@ function lint(done) {

// View the code coverage report in the browser.
function viewCoverage(done) {
var connect = require('gulp-connect');
var opens = require('opn');

var coveragePort = 1999;
var mylocalhost = (argv.host) ? argv.host : 'localhost';

Expand All @@ -95,6 +104,8 @@ viewCoverage.displayName = 'view-coverage';

// Watch Task with Live Reload
function watch(done) {
var connect = require('gulp-connect');

var mainWatcher = gulp.watch([
'src/**/*.js',
'modules/**/*.js',
Expand All @@ -119,6 +130,13 @@ function watch(done) {
};

function makeDevpackPkg() {
var _ = require('lodash');
var connect = require('gulp-connect');
var webpack = require('webpack');
var webpackStream = require('webpack-stream');
var webpackConfig = require('./webpack.conf');
var helpers = require('./gulpHelpers');

var cloned = _.cloneDeep(webpackConfig);
cloned.devtool = 'source-map';
var externalModules = helpers.getArgModules();
Expand All @@ -134,6 +152,15 @@ function makeDevpackPkg() {
}

function makeWebpackPkg() {
var _ = require('lodash');
var webpack = require('webpack');
var webpackStream = require('webpack-stream');
var uglify = require('gulp-uglify');
var webpackConfig = require('./webpack.conf');
var helpers = require('./gulpHelpers');
var header = require('gulp-header');
var gulpif = require('gulp-if');

var cloned = _.cloneDeep(webpackConfig);
delete cloned.devtool;

Expand All @@ -155,6 +182,8 @@ function gulpBundle(dev) {
}

function nodeBundle(modules) {
var through = require('through2');

return new Promise((resolve, reject) => {
bundle(false, modules)
.on('error', (err) => {
Expand All @@ -168,9 +197,17 @@ function nodeBundle(modules) {
}

function bundle(dev, moduleArr) {
// console.time('Loading Plugins for Prebid');
var _ = require('lodash');
var gutil = require('gulp-util');
var helpers = require('./gulpHelpers');
var footer = require('gulp-footer');
var gulpif = require('gulp-if');
var sourcemaps = require('gulp-sourcemaps');
var modules = moduleArr || helpers.getArgModules();
var allModules = helpers.getModuleNames(modules);

// console.timeEnd('Loading Plugins for Prebid');
// console.time('Getting Modules for Prebid');
if (modules.length === 0) {
modules = allModules.filter(module => explicitModules.indexOf(module) === -1);
} else {
Expand All @@ -182,7 +219,8 @@ function bundle(dev, moduleArr) {
});
}
}

// console.timeEnd('Getting Modules for Prebid');
// console.time('Concating Starts');
var entries = [helpers.getBuiltPrebidCoreFile(dev)].concat(helpers.getBuiltModules(dev, modules));

var outputFileName = argv.bundleName ? argv.bundleName : 'prebid.js';
Expand All @@ -192,10 +230,10 @@ function bundle(dev, moduleArr) {
outputFileName = outputFileName.replace(/\.js$/, `.${argv.tag}.js`);
}

gutil.log('Concatenating files:\n', entries);
gutil.log('Appending ' + prebid.globalVarName + '.processQueue();');
gutil.log('Generating bundle:', outputFileName);

// gutil.log('Concatenating files:\n', entries);
// gutil.log('Appending ' + prebid.globalVarName + '.processQueue();');
// gutil.log('Generating bundle:', outputFileName);
// console.timeEnd('Concating Starts');
return gulp.src(
entries
)
Expand All @@ -219,6 +257,10 @@ function bundle(dev, moduleArr) {
// If --notest is given, it will immediately skip the test task (useful for developing changes with `gulp serve --notest`)

function test(done) {
var KarmaServer = require('karma').Server;
var karmaConfMaker = require('./karma.conf.maker');
var helpers = require('./gulpHelpers');

if (argv.notest) {
done();
} else if (argv.e2e) {
Expand Down Expand Up @@ -290,10 +332,15 @@ function newKarmaCallback(done) {

// If --file "<path-to-test-file>" is given, the task will only run tests in the specified file.
function testCoverage(done) {
var KarmaServer = require('karma').Server;
var karmaConfMaker = require('./karma.conf.maker');

new KarmaServer(karmaConfMaker(true, false, false, argv.file), newKarmaCallback(done)).start();
}

function coveralls() { // 2nd arg is a dependency: 'test' must be finished
var shell = require('gulp-shell');

// first send results of istanbul's test coverage to coveralls.io.
return gulp.src('gulpfile.js', { read: false }) // You have to give it a file, but you don't
// have to read it.
Expand All @@ -304,6 +351,8 @@ function coveralls() { // 2nd arg is a dependency: 'test' must be finished
// More info can be found here http://prebid.org/overview/what-is-post-bid.html

function buildPostbid() {
var fs = require('fs');

var fileContent = fs.readFileSync('./build/postbid/postbid-config.js', 'utf8');

return gulp.src('./integrationExamples/postbid/oas/postbid.js')
Expand All @@ -312,6 +361,8 @@ function buildPostbid() {
}

function setupE2e(done) {
var gutil = require('gulp-util');

if (!argv.host) {
throw new gutil.PluginError({
plugin: 'E2E test',
Expand Down
109 changes: 109 additions & 0 deletions integrationExamples/gpt/gdpr_iframe_hello_world.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<!--
This page calls a single bidder for a single ad slot. It can be considered a "hello world" example for using
Prebid with the Google Publisher Tag.
It also makes a good test page for new adapter PR submissions. Simply set your server's Bid Params object in the
bids array inside the adUnits, and it will use your adapter to load an ad.
NOTE that many ad servers won't send back an ad if the URL is localhost... so you might need to
set an alias in your /etc/hosts file so that you can load this page from a different domain.
-->

<html>
<head>
<script>
var PREBID_TIMEOUT = 700;

var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
sizes: [[300, 250], [300,600]],

// Replace this object to test a new Adapter!
bids: [{
bidder: 'appnexusAst',
params: {
placementId: '10433394'
}
}]

}];

var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

</script>

<script type="text/javascript" src="../../build/dev/prebid.js" async></script>
<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(function() {
pbjs.addAdUnits(adUnits);
pbjs.setConfig({
consentManagement: {
cmpApi: 'iab',
timeout: 5000,
allowAuctionWithoutConsent: false
},
pubcid: {
enable: false
},
debug: true
});
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest
});
});

function sendAdserverRequest() {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

// setTimeout(function() {
// sendAdserverRequest();
// }, PREBID_TIMEOUT);

</script>

<script>
(function () {
var gads = document.createElement('script');
gads.async = true;
gads.type = 'text/javascript';
var useSSL = 'https:' == document.location.protocol;
gads.src = (useSSL ? 'https:' : 'http:') +
'//www.googletagservices.com/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(gads, node);
})();
</script>

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>

<body>
<h2>Prebid.js Test</h2>
<h5>Div-1</h5>
<div id='div-gpt-ad-1460505748561-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
</script>
</div>
</body>
</html>
10 changes: 10 additions & 0 deletions integrationExamples/gpt/gdpr_iframe_test.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<script>window.__cmp = {config: {logging: 'debug'}}</script>
<script src="//acdn.adnxs.com/cmp/cmp.complete.bundle.js" async></script>
</head>

<body>
<iframe src="../../integrationExamples/gpt/gdpr_iframe_hello_world.html" style="height:800px; width:800px" id="myId"/>
</body>
</html>
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["appnexusBidAdapter","consentManagement","sekindoUMBidAdapter","pulsepointBidAdapter","audienceNetworkBidAdapter","openxBidAdapter","rubiconBidAdapter","sovrnBidAdapter","pubmaticBidAdapter","adgenerationBidAdapter","pubmaticServerBidAdapter","ixBidAdapter","criteoBidAdapter"]
["appnexusBidAdapter","consentManagement","sekindoUMBidAdapter","pulsepointBidAdapter","audienceNetworkBidAdapter","openxBidAdapter","rubiconBidAdapter","sovrnBidAdapter","pubmaticBidAdapter","adgenerationBidAdapter","pubmaticServerBidAdapter","ixBidAdapter","criteoBidAdapter"]
1 change: 1 addition & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"pubCommonIdSystem",
"digiTrustIdSystem",
"id5IdSystem",
"criteortusIdSystem",
"parrableIdSystem",
"britepoolIdSystem",
"liveIntentIdSystem",
Expand Down
1 change: 1 addition & 0 deletions modules/adformBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const OUTSTREAM_RENDERER_URL = 'https://s2.adform.net/banners/scripts/video/outs
const BIDDER_CODE = 'adform';
export const spec = {
code: BIDDER_CODE,
aliases: ['adform2'],
supportedMediaTypes: [ BANNER, VIDEO ],
isBidRequestValid: function (bid) {
return !!(bid.params.mid);
Expand Down
3 changes: 1 addition & 2 deletions modules/audienceNetworkBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ const hbBidder = 'fan';
const ttl = 600;
const videoTtl = 3600;
const platver = '$prebid.version$';
const platform = '241394079772386';
const platform = '2078522619030089';
const adapterver = '1.3.0';

/**
* Does this bid request contain valid parameters?
* @param {Object} bid
Expand Down
Loading

0 comments on commit 9f451f6

Please sign in to comment.