Skip to content

Instantly share code, notes, and snippets.

@chris-gunawardena
Created June 13, 2016 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-gunawardena/a17fd303bf45c6245fbe4e21e11c2818 to your computer and use it in GitHub Desktop.
Save chris-gunawardena/a17fd303bf45c6245fbe4e21e11c2818 to your computer and use it in GitHub Desktop.
/* global browser */
var assert = require('assert');
describe('Viraliaze video player', function () {
it('should load ad and start playing', function () {
browser.url('/');
browser.waitForExist('#ima-ad-container iframe', 10000);
// http://imasdk.googleapis.com/js/core/bridge3.130.0_en.html#goog_96574024
browser.frame(0);
browser.waitForExist('iframe[src*="vpaid.js"]', 10000);
// iframe needs a name or a id for frame() to work
// http://tpc.googlesyndication.com/pagead/js/loader12.html?http://localhost:9000/scripts/vpaid.js
browser.execute(function () {
var iframe = document.querySelector('iframe[src*="vpaid.js"]')
iframe.id = "vpaid_js";
iframe.name = "vpaid_js";
});
browser.frame('vpaid_js');
browser.waitForExist('#viralize-player-iframe', 10000);
// javascript:false
browser.frame(0);
assert.equal(browser.isExisting('.vr-ad-logo'), true, 'Viraliaze player was loaded');
assert.equal(browser.isExisting('.vr-ad-progress-bar'), true, 'Viraliaze ad started playing');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment