From 2d14b7d53337c47b2e804f184927ed498990cc8f Mon Sep 17 00:00:00 2001 From: olafbuitelaar Date: Tue, 12 Apr 2022 19:07:44 +0200 Subject: [PATCH 001/319] Prebid Core: add documentResolver callback and allow the user to supply a different document object to render (#8262) * * allow Render to have a use resolvable document context * cache url's per resolvable context * pass options as config to Renderer * pass renderDocument to render * utility function to resolve the containing window object of a document * * prefer mediaTypes.video.renderer.options over renderer.options * support user-provided renderer context * handle when there is no div[id^='google_ads'] element * confics * kick off circleci tests * remove debugger * * changed context to doc * use WeakMap for caching of url's and documents * flipped key order of url cache * added unit test * * added adLoader double document cache test * * ensure call's are uneven * marked doc parameter optional * * change var to const * drop IE support Co-authored-by: Chris Huie --- modules/appnexusBidAdapter.js | 23 +++++++++----- src/Renderer.js | 15 ++++++++-- src/adloader.js | 56 ++++++++++++++++++++++++----------- src/auction.js | 3 +- src/prebid.js | 2 +- src/utils.js | 9 ++++++ test/spec/adloader_spec.js | 30 +++++++++++++++++++ test/spec/renderer_spec.js | 17 ++++++++++- 8 files changed, 125 insertions(+), 30 deletions(-) diff --git a/modules/appnexusBidAdapter.js b/modules/appnexusBidAdapter.js index 597c496a133..41fad3caba3 100644 --- a/modules/appnexusBidAdapter.js +++ b/modules/appnexusBidAdapter.js @@ -21,7 +21,8 @@ import { logInfo, logMessage, logWarn, - transformBidderParamKeywords + transformBidderParamKeywords, + getWindowFromDocument } from '../src/utils.js'; import {Renderer} from '../src/Renderer.js'; import {config} from '../src/config.js'; @@ -703,7 +704,10 @@ function newBid(serverBid, rtbBid, bidderRequest) { if (rtbBid.renderer_url) { const videoBid = find(bidderRequest.bids, bid => bid.bidId === serverBid.uuid); - const rendererOptions = deepAccess(videoBid, 'renderer.options'); + let rendererOptions = deepAccess(videoBid, 'mediaTypes.video.renderer.options'); // mediaType definition has preference (shouldn't options be .config?) + if (!rendererOptions) { + rendererOptions = deepAccess(videoBid, 'renderer.options'); // second the adUnit definition has preference (shouldn't options be .config?) + } bid.renderer = newRenderer(bid.adUnitCode, rtbBid, rendererOptions); } break; @@ -1131,9 +1135,13 @@ function buildNativeRequest(params) { * @param {string} elementId element id */ function hidedfpContainer(elementId) { - var el = document.getElementById(elementId).querySelectorAll("div[id^='google_ads']"); - if (el[0]) { - el[0].style.setProperty('display', 'none'); + try { + const el = document.getElementById(elementId).querySelectorAll("div[id^='google_ads']"); + if (el[0]) { + el[0].style.setProperty('display', 'none'); + } + } catch (e) { + // element not found! } } @@ -1149,12 +1157,13 @@ function hideSASIframe(elementId) { } } -function outstreamRender(bid) { +function outstreamRender(bid, doc) { hidedfpContainer(bid.adUnitCode); hideSASIframe(bid.adUnitCode); // push to render queue because ANOutstreamVideo may not be loaded yet bid.renderer.push(() => { - window.ANOutstreamVideo.renderAd({ + const win = getWindowFromDocument(doc) || window; + win.ANOutstreamVideo.renderAd({ tagId: bid.adResponse.tag_id, sizes: [bid.getSize().split('x')], targetId: bid.adUnitCode, // target div id to render video diff --git a/src/Renderer.js b/src/Renderer.js index 830b979723c..f26a5a377c0 100644 --- a/src/Renderer.js +++ b/src/Renderer.js @@ -53,7 +53,7 @@ export function Renderer(options) { if (!isRendererPreferredFromAdUnit(adUnitCode)) { // we expect to load a renderer url once only so cache the request to load script this.cmd.unshift(runRender) // should render run first ? - loadExternalScript(url, moduleCode, this.callback); + loadExternalScript(url, moduleCode, this.callback, this.documentContext); } else { logWarn(`External Js not loaded by Renderer since renderer url and callback is already defined on adUnit ${adUnitCode}`); runRender() @@ -112,9 +112,18 @@ export function isRendererRequired(renderer) { * Render the bid returned by the adapter * @param {Object} renderer Renderer object installed by adapter * @param {Object} bid Bid response + * @param {Document} doc context document of bid */ -export function executeRenderer(renderer, bid) { - renderer.render(bid); +export function executeRenderer(renderer, bid, doc) { + let docContext = null; + if (renderer.config && renderer.config.documentResolver) { + docContext = renderer.config.documentResolver(bid, document, doc);// a user provided callback, which should return a Document, and expect the parameters; bid, sourceDocument, renderDocument + } + if (!docContext) { + docContext = document; + } + renderer.documentContext = docContext; + renderer.render(bid, renderer.documentContext); } function isRendererPreferredFromAdUnit(adUnitCode) { diff --git a/src/adloader.js b/src/adloader.js index 563fe039b2f..db128c6d7ba 100644 --- a/src/adloader.js +++ b/src/adloader.js @@ -1,7 +1,7 @@ import {includes} from './polyfill.js'; import { logError, logWarn, insertElement } from './utils.js'; -const _requestCache = {}; +const _requestCache = new WeakMap(); // The below list contains modules or vendors whom Prebid allows to load external JS. const _approvedLoadExternalJSList = [ 'adloox', @@ -18,9 +18,10 @@ const _approvedLoadExternalJSList = [ * Each unique URL will be loaded at most 1 time. * @param {string} url the url to load * @param {string} moduleCode bidderCode or module code of the module requesting this resource - * @param {function} [callback] callback function to be called after the script is loaded. + * @param {function} [callback] callback function to be called after the script is loaded + * @param {Document} [doc] the context document, in which the script will be loaded, defaults to loaded document */ -export function loadExternalScript(url, moduleCode, callback) { +export function loadExternalScript(url, moduleCode, callback, doc) { if (!moduleCode || !url) { logError('cannot load external script without url and moduleCode'); return; @@ -29,46 +30,60 @@ export function loadExternalScript(url, moduleCode, callback) { logError(`${moduleCode} not whitelisted for loading external JavaScript`); return; } + if (!doc) { + doc = document; // provide a "valid" key for the WeakMap + } // only load each asset once - if (_requestCache[url]) { + const storedCachedObject = getCacheObject(doc, url); + if (storedCachedObject) { if (callback && typeof callback === 'function') { - if (_requestCache[url].loaded) { + if (storedCachedObject.loaded) { // invokeCallbacks immediately callback(); } else { // queue the callback - _requestCache[url].callbacks.push(callback); + storedCachedObject.callbacks.push(callback); } } - return _requestCache[url].tag; + return storedCachedObject.tag; } - _requestCache[url] = { + const cachedDocObj = _requestCache.get(doc) || {}; + const cacheObject = { loaded: false, tag: null, callbacks: [] }; + cachedDocObj[url] = cacheObject; + _requestCache.set(doc, cachedDocObj); + if (callback && typeof callback === 'function') { - _requestCache[url].callbacks.push(callback); + cacheObject.callbacks.push(callback); } logWarn(`module ${moduleCode} is loading external JavaScript`); return requestResource(url, function () { - _requestCache[url].loaded = true; + cacheObject.loaded = true; try { - for (let i = 0; i < _requestCache[url].callbacks.length; i++) { - _requestCache[url].callbacks[i](); + for (let i = 0; i < cacheObject.callbacks.length; i++) { + cacheObject.callbacks[i](); } } catch (e) { logError('Error executing callback', 'adloader.js:loadExternalScript', e); } - }); + }, doc); - function requestResource(tagSrc, callback) { - var jptScript = document.createElement('script'); + function requestResource(tagSrc, callback, doc) { + if (!doc) { + doc = document; + } + var jptScript = doc.createElement('script'); jptScript.type = 'text/javascript'; jptScript.async = true; - _requestCache[url].tag = jptScript; + const cacheObject = getCacheObject(doc, url); + if (cacheObject) { + cacheObject.tag = jptScript; + } if (jptScript.readyState) { jptScript.onreadystatechange = function () { @@ -86,8 +101,15 @@ export function loadExternalScript(url, moduleCode, callback) { jptScript.src = tagSrc; // add the new script tag to the page - insertElement(jptScript); + insertElement(jptScript, doc); return jptScript; } + function getCacheObject(doc, url) { + const cachedDocObj = _requestCache.get(doc); + if (cachedDocObj && cachedDocObj[url]) { + return cachedDocObj[url]; + } + return null; // return new cache object? + } }; diff --git a/src/auction.js b/src/auction.js index 7a1b92b3c31..ae5c3c6156b 100644 --- a/src/auction.js +++ b/src/auction.js @@ -572,7 +572,8 @@ function getPreparedBidForAuction({adUnitCode, bid, auctionId}, {index = auction } if (renderer) { - bidObject.renderer = Renderer.install({ url: renderer.url }); + // be aware, an adapter could already have installed the bidder, in which case this overwrite's the existing adapter + bidObject.renderer = Renderer.install({ url: renderer.url, config: renderer.options });// rename options to config, to make it consistent? bidObject.renderer.setRender(renderer.render); } diff --git a/src/prebid.js b/src/prebid.js index d3f5ec989f3..98655825e89 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -486,7 +486,7 @@ $$PREBID_GLOBAL$$.renderAd = hook('async', function (doc, id, options) { insertElement(creativeComment, doc, 'html'); if (isRendererRequired(renderer)) { - executeRenderer(renderer, bid); + executeRenderer(renderer, bid, doc); reinjectNodeIfRemoved(creativeComment, doc, 'html'); emitAdRenderSucceeded({ doc, bid, id }); } else if ((doc === document && !inIframe()) || mediaType === 'video') { diff --git a/src/utils.js b/src/utils.js index 1d91a4a35cf..33755a4fb82 100644 --- a/src/utils.js +++ b/src/utils.js @@ -1355,3 +1355,12 @@ export function cyrb53Hash(str, seed = 0) { h2 = imul(h2 ^ (h2 >>> 16), 2246822507) ^ imul(h1 ^ (h1 >>> 13), 3266489909); return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString(); } + +/** + * returns a window object, which holds the provided document or null + * @param {Document} doc + * @returns {Window} + */ +export function getWindowFromDocument(doc) { + return (doc) ? doc.defaultView : null; +} diff --git a/test/spec/adloader_spec.js b/test/spec/adloader_spec.js index 0c46cd2f171..0c50e66c63c 100644 --- a/test/spec/adloader_spec.js +++ b/test/spec/adloader_spec.js @@ -38,5 +38,35 @@ describe('adLoader', function () { adLoader.loadExternalScript('someURL1', 'criteo', callback); expect(utilsinsertElementStub.called).to.be.true; }); + + it('requires a url to be included once per document', function () { + function getDocSpec() { + return { + createElement: function() { + return { + + } + }, + getElementsByTagName: function() { + return { + firstChild: { + insertBefore: function() { + + } + } + } + } + + } + } + const doc1 = getDocSpec(); + const doc2 = getDocSpec(); + adLoader.loadExternalScript('someURL', 'criteo', () => {}, doc1); + adLoader.loadExternalScript('someURL', 'criteo', () => {}, doc1); + adLoader.loadExternalScript('someURL', 'criteo', () => {}, doc1); + adLoader.loadExternalScript('someURL', 'criteo', () => {}, doc2); + adLoader.loadExternalScript('someURL', 'criteo', () => {}, doc2); + expect(utilsinsertElementStub.callCount).to.equal(2); + }); }); }); diff --git a/test/spec/renderer_spec.js b/test/spec/renderer_spec.js index 50e21d2cb36..6de06606136 100644 --- a/test/spec/renderer_spec.js +++ b/test/spec/renderer_spec.js @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { Renderer } from 'src/Renderer.js'; +import { Renderer, executeRenderer } from 'src/Renderer.js'; import * as utils from 'src/utils.js'; import { loadExternalScript } from 'src/adloader.js'; require('test/mocks/adloaderStub.js'); @@ -212,5 +212,20 @@ describe('Renderer', function () { testRenderer.render() expect(loadExternalScript.called).to.be.true; }); + + it('call\'s documentResolver when configured', function () { + const documentResolver = sinon.spy(function(bid, sDoc, tDoc) { + return document; + }); + + let testRenderer = Renderer.install({ + url: 'https://httpbin.org/post', + config: { documentResolver: documentResolver } + }); + + executeRenderer(testRenderer, {}, {}); + + expect(documentResolver.called).to.be.true; + }); }); }); From 60cfe791f63fc3d554c6ef12c891b13cf7f1ae2f Mon Sep 17 00:00:00 2001 From: Demetrio Girardi Date: Tue, 12 Apr 2022 23:09:39 -0700 Subject: [PATCH 002/319] Build system: fix basic e2e tests (#8207) * Fix basic e2e tests * Fix lint * FTrackIdSystem & IDWardRtdProvider: fix calls to `getStorageManager` * Do not fetch currency file in currency e2e test; add option for running them without minification * Fix compilation warning * Better bundle generation for integ tests --- .circleci/config.yml | 11 +- gulpfile.js | 123 ++- modules/currency.js | 2 + modules/debugging/pbsInterceptor.js | 2 +- package-lock.json | 752 +++++++++++++++++- package.json | 3 +- test/fake-server/bundle.js | 41 + test/fake-server/fake-responder.js | 23 +- .../fixtures/basic-banner/request.json | 2 +- .../fixtures/basic-outstream/request.json | 6 +- test/fake-server/index.js | 9 +- test/helpers/testing-utils.js | 42 +- test/pages/banner.html | 2 +- test/pages/bidderSettings.html | 4 +- test/pages/consent_mgt_gdpr.html | 5 +- test/pages/currency.html | 4 +- test/pages/instream.html | 9 +- test/pages/multiple_bidders.html | 4 +- test/pages/native.html | 2 +- test/pages/outstream.html | 2 +- test/pages/priceGranularity.html | 133 ---- test/pages/sizeConfig.html | 144 ---- test/pages/userSync.html | 123 --- test/spec/e2e/banner/basic_banner_ad.spec.js | 31 +- .../instream/basic_instream_video_ad.spec.js | 27 +- .../e2e/modules/e2e_bidderSettings.spec.js | 46 +- .../e2e/modules/e2e_consent_mgt_gdpr.spec.js | 9 +- test/spec/e2e/modules/e2e_currency.spec.js | 55 +- .../e2e/modules/e2e_priceGranularity.spec.js | 61 -- test/spec/e2e/modules/e2e_sizeConfig.spec.js | 61 -- test/spec/e2e/modules/e2e_userSync.spec.js | 61 -- .../multi-bidder/e2e_multiple_bidders.spec.js | 46 +- test/spec/e2e/native/basic_native_ad.spec.js | 40 +- .../basic_outstream_video_ad.spec.js | 31 +- wdio.conf.js | 51 +- 35 files changed, 998 insertions(+), 969 deletions(-) create mode 100644 test/fake-server/bundle.js delete mode 100644 test/pages/priceGranularity.html delete mode 100644 test/pages/sizeConfig.html delete mode 100644 test/pages/userSync.html delete mode 100644 test/spec/e2e/modules/e2e_priceGranularity.spec.js delete mode 100644 test/spec/e2e/modules/e2e_sizeConfig.spec.js delete mode 100644 test/spec/e2e/modules/e2e_userSync.spec.js diff --git a/.circleci/config.yml b/.circleci/config.yml index 784b520ecc1..2eb1f4238cc 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ aliases: - &run_endtoend_test name: BrowserStack End to end testing - command: echo "127.0.0.1 test.localhost" | sudo tee -a /etc/hosts && gulp e2e-test --host=test.localhost + command: gulp e2e-test # Download and run BrowserStack local - &setup_browserstack @@ -82,15 +82,6 @@ workflows: commit: jobs: - build - nightly: - triggers: - - schedule: - cron: "0 0 * * *" - filters: - branches: - only: - - master - jobs: - e2etest experimental: diff --git a/gulpfile.js b/gulpfile.js index 0c4ebc50653..ff49436384b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -32,8 +32,8 @@ 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; -const FAKE_SERVER_HOST = argv.host ? argv.host : 'localhost'; -const FAKE_SERVER_PORT = 4444; +const INTEG_SERVER_HOST = argv.host ? argv.host : 'localhost'; +const INTEG_SERVER_PORT = 4444; const { spawn } = require('child_process'); // these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules @@ -167,9 +167,9 @@ function gulpBundle(dev) { return bundle(dev).pipe(gulp.dest('build/' + (dev ? 'dev' : 'dist'))); } -function nodeBundle(modules) { +function nodeBundle(modules, dev = false) { return new Promise((resolve, reject) => { - bundle(false, modules) + bundle(dev, modules) .on('error', (err) => { reject(err); }) @@ -243,41 +243,18 @@ function testTaskMaker(options = {}) { if (options.notest) { done(); } else if (options.e2e) { - let wdioCmd = path.join(__dirname, 'node_modules/.bin/wdio'); - let wdioConf = path.join(__dirname, 'wdio.conf.js'); - let wdioOpts; - - if (options.file) { - wdioOpts = [ - wdioConf, - `--spec`, - `${options.file}` - ] - } else { - wdioOpts = [ - wdioConf - ]; - } - - // run fake-server - const fakeServer = spawn('node', ['./test/fake-server/index.js', `--port=${FAKE_SERVER_PORT}`]); - fakeServer.stdout.on('data', (data) => { - console.log(`stdout: ${data}`); - }); - fakeServer.stderr.on('data', (data) => { - console.log(`stderr: ${data}`); - }); - - execa(wdioCmd, wdioOpts, { stdio: 'inherit' }) + const integ = startIntegServer(); + startLocalServer(); + runWebdriver(options) .then(stdout => { // kill fake server - fakeServer.kill('SIGINT'); + integ.kill('SIGINT'); done(); process.exit(0); }) .catch(err => { // kill fake server - fakeServer.kill('SIGINT'); + integ.kill('SIGINT'); done(new Error(`Tests failed with error: ${err}`)); process.exit(1); }); @@ -296,6 +273,26 @@ function testTaskMaker(options = {}) { const test = testTaskMaker(); +function runWebdriver({file}) { + process.env.TEST_SERVER_HOST = argv.host || 'localhost'; + let wdioCmd = path.join(__dirname, 'node_modules/.bin/wdio'); + let wdioConf = path.join(__dirname, 'wdio.conf.js'); + let wdioOpts; + + if (file) { + wdioOpts = [ + wdioConf, + `--spec`, + `${file}` + ] + } else { + wdioOpts = [ + wdioConf + ]; + } + return execa(wdioCmd, wdioOpts, { stdio: 'inherit' }); +} + function newKarmaCallback(done) { return function (exitCode) { if (exitCode) { @@ -335,41 +332,29 @@ function buildPostbid() { .pipe(gulp.dest('build/postbid/')); } -function setupE2e(done) { - if (!argv.host) { - throw new gutil.PluginError({ - plugin: 'E2E test', - message: gutil.colors.red('Host should be defined e.g. ap.localhost, anlocalhost. localhost cannot be used as safari browserstack is not able to connect to localhost') - }); +function startIntegServer(dev = false) { + const args = ['./test/fake-server/index.js', `--port=${INTEG_SERVER_PORT}`, `--host=${INTEG_SERVER_HOST}`]; + if (dev) { + args.push('--dev=true') } - process.env.TEST_SERVER_HOST = argv.host; - if (argv.https) { - process.env.TEST_SERVER_PROTOCOL = argv.https; - } - argv.e2e = true; - done(); -} - -function injectFakeServerEndpoint() { - return gulp.src(['build/dist/*.js']) - .pipe(replace('https://ib.adnxs.com/ut/v3/prebid', `http://${FAKE_SERVER_HOST}:${FAKE_SERVER_PORT}`)) - .pipe(gulp.dest('build/dist')); -} - -function injectFakeServerEndpointDev() { - return gulp.src(['build/dev/*.js']) - .pipe(replace('https://ib.adnxs.com/ut/v3/prebid', `http://${FAKE_SERVER_HOST}:${FAKE_SERVER_PORT}`)) - .pipe(gulp.dest('build/dev')); -} - -function startFakeServer() { - const fakeServer = spawn('node', ['./test/fake-server/index.js', `--port=${FAKE_SERVER_PORT}`]); - fakeServer.stdout.on('data', (data) => { + const srv = spawn('node', args); + srv.stdout.on('data', (data) => { console.log(`stdout: ${data}`); }); - fakeServer.stderr.on('data', (data) => { + srv.stderr.on('data', (data) => { console.log(`stderr: ${data}`); }); + return srv; +} + +function startLocalServer(options = {}) { + connect.server({ + https: argv.https, + port: port, + host: INTEG_SERVER_HOST, + root: './', + livereload: options.livereload + }); } // Watch Task with Live Reload @@ -385,13 +370,7 @@ function watchTaskMaker(options = {}) { 'modules/**/*.js', ].concat(options.alsoWatch)); - connect.server({ - https: argv.https, - port: port, - host: FAKE_SERVER_HOST, - root: './', - livereload: options.livereload - }); + startLocalServer(options); mainWatcher.on('all', options.task()); done(); @@ -427,11 +406,13 @@ gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid)); gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test))); gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast))); gulp.task('serve-and-test', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast, testTaskMaker({watch: true})))); -gulp.task('serve-fake', gulp.series(clean, gulp.parallel('build-bundle-dev', watch), injectFakeServerEndpointDev, test, startFakeServer)); +gulp.task('serve-e2e', gulp.series(clean, 'build-bundle-prod', gulp.parallel(() => startIntegServer(), startLocalServer))) +gulp.task('serve-e2e-dev', gulp.series(clean, 'build-bundle-dev', gulp.parallel(() => startIntegServer(true), startLocalServer))) gulp.task('default', gulp.series(clean, 'build-bundle-prod')); -gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), injectFakeServerEndpoint, test)); +gulp.task('e2e-test-only', () => runWebdriver({file: argv.file})) +gulp.task('e2e-test', gulp.series(clean, 'build-bundle-prod', testTaskMaker({e2e: true}))); // 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/modules/currency.js b/modules/currency.js index a59a9880af1..7f88c4b0aeb 100644 --- a/modules/currency.js +++ b/modules/currency.js @@ -168,6 +168,8 @@ function initCurrency(url) { } } ); + } else { + ready.done(); } } diff --git a/modules/debugging/pbsInterceptor.js b/modules/debugging/pbsInterceptor.js index 5af2384cad9..c8de1ed9753 100644 --- a/modules/debugging/pbsInterceptor.js +++ b/modules/debugging/pbsInterceptor.js @@ -1,6 +1,6 @@ import {deepClone, delayExecution} from '../../src/utils.js'; import {createBid} from '../../src/bidfactory.js'; -import * as CONSTANTS from '../../src/constants.json'; +import {default as CONSTANTS} from '../../src/constants.json'; export function pbsBidInterceptor (next, interceptBids, s2sBidRequest, bidRequests, ajax, { onResponse, diff --git a/package-lock.json b/package-lock.json index e40addfc54d..3b6033d7cd2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,11 +31,12 @@ "@wdio/concise-reporter": "^7.5.2", "@wdio/local-runner": "^7.5.2", "@wdio/mocha-framework": "^7.5.2", - "@wdio/spec-reporter": "^7.5.2", + "@wdio/spec-reporter": "^7.19.0", "@wdio/sync": "^7.5.2", "ajv": "6.12.3", "assert": "^2.0.0", "babel-loader": "^8.0.5", + "babel-register": "^6.26.0", "body-parser": "^1.19.0", "chai": "^4.2.0", "coveralls": "^3.1.0", @@ -3277,14 +3278,14 @@ } }, "node_modules/@wdio/spec-reporter": { - "version": "7.16.14", - "resolved": "https://registry.npmjs.org/@wdio/spec-reporter/-/spec-reporter-7.16.14.tgz", - "integrity": "sha512-hpS2rLXo91lfrit5/pjDSbff2lqQe+k07/JPOJ48W+ZPSI+ib7rSldI4JFYU4YuKN1TnhkbhxRBMib3bF3Fs+Q==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@wdio/spec-reporter/-/spec-reporter-7.19.1.tgz", + "integrity": "sha512-qnZkn3VcyBPtcorUtpyCFE8v5ubyWmR7mFETXNzyriHyvjvk+NeFCWaFcIehpXYXiAmNpAwyfnZoIY6tkKQixQ==", "dev": true, "dependencies": { "@types/easy-table": "^0.0.33", - "@wdio/reporter": "7.16.14", - "@wdio/types": "7.16.14", + "@wdio/reporter": "7.19.1", + "@wdio/types": "7.19.1", "chalk": "^4.0.0", "easy-table": "^1.1.1", "pretty-ms": "^7.0.0" @@ -3296,6 +3297,58 @@ "@wdio/cli": "^7.0.0" } }, + "node_modules/@wdio/spec-reporter/node_modules/@wdio/reporter": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@wdio/reporter/-/reporter-7.19.1.tgz", + "integrity": "sha512-sWmBBV4dPCZkGk9Qq0m35T/vHGen0N10nH4osQcVP3IZJqpo2eLIH4w+X6EUbjZ2GdgOA2bLMMzb1bl9JqnGPg==", + "dev": true, + "dependencies": { + "@types/diff": "^5.0.0", + "@types/node": "^17.0.4", + "@types/object-inspect": "^1.8.0", + "@types/supports-color": "^8.1.0", + "@types/tmp": "^0.2.0", + "@wdio/types": "7.19.1", + "diff": "^5.0.0", + "fs-extra": "^10.0.0", + "object-inspect": "^1.10.3", + "supports-color": "8.1.1" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@wdio/spec-reporter/node_modules/@wdio/reporter/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/@wdio/spec-reporter/node_modules/@wdio/types": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.19.1.tgz", + "integrity": "sha512-mOodKlmvYxpj8P5BhjggEGpXuiRSlsyn2ClG8QqJ3lfXgOtOVEzFNfv/Ai7TkHr+lHDQNXLjllCjSqoCHhwlqg==", + "dev": true, + "dependencies": { + "@types/node": "^17.0.4", + "got": "^11.8.1" + }, + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "typescript": "^4.6.2" + } + }, "node_modules/@wdio/spec-reporter/node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -4291,6 +4344,113 @@ "node": ">=0.8.0" } }, + "node_modules/babel-core": { + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, + "dependencies": { + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.8", + "slash": "^1.0.0", + "source-map": "^0.5.7" + } + }, + "node_modules/babel-core/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/babel-core/node_modules/json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/babel-core/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/babel-core/node_modules/slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "dependencies": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + } + }, + "node_modules/babel-generator/node_modules/detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "dependencies": { + "repeating": "^2.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-generator/node_modules/jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "dependencies": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, "node_modules/babel-loader": { "version": "8.2.3", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.3.tgz", @@ -4336,6 +4496,15 @@ "node": ">=4.0.0" } }, + "node_modules/babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "dependencies": { + "babel-runtime": "^6.22.0" + } + }, "node_modules/babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -4392,6 +4561,50 @@ "babel-runtime": "^6.22.0" } }, + "node_modules/babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "dependencies": { + "babel-core": "^6.26.0", + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "home-or-tmp": "^2.0.0", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.15" + } + }, + "node_modules/babel-register/node_modules/core-js": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", + "deprecated": "core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.", + "dev": true, + "hasInstallScript": true + }, + "node_modules/babel-register/node_modules/mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "dependencies": { + "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" + } + }, + "node_modules/babel-register/node_modules/source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "dependencies": { + "source-map": "^0.5.6" + } + }, "node_modules/babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -4408,6 +4621,81 @@ "deprecated": "core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.", "hasInstallScript": true }, + "node_modules/babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "dependencies": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, + "node_modules/babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "dependencies": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" + } + }, + "node_modules/babel-traverse/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/babel-traverse/node_modules/globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/babel-traverse/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "dependencies": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + } + }, + "node_modules/babel-types/node_modules/to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/babelify": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/babelify/-/babelify-10.0.0.tgz", @@ -4420,6 +4708,15 @@ "@babel/core": "^7.0.0" } }, + "node_modules/babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true, + "bin": { + "babylon": "bin/babylon.js" + } + }, "node_modules/bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -5337,14 +5634,20 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001314", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001314.tgz", - "integrity": "sha512-0zaSO+TnCHtHJIbpLroX7nsD+vYuOVjl3uzFbJO1wMVbuveJA0RK2WcQA9ZUIOiO0/ArMiMgHJLxfEZhQiC0kw==", + "version": "1.0.30001320", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001320.tgz", + "integrity": "sha512-MWPzG54AGdo3nWx7zHZTefseM5Y1ccM7hlQKHRqJkPozUaw3hNbBTMmLn16GG2FUzjR13Cr3NPfhIieX5PzXDA==", "dev": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/browserslist" - } + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + } + ] }, "node_modules/caseless": { "version": "0.12.0", @@ -12765,6 +13068,19 @@ "node": "*" } }, + "node_modules/home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "dependencies": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -13094,6 +13410,15 @@ "node": ">= 0.10" } }, + "node_modules/invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "dependencies": { + "loose-envify": "^1.0.0" + } + }, "node_modules/invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", @@ -15579,6 +15904,18 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, "node_modules/loud-rejection": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", @@ -16637,9 +16974,9 @@ } }, "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "node_modules/minimist-options": { @@ -17735,6 +18072,15 @@ "readable-stream": "^2.0.1" } }, + "node_modules/os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/os-locale": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", @@ -18331,6 +18677,15 @@ "node": ">=0.8" } }, + "node_modules/private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -21501,6 +21856,15 @@ "node": ">=8" } }, + "node_modules/trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/trough": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", @@ -21616,6 +21980,20 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "node_modules/typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "node_modules/typescript-compare": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz", @@ -25688,19 +26066,58 @@ } }, "@wdio/spec-reporter": { - "version": "7.16.14", - "resolved": "https://registry.npmjs.org/@wdio/spec-reporter/-/spec-reporter-7.16.14.tgz", - "integrity": "sha512-hpS2rLXo91lfrit5/pjDSbff2lqQe+k07/JPOJ48W+ZPSI+ib7rSldI4JFYU4YuKN1TnhkbhxRBMib3bF3Fs+Q==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@wdio/spec-reporter/-/spec-reporter-7.19.1.tgz", + "integrity": "sha512-qnZkn3VcyBPtcorUtpyCFE8v5ubyWmR7mFETXNzyriHyvjvk+NeFCWaFcIehpXYXiAmNpAwyfnZoIY6tkKQixQ==", "dev": true, "requires": { "@types/easy-table": "^0.0.33", - "@wdio/reporter": "7.16.14", - "@wdio/types": "7.16.14", + "@wdio/reporter": "7.19.1", + "@wdio/types": "7.19.1", "chalk": "^4.0.0", "easy-table": "^1.1.1", "pretty-ms": "^7.0.0" }, "dependencies": { + "@wdio/reporter": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@wdio/reporter/-/reporter-7.19.1.tgz", + "integrity": "sha512-sWmBBV4dPCZkGk9Qq0m35T/vHGen0N10nH4osQcVP3IZJqpo2eLIH4w+X6EUbjZ2GdgOA2bLMMzb1bl9JqnGPg==", + "dev": true, + "requires": { + "@types/diff": "^5.0.0", + "@types/node": "^17.0.4", + "@types/object-inspect": "^1.8.0", + "@types/supports-color": "^8.1.0", + "@types/tmp": "^0.2.0", + "@wdio/types": "7.19.1", + "diff": "^5.0.0", + "fs-extra": "^10.0.0", + "object-inspect": "^1.10.3", + "supports-color": "8.1.1" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "@wdio/types": { + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@wdio/types/-/types-7.19.1.tgz", + "integrity": "sha512-mOodKlmvYxpj8P5BhjggEGpXuiRSlsyn2ClG8QqJ3lfXgOtOVEzFNfv/Ai7TkHr+lHDQNXLjllCjSqoCHhwlqg==", + "dev": true, + "requires": { + "@types/node": "^17.0.4", + "got": "^11.8.1" + } + }, "ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -26496,6 +26913,105 @@ } } }, + "babel-core": { + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", + "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-generator": "^6.26.0", + "babel-helpers": "^6.24.1", + "babel-messages": "^6.23.0", + "babel-register": "^6.26.0", + "babel-runtime": "^6.26.0", + "babel-template": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "convert-source-map": "^1.5.1", + "debug": "^2.6.9", + "json5": "^0.5.1", + "lodash": "^4.17.4", + "minimatch": "^3.0.4", + "path-is-absolute": "^1.0.1", + "private": "^0.1.8", + "slash": "^1.0.0", + "source-map": "^0.5.7" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + } + } + }, + "babel-generator": { + "version": "6.26.1", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", + "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", + "dev": true, + "requires": { + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "detect-indent": "^4.0.0", + "jsesc": "^1.3.0", + "lodash": "^4.17.4", + "source-map": "^0.5.7", + "trim-right": "^1.0.1" + }, + "dependencies": { + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true, + "requires": { + "repeating": "^2.0.0" + } + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + } + } + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0", + "babel-template": "^6.24.1" + } + }, "babel-loader": { "version": "8.2.3", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.3.tgz", @@ -26530,6 +27046,15 @@ } } }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true, + "requires": { + "babel-runtime": "^6.22.0" + } + }, "babel-plugin-dynamic-import-node": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", @@ -26577,6 +27102,47 @@ "babel-runtime": "^6.22.0" } }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true, + "requires": { + "babel-core": "^6.26.0", + "babel-runtime": "^6.26.0", + "core-js": "^2.5.0", + "home-or-tmp": "^2.0.0", + "lodash": "^4.17.4", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.15" + }, + "dependencies": { + "core-js": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", + "dev": true + }, + "mkdirp": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", + "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "dev": true, + "requires": { + "minimist": "^1.2.6" + } + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true, + "requires": { + "source-map": "^0.5.6" + } + } + } + }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -26593,6 +27159,79 @@ } } }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "babel-traverse": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "lodash": "^4.17.4" + } + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true, + "requires": { + "babel-code-frame": "^6.26.0", + "babel-messages": "^6.23.0", + "babel-runtime": "^6.26.0", + "babel-types": "^6.26.0", + "babylon": "^6.18.0", + "debug": "^2.6.8", + "globals": "^9.18.0", + "invariant": "^2.2.2", + "lodash": "^4.17.4" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true, + "requires": { + "babel-runtime": "^6.26.0", + "esutils": "^2.0.2", + "lodash": "^4.17.4", + "to-fast-properties": "^1.0.3" + }, + "dependencies": { + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + } + } + }, "babelify": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/babelify/-/babelify-10.0.0.tgz", @@ -26600,6 +27239,12 @@ "dev": true, "requires": {} }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, "bach": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/bach/-/bach-1.2.0.tgz", @@ -27323,9 +27968,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001314", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001314.tgz", - "integrity": "sha512-0zaSO+TnCHtHJIbpLroX7nsD+vYuOVjl3uzFbJO1wMVbuveJA0RK2WcQA9ZUIOiO0/ArMiMgHJLxfEZhQiC0kw==", + "version": "1.0.30001320", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001320.tgz", + "integrity": "sha512-MWPzG54AGdo3nWx7zHZTefseM5Y1ccM7hlQKHRqJkPozUaw3hNbBTMmLn16GG2FUzjR13Cr3NPfhIieX5PzXDA==", "dev": true }, "caseless": { @@ -33269,6 +33914,16 @@ "integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A==", "dev": true }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.1" + } + }, "homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -33517,6 +34172,15 @@ "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", "dev": true }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", @@ -35473,6 +36137,15 @@ "integrity": "sha512-vM6rUVCVUJJt33bnmHiZEvr7wPT78ztX7rojL+LW51bHtLh6HTjx84LA5W4+oa6aKEJA7jJu5LR6vQRBpA5DVg==", "dev": true }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, "loud-rejection": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", @@ -36279,9 +36952,9 @@ } }, "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", + "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, "minimist-options": { @@ -37161,6 +37834,12 @@ "readable-stream": "^2.0.1" } }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, "os-locale": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", @@ -37601,6 +38280,12 @@ "integrity": "sha512-GA3TdL8szPK4AQ2YnOe/b+Y1jUFwmmGMMK/qbY7VcE3Z7FU8JstbKiKRzO6CIiAKPhTO8m01NoQ0V5f3jc4OGg==", "dev": true }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -40163,6 +40848,12 @@ "integrity": "sha512-c1PTsA3tYrIsLGkJkzHF+w9F2EyxfXGo4UyJc4pFL++FMjnq0HJS69T3M7d//gKrFKwy429bouPescbjecU+Zw==", "dev": true }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, "trough": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.5.tgz", @@ -40255,6 +40946,13 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, + "typescript": { + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz", + "integrity": "sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==", + "dev": true, + "peer": true + }, "typescript-compare": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz", diff --git a/package.json b/package.json index 47bcc94404f..6fee70f2cbd 100644 --- a/package.json +++ b/package.json @@ -43,11 +43,12 @@ "@wdio/concise-reporter": "^7.5.2", "@wdio/local-runner": "^7.5.2", "@wdio/mocha-framework": "^7.5.2", - "@wdio/spec-reporter": "^7.5.2", + "@wdio/spec-reporter": "^7.19.0", "@wdio/sync": "^7.5.2", "ajv": "6.12.3", "assert": "^2.0.0", "babel-loader": "^8.0.5", + "babel-register": "^6.26.0", "body-parser": "^1.19.0", "chai": "^4.2.0", "coveralls": "^3.1.0", diff --git a/test/fake-server/bundle.js b/test/fake-server/bundle.js new file mode 100644 index 00000000000..b0430458083 --- /dev/null +++ b/test/fake-server/bundle.js @@ -0,0 +1,41 @@ +const fs = require('fs'); +const path = require('path'); +const makeBundle = require('../../gulpfile.js'); +const argv = require('yargs').argv; +const host = argv.host || 'localhost'; +const port = argv.port || 4444; +const dev = argv.dev || false; + +const REPLACE = { + 'https://ib.adnxs.com/ut/v3/prebid': `http://${host}:${port}/appnexus` +}; + +const replaceStrings = (() => { + const rules = Object.entries(REPLACE).map(([orig, repl]) => { + return [new RegExp(orig, 'g'), repl]; + }); + return function(text) { + return rules.reduce((text, [pat, repl]) => text.replace(pat, repl), text); + } +})(); + +const getBundle = (() => { + const cache = {}; + return function (modules = []) { + modules = Array.isArray(modules) ? [...modules] : [modules]; + modules.sort(); + const key = modules.join(','); + if (!cache.hasOwnProperty(key)) { + cache[key] = makeBundle(modules, dev).then(replaceStrings); + } + return cache[key]; + } +})(); + +module.exports = function (req, res, next) { + res.type('text/javascript'); + getBundle(req.query.modules).then((bundle) => { + res.write(bundle); + next(); + }).catch(next); +} diff --git a/test/fake-server/fake-responder.js b/test/fake-server/fake-responder.js index c884b00ca9c..a44d02260e7 100644 --- a/test/fake-server/fake-responder.js +++ b/test/fake-server/fake-responder.js @@ -6,9 +6,6 @@ const path = require('path'); // path to the fixture directory const fixturesPath = path.join(__dirname, 'fixtures'); -// An object storing 'Request-Response' pairs. -let REQ_RES_MAP = generateFixtures(fixturesPath); - /** * Matches 'req.body' with the responseBody pair * @param {object} requestBody - `req.body` of incoming request hitting middleware 'fakeResponder'. @@ -16,8 +13,8 @@ let REQ_RES_MAP = generateFixtures(fixturesPath); */ const matchResponse = function (requestBody) { let actualUuids = []; - - const requestResponsePairs = Object.keys(REQ_RES_MAP).map(testName => REQ_RES_MAP[testName]); + let reqResMap = generateFixtures(fixturesPath); + const requestResponsePairs = Object.keys(reqResMap).map(testName => reqResMap[testName]); // delete 'uuid' property requestBody.tags.forEach(body => { @@ -38,8 +35,22 @@ const matchResponse = function (requestBody) { requestResponsePairs .forEach(reqRes => { reqRes.request.httpRequest && reqRes.request.httpRequest.body.tags.forEach(body => body.uuid && delete body.uuid) }); + const match = requestResponsePairs.filter(reqRes => reqRes.request.httpRequest && deepEqual(reqRes.request.httpRequest.body.tags, requestBody.tags)); + + try { + if (match.length === 0) { + throw new Error('No mock response found'); + } else if (match.length > 1) { + throw new Error('More than one mock response found') + } + } catch (e) { + console.error(e); + console.error('Tags:', JSON.stringify(requestBody.tags, null, 2)); + throw e; + } + // match the 'actual' requestBody with the 'expected' requestBody and find the 'responseBody' - const responseBody = requestResponsePairs.filter(reqRes => reqRes.request.httpRequest && deepEqual(reqRes.request.httpRequest.body.tags, requestBody.tags))[0].response.httpResponse.body; + const responseBody = match[0].response.httpResponse.body; // ENABLE THE FOLLOWING CODE FOR TROUBLE-SHOOTING FAKED REQUESTS; COMMENT AGAIN WHEN DONE // console.log('value found for responseBody:', responseBody); diff --git a/test/fake-server/fixtures/basic-banner/request.json b/test/fake-server/fixtures/basic-banner/request.json index ea85b5a6842..6b355cd24c0 100644 --- a/test/fake-server/fixtures/basic-banner/request.json +++ b/test/fake-server/fixtures/basic-banner/request.json @@ -58,4 +58,4 @@ "user": {} } } -} \ No newline at end of file +} diff --git a/test/fake-server/fixtures/basic-outstream/request.json b/test/fake-server/fixtures/basic-outstream/request.json index 611a518fc2d..e9f3302ab4c 100644 --- a/test/fake-server/fixtures/basic-outstream/request.json +++ b/test/fake-server/fixtures/basic-outstream/request.json @@ -20,7 +20,7 @@ "disable_psa": true, "video": { "skippable": true, - "playback_method": ["auto_play_sound_off"] + "playback_method": 2 }, "hb_source": 1 }, { @@ -40,11 +40,11 @@ "disable_psa": true, "video": { "skippable": true, - "playback_method": ["auto_play_sound_off"] + "playback_method": 2 }, "hb_source": 1 }], "user": {} } } -} \ No newline at end of file +} diff --git a/test/fake-server/index.js b/test/fake-server/index.js index 752648c6746..e93bcfd465f 100644 --- a/test/fake-server/index.js +++ b/test/fake-server/index.js @@ -5,8 +5,9 @@ const morgan = require('morgan'); const bodyParser = require('body-parser'); const argv = require('yargs').argv; const fakeResponder = require('./fake-responder.js'); +const bundleMaker = require('./bundle.js'); -const PORT = argv.port || '3000'; +const PORT = argv.port || '4444'; // Initialize express app const app = express(); @@ -24,7 +25,11 @@ app.use(function(req, res, next) { next(); }); -app.post('/', fakeResponder, (req, res) => { +app.get('/bundle', bundleMaker, (req, res) => { + res.send(); +}); + +app.post('/appnexus', fakeResponder, (req, res) => { res.send(); }); diff --git a/test/helpers/testing-utils.js b/test/helpers/testing-utils.js index 76e2b652a79..81f22ca471d 100644 --- a/test/helpers/testing-utils.js +++ b/test/helpers/testing-utils.js @@ -1,13 +1,51 @@ /* eslint-disable no-console */ -module.exports = { +const {expect} = require('chai'); +const utils = { host: (process.env.TEST_SERVER_HOST) ? process.env.TEST_SERVER_HOST : 'localhost', protocol: (process.env.TEST_SERVER_PROTOCOL) ? 'https' : 'http', + testPageURL: function(name) { + return `${utils.protocol}://${utils.host}:9999/test/pages/${name}` + }, waitForElement: function(elementRef, time = 2000) { let element = $(elementRef); element.waitForExist({timeout: time}); }, - switchFrame: function(frameRef, frameName) { + switchFrame: function(frameRef) { let iframe = $(frameRef); browser.switchToFrame(iframe); + }, + loadAndWaitForElement(url, selector, pause = 3000, timeout = 2000, retries = 3, attempt = 1) { + browser.url(url); + browser.pause(pause); + if (selector != null) { + try { + utils.waitForElement(selector, timeout); + } catch (e) { + if (attempt < retries) { + utils.loadAndWaitForElement(url, selector, pause, timeout, retries, attempt + 1); + } + } + } + }, + setupTest({url, waitFor, expectGAMCreative = null, pause = 3000, timeout = 2000, retries = 3}, name, fn) { + describe(name, function () { + this.retries(retries); + before(() => utils.loadAndWaitForElement(url, waitFor, pause, timeout, retries)); + fn.call(this); + if (expectGAMCreative) { + expectGAMCreative = expectGAMCreative === true ? waitFor : expectGAMCreative; + it(`should render GAM creative`, () => { + utils.switchFrame(expectGAMCreative); + const creative = [ + '> a > img', // banner + '> div[class="card"]' // native + ].map((child) => `body > div[class="GoogleActiveViewElement"] ${child}`) + .join(', '); + expect($(creative).isExisting()).to.be.true; + }); + } + }); } } + +module.exports = utils; diff --git a/test/pages/banner.html b/test/pages/banner.html index 75993cefb39..2e88d356647 100644 --- a/test/pages/banner.html +++ b/test/pages/banner.html @@ -7,7 +7,7 @@ Prebid.js Banner Example - + diff --git a/test/pages/bidderSettings.html b/test/pages/bidderSettings.html index 015ad3ca45f..205fc250be1 100644 --- a/test/pages/bidderSettings.html +++ b/test/pages/bidderSettings.html @@ -1,7 +1,7 @@ - + + + - + - +