/* global $ TweenMax Power0 Power1 Power2 Power3 */
var stopWatch,
loops = 1;
//A simple helper function to do display:none to multiple items
function hideAll(whichOnes) {
for (var q = 0; q < whichOnes.length; q++) {
$(whichOnes[q]).hide();
}
}
//This will echo how many seconds have passed
function returnTimer() {
stopWatch = ((new Date().getTime()) - stopWatch) * 0.001;
console.log(stopWatch + " seconds");
}
//Set the initial states of all divs here
function setInitialStates() {
hideAll([
// images
'.bg1',
'.copy1',
'.logo_white',
'.copy2txt1',
'.copy2txt2',
'.copy2txt3',
'.copy2txt4',
'.copy2plus1',
'.copy2plus2',
'.copy2plus3',
'.copy2plus4',
'.legal',
'.blue_container',
'.content_blue_container',
'.logo_blue',
'.copy3',
'.cta',
'.left_border',
'.bottom_border',
'.right_border',
'.cta',
'.logo1',
'.backOpacity',
'.copy4',
]);
}
function resetAll() {
TweenMax.set($(".container").find('*'), { clearProps: "all" });
}
function replay() {
TweenMax.killTweensOf($(".container").find('*'));
resetAll();
setInitialStates();
seq01();
}
function mainInit() {
setInitialStates();
$('.container').show();
stopWatch = new Date().getTime();
seq01();
}
function seq01() {
var twnDelay = 0;
$(".bg1").show();
$(".copy1").show();
$(".logo_white").show();
TweenMax.from($(".bg1"), 3, { alpha: 1, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.2;
TweenMax.from($(".logo_white"), 3, { alpha: 1,x:0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.5;
TweenMax.from($(".copy1"), 3, { alpha: 0, x:0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 1.5;
TweenMax.delayedCall(twnDelay, seq02);
}
function seq02() {
var twnDelay = 0;
$('.copy2txt1').show();
$('.copy2plus1').show();
$('.copy2txt2').show();
$('.copy2plus2').show();
$('.copy2txt3').show();
$('.copy2plus3').show();
$('.copy2txt4').show();
$('.copy2plus4').show();
$('.backOpacity').show();
TweenMax.to($(".bg1"), 1, { alpha: 1, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.2;
TweenMax.to($(".copy1"), 1, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.5;
TweenMax.from($(".backOpacity"), 1.5, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.6;
TweenMax.from($(".copy2plus1"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
TweenMax.from($(".copy2txt1"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.6;
TweenMax.from($(".copy2plus2"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
TweenMax.from($(".copy2txt2"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.6;
TweenMax.from($(".copy2plus3"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
TweenMax.from($(".copy2txt3"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.6;
TweenMax.from($(".copy2plus4"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
TweenMax.from($(".copy2txt4"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 2.2;
TweenMax.delayedCall(twnDelay, seq03);
}
function seq03() {
var twnDelay = 0;
$('.copy3').show();
twnDelay += 0.4;
TweenMax.to($(".bg1"), 1, { alpha: 1, ease: Power2.easeOut, delay: twnDelay });
TweenMax.to($(".copy2plus1,.copy2plus2,.copy2plus3,.copy2plus4,.copy2txt1,.copy2txt2,.copy2txt3,.copy2txt4"), 1, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.4;
TweenMax.from($(".copy3"), 1, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 1;
TweenMax.delayedCall(twnDelay, seq04);
}
function seq04() {
var twnDelay = 0;
$('.left_border').show();
$('.bottom_border').show();
$('.right_border').show();
$('.logo_blue').show();
$('.copy4').show();
$('.copy4a').show();
$('.blue_container').show();
$('.content_blue_container').show();
$('.cta').show();
$('.legal').show();
TweenMax.to($(".bg1"), 1, { alpha: 1, scale:0.56, y:-38, x:90, ease: Quad.easeInOut, delay: twnDelay });
TweenMax.to($(".copy3,.backOpacity"), 1.5, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.6;
TweenMax.from($(".left_border"), 0.6, { height: 0, ease: Power1.easeOut, delay: twnDelay });
twnDelay += 0.3;
TweenMax.from($(".bottom_border"), 0.4, { width: 0, ease: Power1.easeOut, delay: twnDelay +0.30});
TweenMax.from($(".logo_blue"), 0.9, { alpha: 0, ease: Power2.easeOut, delay: twnDelay +0.30 });
twnDelay += 0.2;
TweenMax.from($(".right_border"), 0.6, { y: 600, ease: Power1.easeOut, delay: twnDelay+0.35 });
twnDelay += 1.2;
TweenMax.from($(".copy4"), 2, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.3;
TweenMax.from($(".copy4a"), 2, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 1;
TweenMax.from($(".blue_container"), 0.9, { width: 0, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.8;
TweenMax.from($(".content_blue_container"), 0.9, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
TweenMax.from($(".legal"), 0.9, { opacity: 0, ease: Power1.easeOut, delay: twnDelay });
twnDelay += 0.8;
TweenMax.from($(".cta"), 0.9, { alpha: 0,x:-300, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 3.0;
if (loops > 0) {
loops -= 1;
TweenMax.to($(".white_bg"), 0.3, { alpha: 1, ease: Power2.easeOut, delay: twnDelay });
twnDelay += 0.1;
TweenMax.to($(".white_bg"), 0.5, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
TweenMax.delayedCall(twnDelay, function() {
TweenMax.delayedCall(0, replay);
});
}
}
$(window).on('load', mainInit);
'use strict';
const path = require('path');
const BUNDLE_NAME = require('../../package.json').name;
const MAX_LOWERTHIRD_NAMES = 5;
const STANDARD_DELAY = 375;
const FINISHED_DELAY = 2000;
const STANDARD_REPLICANT_PREFILLS = {
allBids: undefined,
allPrizes: undefined,
currentBids: undefined,
currentIntermission: undefined,
currentPrizes: undefined,
currentRun: undefined,
'interview:names': undefined,
recordTrackerEnabled: undefined,
scores: undefined,
stopwatch: undefined,
total: undefined,
tweets: undefined
};
const transitionBefore = function (page) {
return page.evaluate(async () => {
await document.querySelector('gdq-transition').waitForInit(); // eslint-disable-line no-undef
});
};
module.exports = {
BUNDLE_CONFIG: {},
TEST_CASES: [{
route: `bundles/${BUNDLE_NAME}/graphics/break.html`,
additionalDelay: 1000,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/break.html`,
nameAppendix: 'fanart',
additionalDelay: 2000,
replicantPrefills: STANDARD_REPLICANT_PREFILLS,
before: async page => {
const tweet = require(path.resolve(__dirname, '../fixtures/arguments/tweet.json'));
await page.evaluate(t => {
return new Promise(resolve => {
const tl = document.querySelector('gdq-break').$.fanart.playItem(t); // eslint-disable-line no-undef
tl.call(() => {
resolve();
}, null, null, '+=0.03');
});
}, tweet);
}
}, {
route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
nameAppendix: 'initial',
selector: 'gdq-transition',
entranceMethodName: null,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS,
before: transitionBefore
}, {
route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
nameAppendix: 'fromOpenToClosed',
selector: 'gdq-transition',
entranceMethodName: 'fromOpenToClosed',
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS,
before: transitionBefore
}, {
route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
nameAppendix: 'fromClosedToOpen',
selector: 'gdq-transition',
entranceMethodName: 'fromClosedToOpen',
entranceMethodArgs: [{fadeOutVideos: true}],
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS,
before: transitionBefore
}, {
route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
nameAppendix: 'fromPartialToClosed',
selector: 'gdq-transition',
entranceMethodName: 'fromPartialToClosed',
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS,
before: transitionBefore
}, {
route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
nameAppendix: 'fromClosedToPartial',
selector: 'gdq-transition',
entranceMethodName: 'fromClosedToPartial',
entranceMethodArgs: [{fadeOutVideos: true}],
additionalDelay: STANDARD_DELAY,
replicantPrefills: {
...STANDARD_REPLICANT_PREFILLS,
currentHost: undefined,
nowPlaying: undefined
},
before: transitionBefore
}, {
route: `bundles/${BUNDLE_NAME}/graphics/interview.html`,
nameAppendix: 'blank',
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/lttp_tracker.html`,
additionalDelay: 1500,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/omnibar.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/widescreen_2_mario.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}]
};
const gameplayLayoutTestCases = [{
route: `bundles/${BUNDLE_NAME}/graphics/3ds.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/ds.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/ds_vertical.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/gameboy_1.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/gameboy_2.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/gameboy_3.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/gameboy_4.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/gba_1.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/gba_2.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/gba_4.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/standard_1.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS,
coopTests: [2, 4]
}, {
route: `bundles/${BUNDLE_NAME}/graphics/standard_1_smalttp.html`,
replicantPrefills: {
smalttpData: undefined
}
}, {
route: `bundles/${BUNDLE_NAME}/graphics/standard_2.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/standard_3.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/standard_4.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/widescreen_1.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/widescreen_2.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/widescreen_4.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}, {
route: `bundles/${BUNDLE_NAME}/graphics/widescreen_4_2.html`,
additionalDelay: STANDARD_DELAY,
replicantPrefills: STANDARD_REPLICANT_PREFILLS
}];
gameplayLayoutTestCases.forEach(testCase => {
module.exports.TEST_CASES.push({
...testCase,
nameAppendix: 'not_started',
replicantPrefills: {
...STANDARD_REPLICANT_PREFILLS,
...testCase.replicantPrefills,
gameAudioChannels: [{
sd: {muted: false, fadedBelowThreshold: false},
hd: {muted: false, fadedBelowThreshold: false}
}, {
sd: {muted: false, fadedBelowThreshold: false},
hd: {muted: false, fadedBelowThreshold: false}
}, {
sd: {muted: false, fadedBelowThreshold: false},
hd: {muted: false, fadedBelowThreshold: false}
}, {
sd: {muted: false, fadedBelowThreshold: false},
hd: {muted: false, fadedBelowThreshold: false}
}]
}
}, {
...testCase,
nameAppendix: 'running',
replicantPrefills: {
...STANDARD_REPLICANT_PREFILLS,
...testCase.replicantPrefills,
stopwatch: {
state: 'running',
time: {
days: 0,
hours: 1,
minutes: 2,
seconds: 3,
milliseconds: 400,
formatted: '1:02:03.4',
raw: 3723400,
timestamp: 1526531543450
},
results: [
null,
null,
null,
null
]
}
}
}, {
...testCase,
nameAppendix: 'finished',
additionalDelay: FINISHED_DELAY,
replicantPrefills: {
...STANDARD_REPLICANT_PREFILLS,
...testCase.replicantPrefills,
stopwatch: {
state: 'finished',
time: {
days: 0,
hours: 1,
minutes: 2,
seconds: 3,
milliseconds: 400,
formatted: '1:02:03.4',
raw: 3723400,
timestamp: 1526531543450
},
results: [{
time: {
days: 0,
hours: 1,
minutes: 2,
seconds: 3,
milliseconds: 400,
formatted: '1:02:03.4',
raw: 3723400,
timestamp: 1526589137479
},
place: 1,
forfeit: false
}, {
time: {
days: 0,
hours: 1,
minutes: 2,
seconds: 3,
milliseconds: 400,
formatted: '1:02:03.4',
raw: 3723400,
timestamp: 1526589137479
},
place: 2,
forfeit: true
}, {
time: {
days: 0,
hours: 1,
minutes: 2,
seconds: 3,
milliseconds: 400,
formatted: '1:02:03.4',
raw: 3723400,
timestamp: 1526589137479
},
place: 3,
forfeit: false
}, {
time: {
days: 0,
hours: 1,
minutes: 2,
seconds: 3,
milliseconds: 400,
formatted: '1:02:03.4',
raw: 3723400,
timestamp: 1526589137479
},
place: 4,
forfeit: false
}]
}
}
});
if (testCase.coopTests) {
testCase.coopTests.forEach(numberOfRunners => {
module.exports.TEST_CASES.push({
...testCase,
nameAppendix: `coop_${numberOfRunners}`,
replicantPrefills: {
...STANDARD_REPLICANT_PREFILLS,
...testCase.replicantPrefills,
currentRun: {
name: 'Pre-Show',
longName: 'Pre-Show',
console: 'Unknown',
commentators: 'Unknown',
category: 'Hype',
setupTime: '0',
order: 1,
estimate: '0:32:00',
releaseYear: '',
runners: [
{name: 'SpikeVegeta', stream: 'spikevegeta'},
{name: 'Blechy', stream: 'bellery_'},
{name: 'Protomagicalgirl', stream: 'protomagicalgirl'},
{name: 'JHobz', stream: 'jhobz296'}
].slice(0, numberOfRunners),
notes: '',
coop: true,
id: 2640,
pk: 2640,
type: 'run'
}
}
});
});
}
});
// Interview lowerthird tests.
for (let i = 1; i <= MAX_LOWERTHIRD_NAMES; i++) {
module.exports.TEST_CASES.push({
route: `bundles/${BUNDLE_NAME}/graphics/interview.html`,
nameAppendix: `lowerthird-${i}`,
selector: 'gdq-lowerthird',
entranceMethodName: 'show',
entranceMethodArgs: [[
{name: 'one wwwwwWWWWWwwwwwWWWWWwwwwwWWWWW', title: 'one title WWWWWwwwwwWWWWWwwwww'},
{name: 'two', title: 'two title'},
{name: 'three wwwwwWWWWWwwwwwWWWWWwwwwwWWWWW', title: 'three title WWWWWwwwwwWWWWWwwwww'},
{name: 'four', title: ''},
{name: 'five wwwwwWWWWWwwwwwWWWWWwwwwwWWWWW', title: 'five title WWWWWwwwwwWWWWWwwwww'}
].slice(0, i)],
additionalDelay: STANDARD_DELAY
});
}