Skip to content

Commit

Permalink
Merge pull request #18 from prebid/master
Browse files Browse the repository at this point in the history
Update Sovrn Master
  • Loading branch information
jrosendahl authored Jun 25, 2019
2 parents cc2f394 + 5e1d889 commit d5d4752
Show file tree
Hide file tree
Showing 261 changed files with 22,844 additions and 6,861 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ commit your changes, and [open a pull request](https://help.github.com/articles/
master branch.

Pull requests must have 80% code coverage before beign considered for merge.
Additional details about the process can be found [here](./pr_review.md).
Additional details about the process can be found [here](./PR_REVIEW.md).

## Issues
[prebid.org](http://prebid.org/) contains documentation that may help answer questions you have about using Prebid.js.
Expand Down
18 changes: 14 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ prebid.requestBids({

*Note:* In the 1.24.0 release of Prebid.js we have transitioned to using gulp 4.0 from using gulp 3.9.1. To compily with gulp's recommended setup for 4.0, you'll need to have `gulp-cli` installed globally prior to running the general `npm install`. This shouldn't impact any other projects you may work on that use an earlier version of gulp in it's setup.

If you have a previous version of `gulp` installed globally, you'll need to remove it before installing `gulp-cli`. You can check if this is installed by running `gulp -v` and seeing the version that's listed in the `CLI` field of the output. If you have the `gulp` package installd globally, it's likely the same version that you'll see in the `Local` field. If you already have `gulp-cli` installed, it should be a lower major version (it's at version `2.0.1` at the time of the transition).
If you have a previous version of `gulp` installed globally, you'll need to remove it before installing `gulp-cli`. You can check if this is installed by running `gulp -v` and seeing the version that's listed in the `CLI` field of the output. If you have the `gulp` package installed globally, it's likely the same version that you'll see in the `Local` field. If you already have `gulp-cli` installed, it should be a lower major version (it's at version `2.0.1` at the time of the transition).

To remove the old package, you can use the command: `npm rm gulp -g`

Expand Down Expand Up @@ -207,10 +207,20 @@ gulp test-coverage
gulp view-coverage
```

For end-to-end testing, edit the example file `./integrationExamples/gpt/pbjs_example_gpt.html`:
For Prebid.org members with access to BrowserStack, additional end-to-end testing can be done with:

1. Change `{id}` values appropriately to set up ad units and bidders
2. Set the path to Prebid.js in your example file as shown below (see `pbs.src`).
```bash
gulp e2e-test --host=test.localhost
```

To run these tests, the following items are required:
- setup an alias of localhost in your `hosts` file (eg `127.0.0.1 test.localhost`); note - you can use any alias. Use this alias in the command-line argument above.
- access to [BrowserStack](https://www.browserstack.com/) account. Assign the following variables in your bash_profile:
```bash
export BROWSERSTACK_USERNAME='YourUserNameHere'
export BROWSERSTACK_ACCESS_KEY='YourAccessKeyHere'
```
You can get these BrowserStack values from your profile page.

For development:

Expand Down
40 changes: 24 additions & 16 deletions browsers.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"bs_ie_14_windows_10": {
"bs_edge_16_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "edge",
"browser_version": "14.0",
"browser_version": "16.0",
"device": null,
"os": "Windows"
},
"bs_edge_17_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "edge",
"browser_version": "17.0",
"device": null,
"os": "Windows"
},
Expand All @@ -15,51 +23,51 @@
"device": null,
"os": "Windows"
},
"bs_chrome_62_windows_10": {
"bs_chrome_72_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "chrome",
"browser_version": "62.0",
"browser_version": "72.0",
"device": null,
"os": "Windows"
},
"bs_chrome_61_windows_10": {
"bs_chrome_71_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "chrome",
"browser_version": "61.0",
"browser_version": "71.0",
"device": null,
"os": "Windows"
},
"bs_firefox_58_windows_10": {
"bs_firefox_65_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "firefox",
"browser_version": "58.0",
"browser_version": "65.0",
"device": null,
"os": "Windows"
},
"bs_firefox_57_windows_10": {
"bs_firefox_64_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "firefox",
"browser_version": "57.0",
"browser_version": "64.0",
"device": null,
"os": "Windows"
},
"bs_safari_9.1_mac_elcapitan": {
"bs_safari_11_mac_high_sierra": {
"base": "BrowserStack",
"os_version": "El Capitan",
"os_version": "High Sierra",
"browser": "safari",
"browser_version": "9.1",
"browser_version": "11.1",
"device": null,
"os": "OS X"
},
"bs_safari_8_mac_yosemite": {
"bs_safari_12_mac_mojave": {
"base": "BrowserStack",
"os_version": "Yosemite",
"os_version": "Mojave",
"browser": "safari",
"browser_version": "8.0",
"browser_version": "12.0",
"device": null,
"os": "OS X"
}
Expand Down
78 changes: 9 additions & 69 deletions gulpHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const fs = require('fs.extra');
const path = require('path');
const argv = require('yargs').argv;
const MANIFEST = 'package.json';
const exec = require('child_process').exec;
const through = require('through2');
const _ = require('lodash');
const gutil = require('gulp-util');
Expand All @@ -13,7 +12,6 @@ const BUILD_PATH = './build/dist';
const DEV_PATH = './build/dev';
const ANALYTICS_PATH = '../analytics';


// get only subdirectories that contain package.json with 'main' property
function isModuleDirectory(filePath) {
try {
Expand All @@ -22,8 +20,7 @@ function isModuleDirectory(filePath) {
const module = require(manifestPath);
return module && module.main;
}
}
catch (error) {}
} catch (error) {}
}

module.exports = {
Expand All @@ -38,8 +35,8 @@ module.exports = {
jsonifyHTML: function (str) {
console.log(arguments);
return str.replace(/\n/g, '')
.replace(/<\//g, '<\\/')
.replace(/\/>/g, '\\/>');
.replace(/<\//g, '<\\/')
.replace(/\/>/g, '\\/>');
},
getArgModules() {
var modules = (argv.modules || '').split(',').filter(module => !!module);
Expand All @@ -52,7 +49,7 @@ module.exports = {
fs.readFileSync(moduleFile, 'utf8')
);
}
} catch(e) {
} catch (e) {
throw new gutil.PluginError({
plugin: 'modules',
message: 'failed reading: ' + argv.modules
Expand All @@ -72,19 +69,19 @@ module.exports = {
var moduleName = file.split(new RegExp('[.\\' + path.sep + ']'))[0];
var modulePath = path.join(absoluteModulePath, file);
if (fs.lstatSync(modulePath).isDirectory()) {
modulePath = path.join(modulePath, "index.js")
modulePath = path.join(modulePath, 'index.js')
}
memo[modulePath] = moduleName;
return memo;
}, {});
} catch(err) {
} catch (err) {
internalModules = {};
}
return Object.assign(externalModules.reduce((memo, module) => {
try {
var modulePath = require.resolve(module);
memo[modulePath] = module;
} catch(err) {
} catch (err) {
// do something
}
return memo;
Expand All @@ -93,7 +90,7 @@ module.exports = {

getBuiltModules: function(dev, externalModules) {
var modules = this.getModuleNames(externalModules);
if(Array.isArray(externalModules)) {
if (Array.isArray(externalModules)) {
modules = _.intersection(modules, externalModules);
}
return modules.map(name => path.join(__dirname, dev ? DEV_PATH : BUILD_PATH, name + '.js'));
Expand Down Expand Up @@ -128,7 +125,7 @@ module.exports = {
* Returns an array of source files for inclusion in build process
*/
getAnalyticsSources: function() {
if (!argv.analytics) {return [];} // empty arrays won't affect a standard build
if (!argv.analytics) { return []; } // empty arrays won't affect a standard build

const directoryContents = fs.readdirSync(ANALYTICS_PATH);
return directoryContents
Expand All @@ -155,62 +152,5 @@ module.exports = {
}

return options;
},

createEnd2EndTestReport : function(targetDestinationDir) {
var browsers = require('./browsers.json');
var env = [];
var input = 'bs';
for(var key in browsers) {
if(key.substring(0, input.length) === input && browsers[key].browser !== 'iphone') {
env.push(key);
}
}

//create new directory structure
fs.rmrfSync(targetDestinationDir);
env.forEach(item => {
fs.mkdirpSync(targetDestinationDir + '/' + item);
});

//move xml files to newly created directory
var walker = fs.walk('./build/coverage/e2e/reports');
walker.on("file", function (root, stat, next) {
env.forEach(item => {
if(stat.name.search(item) !== -1) {
var src = root + '/' + stat.name;
var dest = targetDestinationDir + '/' + item + '/' + stat.name;
fs.copy(src, dest, {replace: true}, function(err) {
if(err) {
throw err;
}
});
}
});
next();
});

//run junit-viewer to read xml and create html
env.forEach(item => {
//junit-viewer --results="./custom-reports/chrome51" --save="./chrome.html"
var cmd = 'junit-viewer --results="' + targetDestinationDir + '/' + item + '" --save="' + targetDestinationDir + '/' + item +'.html"';
exec(cmd);
});

//create e2e-results.html
var html = '<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>End to End Testing Result</title><link rel="stylesheet" href="//code.jquery.com/ui/1.12.0/themes/base/jquery-ui.css"><script src="https://code.jquery.com/jquery-1.12.4.js"></script><script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script><script>$( function() {$( "#tabs" ).tabs({heightStyle: "fill"});});</script></head><body><div style="font-weight: bold;">Note: Refresh in 2-3 seconds if it says "Cannot get ....."</div><div id="tabs" style="height:2000px;">';
var li = '';
var tabs = '';
env.forEach(function(item,i) {
i++;
li = li + '<li><a href="#tabs-'+i+'">'+item+'</a></li>';
tabs = tabs + '<div id="tabs-'+i+'"><iframe name="'+item+'" src="/' + targetDestinationDir.slice(2) + '/'+item+'.html" frameborder="0" style="overflow:hidden;overflow-x:hidden;overflow-y:hidden;height:100%;width:100%;top:50px;left:0px;right:0px;bottom:0px" height="100%" width="100%"></iframe></div>';
});
html = html + '<ul>' + li + '</ul>' + tabs;
html = html + '</div></body></html>';

var filepath = targetDestinationDir + '/results.html';
fs.openSync(filepath, 'w+');
fs.writeFileSync(filepath, html);
}
};
Loading

0 comments on commit d5d4752

Please sign in to comment.