Skip to content

Commit

Permalink
E2e tests for Native and Outstream video Ad formats. (prebid#4116)
Browse files Browse the repository at this point in the history
* reorganize e2e/ tests into separate directories

* new test page for e2e-banner testing

* add test to check if Banner Ad is getting loaded

* change location of the spec files to reflect change in test/e2e directory structure

* add test case to check for generation of valid targeting keys

* create Native Ad test page

* add test case to check validity of the targeting keys and correct rendering of the Ad

* update old browser versions to new

* update browser version

* update title

* remove console.log statements

* add basic functional test for e2e outstream video ad format
  • Loading branch information
Fawke authored and EMXDigital committed Sep 18, 2019
1 parent c6e5550 commit 84f10a7
Show file tree
Hide file tree
Showing 6 changed files with 417 additions and 14 deletions.
26 changes: 13 additions & 13 deletions browsers.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"bs_edge_16_windows_10": {
"bs_edge_17_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "edge",
"browser_version": "16.0",
"browser_version": "17.0",
"device": null,
"os": "Windows"
},
"bs_edge_17_windows_10": {
"bs_edge_16_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "edge",
"browser_version": "17.0",
"browser_version": "16.0",
"device": null,
"os": "Windows"
},
Expand All @@ -23,35 +23,35 @@
"device": null,
"os": "Windows"
},
"bs_chrome_72_windows_10": {
"bs_chrome_74_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "chrome",
"browser_version": "72.0",
"browser_version": "74.0",
"device": null,
"os": "Windows"
},
"bs_chrome_71_windows_10": {
"bs_chrome_75_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "chrome",
"browser_version": "71.0",
"browser_version": "75.0",
"device": null,
"os": "Windows"
},
"bs_firefox_65_windows_10": {
"bs_firefox_66_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "firefox",
"browser_version": "65.0",
"browser_version": "66.0",
"device": null,
"os": "Windows"
},
"bs_firefox_64_windows_10": {
"bs_firefox_67_windows_10": {
"base": "BrowserStack",
"os_version": "10",
"browser": "firefox",
"browser_version": "64.0",
"browser_version": "67.0",
"device": null,
"os": "Windows"
},
Expand All @@ -71,4 +71,4 @@
"device": null,
"os": "OS X"
}
}
}
2 changes: 1 addition & 1 deletion test/pages/banner.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<head>
<meta charset="UTF-8">
<title>Prebid.js Banner Ad Unit Example</title>
<title>Prebid.js Banner Example</title>

<!-- Prebid.js -->
<script async src="../../build/dev/prebid.js"></script>
Expand Down
123 changes: 123 additions & 0 deletions test/pages/native.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<!-- This is a Test Page for Native End-to-End test -->
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Prebid.js Native Example</title>

<!-- Prebid.js -->
<script async src="../../build/dev/prebid.js"></script>

<!-- Google Publisher Tag -->
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>

<script>
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

// Prebid Native Ad Unit
const adUnits = [{
code: '/19968336/prebid_native_example_1',
sizes: [360, 360],
mediaTypes: {
native: {
title: {
required: true
},
image: {
required: true
},
sponsoredBy: {
required: true
}
}
},
bids: [{
bidder: 'appnexus',
params: {
placementId: 13232354,
allowSmallerSizes: true
}
}]
}, {
code: '/19968336/prebid_native_example_2',
sizes: [
[1, 1]
],
mediaTypes: {
native: {
title: {
required: true
},
body: {
required: true
},
image: {
required: true
},
sponsoredBy: {
required: true
},
icon: {
required: false
},
}
},
bids: [{
bidder: 'appnexus',
params: {
placementId: 13232354,
allowSmallerSizes: true
}
}]
}];
</script>

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];

googletag.cmd.push(() => {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(() => {
pbjs.addAdUnits(adUnits);
pbjs.requestBids({ bidsBackHandler: sendAdServerRequest });
});

function sendAdServerRequest() {
googletag.cmd.push(() => {
pbjs.que.push(() => {
pbjs.setTargetingForGPTAsync('/19968336/prebid_native_example_1');
googletag.pubads().refresh();
});
});
}
</script>

<script>
// GPT Setup
googletag.cmd.push(() => {
googletag
.defineSlot('/19968336/prebid_native_example_1', [360, 360], 'div-1')
.addService(googletag.pubads());

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

<body>
<h2>Prebid.js Native Ad Unit Test</h2>
<div id='div-1'>
<p>No response</p>
<script>
googletag.cmd.push(() => { googletag.display('div-1'); });
</script>
</div>
</body>

</html>
168 changes: 168 additions & 0 deletions test/pages/outstream.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<!-- Test page for outstream video test case -->
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<title>Prebid.js Video Outstream Example</title>

<!-- Load Prebid.js -->
<script async src="../../build/dev/prebid.js"></script>

<!-- Load Google Publisher Tag -->
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>

<script>
// Load the outstream video adunit.
const outstreamVideoAdUnit = [{
code: 'video_ad_unit_1',
mediaTypes: {
video: {
context: 'outstream',
playerSize: [640, 480]
}
},
bids: [{
bidder: 'appnexus',
params: {
placementId: 13232385,
video: {
skippable: true,
playback_method: ['auto_play_sound_off']
}
}
}]
}, {
code: 'video_ad_unit_2',
mediaTypes: {
video: {
context: 'outstream',
playerSize: [640, 480]
}
},
bids: [{
bidder: 'appnexus',
params: {
placementId: 13232385,
video: {
skippable: true,
playback_method: ['auto_play_sound_off']
}
}
}]
}];

// Load the pbjs global and Prebid event queue
var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];

// Load GPT global and GPT command queue
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];

pbjs.que.push(function () {
pbjs.setConfig({ debug: true });
pbjs.addAdUnits(outstreamVideoAdUnit);
pbjs.requestBids({ bidsBackHandler: initAdServer });
});

function initAdServer() {
googletag.cmd.push(function () {
pbjs.que.push(function () {
pbjs.setTargetingForGPTAsync('video_ad_unit_1');
googletag.pubads().refresh();
});
});
}

googletag.cmd.push(function () {
googletag
.defineSlot('/19968336/prebid_outstream_adunit_1', [[1, 1]], 'video_ad_unit_1')
.addService(googletag.pubads());
googletag.pubads().disableInitialLoad();
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>


<body>
<div style="width:50%;margin-left:auto;margin-right:auto">
<p>
In scelerisque sem sed tortor posuere sagittis. Fusce scelerisque odio at tincidunt ultricies. Fusce egestas, erat
non finibus dictum, nulla arcu viverra nibh, at bibendum ligula nisi egestas magna. Nulla eu finibus nulla.
Pellentesque at mi eget turpis
consequat scelerisque. Sed lacinia, nisi sit amet egestas vestibulum, elit odio iaculis leo, et lacinia risus enim
non lacus. Cras nec neque eget nunc gravida maximus. Ut hendrerit convallis sollicitudin. Donec cursus erat vel
metus gravida,
et pretium justo iaculis. Curabitur condimentum blandit augue, quis interdum leo. Vivamus dapibus est nec dui
efficitur, eu imperdiet nulla sollicitudin. Suspendisse laoreet velit vitae arcu mollis, ac interdum lorem
venenatis. Aenean
nec purus varius, accumsan ex at, luctus arcu. Quisque consectetur tortor eros, placerat lacinia eros aliquam a.
Proin non porttitor libero.
</p>
<p>
Proin eget vulputate est. Nunc sit amet neque a tortor ullamcorper suscipit non eu neque. Quisque at massa in
metus feugiat rutrum. Nulla et orci orci. Aliquam erat volutpat. Cras tincidunt metus lectus, sed suscipit augue
mollis vitae. Sed quis condimentum
tortor, sit amet consectetur erat. Nulla pellentesque turpis lacus, eu venenatis massa fringilla at. Duis sed
pharetra turpis. Maecenas vel porttitor neque. Praesent quis felis sapien. Donec suscipit euismod dui, vitae
fermentum nisi ornare
in.
</p>
<p>
Suspendisse tempor felis accumsan orci finibus, imperdiet mollis arcu imperdiet. In eu dolor condimentum, pulvinar
nisl a, sollicitudin nunc. Ut vel lectus libero. Praesent rhoncus leo tortor, at mollis nulla sagittis eget.
Quisque tempus tempor augue
sed rutrum. Sed vitae volutpat quam. Proin vestibulum eros metus, a luctus erat condimentum eu. Vivamus
ullamcorper ultricies dui, ac malesuada leo finibus semper. Cras diam augue, imperdiet sed efficitur id, aliquam
sed purus. Praesent
eget turpis quis sapien interdum sagittis. Vivamus placerat nunc a tempus fermentum. Praesent laoreet leo at
tellus porta, ut viverra tortor pharetra. Quisque elit velit, eleifend eget imperdiet vel, suscipit ac nisi.
Aliquam egestas mauris
ut massa fringilla laoreet.
</p>
<div id='video_ad_unit_1'>
<p>Prebid Outstream Video Ad</p>
<script>googletag.cmd.push(function () { googletag.display('video_ad_unit_1') })</script>
</div>
<p>
Quisque ac luctus nisi, vitae ornare arcu. Proin fermentum sapien vitae odio vestibulum porta. Suspendisse
faucibus sapien enim, et faucibus urna tempus et. Integer porttitor justo sed faucibus blandit. Morbi semper
lectus vitae semper facilisis. Quisque
molestie accumsan arcu, eget bibendum dui euismod et. Sed in mattis lacus, nec lacinia sem. Fusce sed tortor
posuere, iaculis justo varius, elementum est.
</p>
<p>
Etiam condimentum, eros commodo semper tristique, lorem leo pharetra massa, eget cursus justo enim id urna. Sed
imperdiet mauris vitae ante bibendum elementum. Etiam eu dui porttitor leo imperdiet cursus. Maecenas consequat,
neque a dapibus viverra, nunc
velit volutpat nibh, ut cursus sem tortor ac arcu. Praesent convallis lacus vel nisi aliquam, in posuere libero
scelerisque. Curabitur et lacinia nisl. Nunc id ligula neque. Phasellus non eros et leo ultrices ultricies. Nulla
facilisi.
Donec ut augue urna. Suspendisse sodales nisi at ex faucibus, et tempus magna fermentum. Proin non arcu interdum,
pulvinar est at, vehicula odio. Morbi nec maximus sem. Ut eu tristique urna.
</p>
<p>
Pellentesque eget quam sem. Nam interdum eleifend leo, mattis sagittis metus ornare tristique. Cras pretium odio
lectus, vitae viverra massa consequat eget. Suspendisse porttitor pretium lectus in scelerisque. Phasellus euismod
porta lectus eget pharetra.
Ut et viverra mi, ut imperdiet lacus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
cubilia Curae; Nunc tempus sapien sit amet tortor rhoncus dignissim. Sed at augue et sem lacinia feugiat. Nulla
vitae convallis
urna. Morbi scelerisque erat quis nibh pretium, non elementum elit consectetur. Proin in feugiat nisl.
</p>
<p>
Morbi et ipsum purus. Integer ut pulvinar metus. Fusce maximus ex nec purus sollicitudin gravida. Vivamus dapibus
volutpat erat nec tristique. Aliquam mi dolor, pretium non elementum quis, viverra non est. Pellentesque egestas,
lectus a posuere imperdiet,
nisi sem elementum neque, eu volutpat arcu turpis venenatis magna. Curabitur non neque consectetur, vulputate urna
sed, vestibulum lacus. Aenean mollis, risus non pulvinar egestas, lectus lectus finibus dui, sit amet pretium
metus mauris
vitae nibh. In non ultricies odio.
</p>
</div>
</body>

</html>
Loading

0 comments on commit 84f10a7

Please sign in to comment.