How to use B.delay method in Appium

Best JavaScript code snippet using appium

Run Appium automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

script.js

Source: script.js Github

copy
1/* global $ TweenMax Power0 Power1 Power2 Power3 */
2
3var stopWatch,
4    loops = 1;
5
6//A simple helper function to do display:none to multiple items
7function hideAll(whichOnes) {
8    for (var q = 0; q < whichOnes.length; q++) {
9        $(whichOnes[q]).hide();
10    }
11}
12//This will echo how many seconds have passed
13function returnTimer() {
14    stopWatch = ((new Date().getTime()) - stopWatch) * 0.001;
15    console.log(stopWatch + " seconds");
16}
17//Set the initial states of all divs here
18function setInitialStates() {
19    hideAll([
20        // images
21        '.bg1',
22        '.copy1',
23        '.logo_white', 
24        '.copy2txt1',
25		'.copy2txt2',
26		'.copy2txt3',
27		'.copy2txt4',
28		'.copy2plus1',
29		'.copy2plus2',
30		'.copy2plus3',
31		'.copy2plus4',
32        '.legal',
33        '.blue_container',
34        '.content_blue_container',
35        '.logo_blue', 
36        '.copy3',
37        '.cta',
38        '.left_border',
39        '.bottom_border',
40        '.right_border', 
41        '.cta',
42		'.logo1',
43		'.backOpacity',
44		'.copy4',
45    ]);
46}
47
48function resetAll() {
49    TweenMax.set($(".container").find('*'), { clearProps: "all" });
50}
51
52function replay() {
53    TweenMax.killTweensOf($(".container").find('*'));
54    resetAll();
55    setInitialStates();
56    seq01();
57}
58
59function mainInit() {
60    setInitialStates();
61    $('.container').show();
62    stopWatch = new Date().getTime();
63    seq01();
64}
65
66function seq01() {
67    var twnDelay = 0;
68    $(".bg1").show();
69    $(".copy1").show();
70    $(".logo_white").show();
71	TweenMax.from($(".bg1"), 3, { alpha: 1,  ease: Power2.easeOut, delay: twnDelay });
72	twnDelay += 0.2;
73    TweenMax.from($(".logo_white"), 3, { alpha: 1,x:0, ease: Power2.easeOut, delay: twnDelay });
74    twnDelay += 0.5;
75    TweenMax.from($(".copy1"), 3, { alpha: 0, x:0, ease: Power2.easeOut, delay: twnDelay });
76    twnDelay += 1.5;
77    TweenMax.delayedCall(twnDelay, seq02);
78}
79
80function seq02() {
81    var twnDelay = 0;
82    $('.copy2txt1').show();	
83	$('.copy2plus1').show();	
84	$('.copy2txt2').show();	
85	$('.copy2plus2').show();	
86	$('.copy2txt3').show();	
87	$('.copy2plus3').show();	
88	$('.copy2txt4').show();	
89	$('.copy2plus4').show();
90	
91	$('.backOpacity').show();
92	TweenMax.to($(".bg1"), 1, { alpha: 1, ease: Power2.easeOut, delay: twnDelay });
93	twnDelay += 0.2;
94	TweenMax.to($(".copy1"), 1, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
95	twnDelay += 0.5;
96    TweenMax.from($(".backOpacity"), 1.5, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
97	twnDelay += 0.6;    
98	TweenMax.from($(".copy2plus1"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
99	TweenMax.from($(".copy2txt1"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
100	twnDelay += 0.6;    
101	TweenMax.from($(".copy2plus2"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
102	TweenMax.from($(".copy2txt2"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
103	twnDelay += 0.6;    
104	TweenMax.from($(".copy2plus3"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
105	TweenMax.from($(".copy2txt3"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
106	twnDelay += 0.6;    
107	TweenMax.from($(".copy2plus4"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
108	TweenMax.from($(".copy2txt4"), 3, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
109    
110	twnDelay += 2.2;
111    TweenMax.delayedCall(twnDelay, seq03);
112}
113function seq03() {
114    var twnDelay = 0; 
115	$('.copy3').show();	
116	twnDelay += 0.4;    
117	TweenMax.to($(".bg1"), 1, { alpha: 1, ease: Power2.easeOut, delay: twnDelay });
118	TweenMax.to($(".copy2plus1,.copy2plus2,.copy2plus3,.copy2plus4,.copy2txt1,.copy2txt2,.copy2txt3,.copy2txt4"), 1, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
119	twnDelay += 0.4;  
120	TweenMax.from($(".copy3"), 1, { alpha: 0, ease: Power2.easeOut, delay: twnDelay }); 
121	twnDelay += 1;
122    TweenMax.delayedCall(twnDelay, seq04);
123}
124function seq04() {
125    var twnDelay = 0; 
126    $('.left_border').show();
127    $('.bottom_border').show();
128    $('.right_border').show();
129    $('.logo_blue').show();
130	$('.copy4').show();
131	$('.copy4a').show();
132    $('.blue_container').show();
133    $('.content_blue_container').show();
134	$('.cta').show();
135    $('.legal').show();    
136	TweenMax.to($(".bg1"), 1, { alpha: 1, scale:0.56, y:-38, x:90, ease: Quad.easeInOut, delay: twnDelay });
137	TweenMax.to($(".copy3,.backOpacity"), 1.5, { alpha: 0, ease: Power2.easeOut, delay: twnDelay }); 
138	twnDelay += 0.6;
139	TweenMax.from($(".left_border"), 0.6, { height: 0, ease: Power1.easeOut, delay: twnDelay });
140    twnDelay += 0.3;
141    TweenMax.from($(".bottom_border"), 0.4, { width: 0, ease: Power1.easeOut, delay: twnDelay +0.30});
142	
143	TweenMax.from($(".logo_blue"), 0.9, { alpha: 0, ease: Power2.easeOut, delay: twnDelay +0.30 });
144    twnDelay += 0.2;
145    TweenMax.from($(".right_border"), 0.6, { y: 600, ease: Power1.easeOut, delay: twnDelay+0.35 });	
146	twnDelay += 1.2;
147	TweenMax.from($(".copy4"), 2, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
148	twnDelay += 0.3;
149	TweenMax.from($(".copy4a"), 2, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
150	twnDelay += 1;
151    TweenMax.from($(".blue_container"), 0.9, { width: 0, ease: Power2.easeOut, delay: twnDelay });
152    twnDelay += 0.8;
153    TweenMax.from($(".content_blue_container"), 0.9, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });	 
154    TweenMax.from($(".legal"), 0.9, { opacity: 0, ease: Power1.easeOut, delay: twnDelay });
155    twnDelay += 0.8;
156    TweenMax.from($(".cta"), 0.9, { alpha: 0,x:-300, ease: Power2.easeOut, delay: twnDelay });	
157    twnDelay += 3.0;
158    if (loops > 0) {
159        loops -= 1;
160        TweenMax.to($(".white_bg"), 0.3, { alpha: 1, ease: Power2.easeOut, delay: twnDelay });
161        twnDelay += 0.1;
162        TweenMax.to($(".white_bg"), 0.5, { alpha: 0, ease: Power2.easeOut, delay: twnDelay });
163        TweenMax.delayedCall(twnDelay, function() {
164            TweenMax.delayedCall(0, replay);
165        });
166    }
167}
168$(window).on('load', mainInit);
169
Full Screen

delaySettingsComponent.js

Source: delaySettingsComponent.js Github

copy
1var DelaySettings = /*#__PURE__*/function () {
2    "use strict";
3  
4    // divName;
5    // div;
6    // targetDiv;
7    // randomDelaySwitch;
8    // delayTimeout;
9    // maxDelay;
10    // maxDelayInput;
11    // randomChecked;
12    // resolveDelay = () => {};
13    function DelaySettings(component) {
14      this.divName = component.divName;
15  
16      this.resolveDelay = function () {};
17    }
18  
19    var _proto = DelaySettings.prototype;
20  
21    _proto.createDelaySettingsTemplate = function createDelaySettingsTemplate(divName) {
22      var delaySettingsTemplate = "\n        <label class=\"randomTimeInput\">\n            Max Delay (seconds):<input type='number' min='0' value='0' id='" + divName + "MaxDelayTime' class=\"delayTimeInput\">\n            <span>Random Delay</span> <input id='" + divName + "RandomDelaySwitch' type=\"checkbox\"> \n            <span class=\"delay-slider round\"></span>\n        </label>\n        ";
23      return delaySettingsTemplate;
24    };
25  
26    _proto.show = function show() {
27      this.div = this.createDelaySettingsTemplate(this.divName);
28      this.targetDiv = document.getElementById(this.divName + "DelaySwitchSettings");
29      this.targetDiv.insertAdjacentHTML('afterbegin', this.div);
30      this.initDelayValues();
31      console.log(this.targetDiv);
32    };
33  
34    _proto.hide = function hide() {
35      this.targetDiv.innerHTML = "";
36      this.maxDelay = 0;
37      this.resetDelay();
38    };
39  
40    _proto.initDelayValues = function initDelayValues() {
41      var _this = this;
42  
43      this.randomDelaySwitch = document.getElementById(this.divName + "RandomDelaySwitch");
44      this.maxDelayInput = document.getElementById(this.divName + "MaxDelayTime");
45  
46      this.maxDelayInput.oninput = function () {
47        _this.maxDelay = _this.maxDelayInput.value;
48      };
49  
50      this.randomDelaySwitch.onclick = function () {
51        _this.maxDelay = _this.maxDelayInput.value;
52  
53        if (_this.randomDelaySwitch.checked == true) {
54          _this.randomChecked = true; //TODO: Potentially add another component to specify 'minimum' delay time
55        } else {
56          _this.randomChecked = false;
57        }
58      };
59    };
60  
61    _proto.setDelay = async function setDelay() {
62      if (this.randomChecked == true) {
63        this.maxDelay = Math.random() * this.maxDelayInput.value;
64        console.log("Random delayed enabled for " + this.divName + ", maxDelay is " + this.maxDelay + " sec");
65      }
66  
67      console.log("Delay for " + this.divName + ", maxDelay is " + this.maxDelay + " sec");
68      await this.delay(this.maxDelay * 1000);
69    };
70  
71    _proto.resetDelay = function resetDelay() {
72      clearTimeout(this.delayTimeout);
73      this.resolveDelay();
74    };
75  
76    _proto.delay = async function delay(ms) {
77      var _this2 = this;
78  
79      return new Promise(function (resolve) {
80        _this2.delayTimeout = setTimeout(resolve, ms);
81        _this2.resolveDelay = resolve; // testing this extra resolve. Mabye will fix premature stop playing time issue
82      });
83    };
84  
85    return DelaySettings;
86  }();
Full Screen

conditionaldelay_test.js

Source: conditionaldelay_test.js Github

copy
1// Copyright 2008 The Closure Library Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS-IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14goog.provide('goog.async.ConditionalDelayTest');
15goog.setTestOnly('goog.async.ConditionalDelayTest');
16
17goog.require('goog.async.ConditionalDelay');
18goog.require('goog.testing.MockClock');
19goog.require('goog.testing.jsunit');
20
21var invoked = false;
22var delay = null;
23var clock = null;
24var returnValue = true;
25var onSuccessCalled = false;
26var onFailureCalled = false;
27
28
29function callback() {
30  invoked = true;
31  return returnValue;
32}
33
34
35function setUp() {
36  clock = new goog.testing.MockClock(true);
37  invoked = false;
38  returnValue = true;
39  onSuccessCalled = false;
40  onFailureCalled = false;
41  delay = new goog.async.ConditionalDelay(callback);
42  delay.onSuccess = function() {
43    onSuccessCalled = true;
44  };
45  delay.onFailure = function() {
46    onFailureCalled = true;
47  };
48}
49
50
51function tearDown() {
52  clock.dispose();
53  delay.dispose();
54}
55
56
57function testDelay() {
58  delay.start(200, 200);
59  assertFalse(invoked);
60
61  clock.tick(100);
62  assertFalse(invoked);
63
64  clock.tick(100);
65  assertTrue(invoked);
66}
67
68
69function testStop() {
70  delay.start(200, 500);
71  assertTrue(delay.isActive());
72
73  clock.tick(100);
74  assertFalse(invoked);
75
76  delay.stop();
77  clock.tick(100);
78  assertFalse(invoked);
79
80  assertFalse(delay.isActive());
81}
82
83
84function testIsActive() {
85  assertFalse(delay.isActive());
86  delay.start(200, 200);
87  assertTrue(delay.isActive());
88  clock.tick(200);
89  assertFalse(delay.isActive());
90}
91
92
93function testRestart() {
94  delay.start(200, 50000);
95  clock.tick(100);
96
97  delay.stop();
98  assertFalse(invoked);
99
100  delay.start(200, 50000);
101  clock.tick(199);
102  assertFalse(invoked);
103
104  clock.tick(1);
105  assertTrue(invoked);
106
107  invoked = false;
108  delay.start(200, 200);
109  clock.tick(200);
110  assertTrue(invoked);
111
112  assertFalse(delay.isActive());
113}
114
115
116function testDispose() {
117  delay.start(200, 200);
118  delay.dispose();
119  assertTrue(delay.isDisposed());
120
121  clock.tick(500);
122  assertFalse(invoked);
123}
124
125
126function testConditionalDelay_Success() {
127  returnValue = false;
128  delay.start(100, 300);
129
130  clock.tick(99);
131  assertFalse(invoked);
132  clock.tick(1);
133  assertTrue(invoked);
134
135  assertTrue(delay.isActive());
136  assertFalse(delay.isDone());
137  assertFalse(onSuccessCalled);
138  assertFalse(onFailureCalled);
139
140  returnValue = true;
141
142  invoked = false;
143  clock.tick(100);
144  assertTrue(invoked);
145
146  assertFalse(delay.isActive());
147  assertTrue(delay.isDone());
148  assertTrue(onSuccessCalled);
149  assertFalse(onFailureCalled);
150
151  invoked = false;
152  clock.tick(200);
153  assertFalse(invoked);
154}
155
156
157function testConditionalDelay_Failure() {
158  returnValue = false;
159  delay.start(100, 300);
160
161  clock.tick(99);
162  assertFalse(invoked);
163  clock.tick(1);
164  assertTrue(invoked);
165
166  assertTrue(delay.isActive());
167  assertFalse(delay.isDone());
168  assertFalse(onSuccessCalled);
169  assertFalse(onFailureCalled);
170
171  invoked = false;
172  clock.tick(100);
173  assertTrue(invoked);
174  assertFalse(onSuccessCalled);
175  assertFalse(onFailureCalled);
176
177  invoked = false;
178  clock.tick(90);
179  assertFalse(invoked);
180  clock.tick(10);
181  assertTrue(invoked);
182
183  assertFalse(delay.isActive());
184  assertFalse(delay.isDone());
185  assertFalse(onSuccessCalled);
186  assertTrue(onFailureCalled);
187}
188
189
190function testInfiniteDelay() {
191  returnValue = false;
192  delay.start(100, -1);
193
194  // Test in a big enough loop.
195  for (var i = 0; i < 1000; ++i) {
196    clock.tick(80);
197    assertTrue(delay.isActive());
198    assertFalse(delay.isDone());
199    assertFalse(onSuccessCalled);
200    assertFalse(onFailureCalled);
201  }
202
203  delay.stop();
204  assertFalse(delay.isActive());
205  assertFalse(delay.isDone());
206  assertFalse(onSuccessCalled);
207  assertFalse(onFailureCalled);
208}
209
210function testCallbackScope() {
211  var callbackCalled = false;
212  var scopeObject = {};
213  function internalCallback() {
214    assertEquals(this, scopeObject);
215    callbackCalled = true;
216    return true;
217  }
218  delay = new goog.async.ConditionalDelay(internalCallback, scopeObject);
219  delay.start(200, 200);
220  clock.tick(201);
221  assertTrue(callbackCalled);
222}
223
Full Screen

delay_test.js

Source: delay_test.js Github

copy
1// Copyright 2007 The Closure Library Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS-IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14goog.provide('goog.async.DelayTest');
15goog.setTestOnly('goog.async.DelayTest');
16
17goog.require('goog.async.Delay');
18goog.require('goog.testing.MockClock');
19goog.require('goog.testing.jsunit');
20
21var invoked = false;
22var delay = null;
23var clock = null;
24
25
26function callback() {
27  invoked = true;
28}
29
30
31function setUp() {
32  clock = new goog.testing.MockClock(true);
33  invoked = false;
34  delay = new goog.async.Delay(callback, 200);
35}
36
37function tearDown() {
38  clock.dispose();
39  delay.dispose();
40}
41
42
43function testDelay() {
44  delay.start();
45  assertFalse(invoked);
46
47  clock.tick(100);
48  assertFalse(invoked);
49
50  clock.tick(100);
51  assertTrue(invoked);
52}
53
54
55function testStop() {
56  delay.start();
57
58  clock.tick(100);
59  assertFalse(invoked);
60
61  delay.stop();
62  clock.tick(100);
63  assertFalse(invoked);
64}
65
66
67function testIsActive() {
68  assertFalse(delay.isActive());
69  delay.start();
70  assertTrue(delay.isActive());
71  clock.tick(200);
72  assertFalse(delay.isActive());
73}
74
75
76function testRestart() {
77  delay.start();
78  clock.tick(100);
79
80  delay.stop();
81  assertFalse(invoked);
82
83  delay.start();
84  clock.tick(199);
85  assertFalse(invoked);
86
87  clock.tick(1);
88  assertTrue(invoked);
89
90  invoked = false;
91  delay.start();
92  clock.tick(200);
93  assertTrue(invoked);
94}
95
96
97function testStartIfNotActive() {
98  delay.startIfNotActive();
99  clock.tick(100);
100
101  delay.stop();
102  assertFalse(invoked);
103
104  delay.startIfNotActive();
105  clock.tick(199);
106  assertFalse(invoked);
107
108  clock.tick(1);
109  assertTrue(invoked);
110
111  invoked = false;
112  delay.start();
113  clock.tick(199);
114
115  assertFalse(invoked);
116
117  delay.startIfNotActive();
118  clock.tick(1);
119
120  assertTrue(invoked);
121}
122
123
124function testOverride() {
125  delay.start(50);
126  clock.tick(49);
127  assertFalse(invoked);
128
129  clock.tick(1);
130  assertTrue(invoked);
131}
132
133
134function testDispose() {
135  delay.start();
136  delay.dispose();
137  assertTrue(delay.isDisposed());
138
139  clock.tick(500);
140  assertFalse(invoked);
141}
142
143
144function testFire() {
145  delay.start();
146
147  clock.tick(50);
148  delay.fire();
149  assertTrue(invoked);
150  assertFalse(delay.isActive());
151
152  invoked = false;
153  clock.tick(200);
154  assertFalse('Delay fired early with fire call, timeout should have been ' +
155      'cleared', invoked);
156}
157
158function testFireIfActive() {
159  delay.fireIfActive();
160  assertFalse(invoked);
161
162  delay.start();
163  delay.fireIfActive();
164  assertTrue(invoked);
165  invoked = false;
166  clock.tick(300);
167  assertFalse('Delay fired early with fireIfActive, timeout should have been ' +
168      'cleared', invoked);
169}
170
Full Screen

screenshot-consts.js

Source: screenshot-consts.js Github

copy
1'use strict';
2
3const path = require('path');
4
5const BUNDLE_NAME = require('../../package.json').name;
6const MAX_LOWERTHIRD_NAMES = 5;
7const STANDARD_DELAY = 375;
8const FINISHED_DELAY = 2000;
9const STANDARD_REPLICANT_PREFILLS = {
10	allBids: undefined,
11	allPrizes: undefined,
12	currentBids: undefined,
13	currentIntermission: undefined,
14	currentPrizes: undefined,
15	currentRun: undefined,
16	'interview:names': undefined,
17	recordTrackerEnabled: undefined,
18	scores: undefined,
19	stopwatch: undefined,
20	total: undefined,
21	tweets: undefined
22};
23
24const transitionBefore = function (page) {
25	return page.evaluate(async () => {
26		await document.querySelector('gdq-transition').waitForInit(); // eslint-disable-line no-undef
27	});
28};
29
30module.exports = {
31	BUNDLE_CONFIG: {},
32	TEST_CASES: [{
33		route: `bundles/${BUNDLE_NAME}/graphics/break.html`,
34		additionalDelay: 1000,
35		replicantPrefills: STANDARD_REPLICANT_PREFILLS
36	}, {
37		route: `bundles/${BUNDLE_NAME}/graphics/break.html`,
38		nameAppendix: 'fanart',
39		additionalDelay: 2000,
40		replicantPrefills: STANDARD_REPLICANT_PREFILLS,
41		before: async page => {
42			const tweet = require(path.resolve(__dirname, '../fixtures/arguments/tweet.json'));
43			await page.evaluate(t => {
44				return new Promise(resolve => {
45					const tl = document.querySelector('gdq-break').$.fanart.playItem(t); // eslint-disable-line no-undef
46					tl.call(() => {
47						resolve();
48					}, null, null, '+=0.03');
49				});
50			}, tweet);
51		}
52	}, {
53		route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
54		nameAppendix: 'initial',
55		selector: 'gdq-transition',
56		entranceMethodName: null,
57		additionalDelay: STANDARD_DELAY,
58		replicantPrefills: STANDARD_REPLICANT_PREFILLS,
59		before: transitionBefore
60	}, {
61		route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
62		nameAppendix: 'fromOpenToClosed',
63		selector: 'gdq-transition',
64		entranceMethodName: 'fromOpenToClosed',
65		additionalDelay: STANDARD_DELAY,
66		replicantPrefills: STANDARD_REPLICANT_PREFILLS,
67		before: transitionBefore
68	}, {
69		route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
70		nameAppendix: 'fromClosedToOpen',
71		selector: 'gdq-transition',
72		entranceMethodName: 'fromClosedToOpen',
73		entranceMethodArgs: [{fadeOutVideos: true}],
74		additionalDelay: STANDARD_DELAY,
75		replicantPrefills: STANDARD_REPLICANT_PREFILLS,
76		before: transitionBefore
77	}, {
78		route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
79		nameAppendix: 'fromPartialToClosed',
80		selector: 'gdq-transition',
81		entranceMethodName: 'fromPartialToClosed',
82		additionalDelay: STANDARD_DELAY,
83		replicantPrefills: STANDARD_REPLICANT_PREFILLS,
84		before: transitionBefore
85	}, {
86		route: `bundles/${BUNDLE_NAME}/graphics/transition.html`,
87		nameAppendix: 'fromClosedToPartial',
88		selector: 'gdq-transition',
89		entranceMethodName: 'fromClosedToPartial',
90		entranceMethodArgs: [{fadeOutVideos: true}],
91		additionalDelay: STANDARD_DELAY,
92		replicantPrefills: {
93			...STANDARD_REPLICANT_PREFILLS,
94			currentHost: undefined,
95			nowPlaying: undefined
96		},
97		before: transitionBefore
98	}, {
99		route: `bundles/${BUNDLE_NAME}/graphics/interview.html`,
100		nameAppendix: 'blank',
101		additionalDelay: STANDARD_DELAY,
102		replicantPrefills: STANDARD_REPLICANT_PREFILLS
103	}, {
104		route: `bundles/${BUNDLE_NAME}/graphics/lttp_tracker.html`,
105		additionalDelay: 1500,
106		replicantPrefills: STANDARD_REPLICANT_PREFILLS
107	}, {
108		route: `bundles/${BUNDLE_NAME}/graphics/omnibar.html`,
109		additionalDelay: STANDARD_DELAY,
110		replicantPrefills: STANDARD_REPLICANT_PREFILLS
111	}, {
112		route: `bundles/${BUNDLE_NAME}/graphics/widescreen_2_mario.html`,
113		additionalDelay: STANDARD_DELAY,
114		replicantPrefills: STANDARD_REPLICANT_PREFILLS
115	}]
116};
117
118const gameplayLayoutTestCases = [{
119	route: `bundles/${BUNDLE_NAME}/graphics/3ds.html`,
120	additionalDelay: STANDARD_DELAY,
121	replicantPrefills: STANDARD_REPLICANT_PREFILLS
122}, {
123	route: `bundles/${BUNDLE_NAME}/graphics/ds.html`,
124	additionalDelay: STANDARD_DELAY,
125	replicantPrefills: STANDARD_REPLICANT_PREFILLS
126}, {
127	route: `bundles/${BUNDLE_NAME}/graphics/ds_vertical.html`,
128	additionalDelay: STANDARD_DELAY,
129	replicantPrefills: STANDARD_REPLICANT_PREFILLS
130}, {
131	route: `bundles/${BUNDLE_NAME}/graphics/gameboy_1.html`,
132	additionalDelay: STANDARD_DELAY,
133	replicantPrefills: STANDARD_REPLICANT_PREFILLS
134}, {
135	route: `bundles/${BUNDLE_NAME}/graphics/gameboy_2.html`,
136	additionalDelay: STANDARD_DELAY,
137	replicantPrefills: STANDARD_REPLICANT_PREFILLS
138}, {
139	route: `bundles/${BUNDLE_NAME}/graphics/gameboy_3.html`,
140	additionalDelay: STANDARD_DELAY,
141	replicantPrefills: STANDARD_REPLICANT_PREFILLS
142}, {
143	route: `bundles/${BUNDLE_NAME}/graphics/gameboy_4.html`,
144	additionalDelay: STANDARD_DELAY,
145	replicantPrefills: STANDARD_REPLICANT_PREFILLS
146}, {
147	route: `bundles/${BUNDLE_NAME}/graphics/gba_1.html`,
148	additionalDelay: STANDARD_DELAY,
149	replicantPrefills: STANDARD_REPLICANT_PREFILLS
150}, {
151	route: `bundles/${BUNDLE_NAME}/graphics/gba_2.html`,
152	additionalDelay: STANDARD_DELAY,
153	replicantPrefills: STANDARD_REPLICANT_PREFILLS
154}, {
155	route: `bundles/${BUNDLE_NAME}/graphics/gba_4.html`,
156	additionalDelay: STANDARD_DELAY,
157	replicantPrefills: STANDARD_REPLICANT_PREFILLS
158}, {
159	route: `bundles/${BUNDLE_NAME}/graphics/standard_1.html`,
160	additionalDelay: STANDARD_DELAY,
161	replicantPrefills: STANDARD_REPLICANT_PREFILLS,
162	coopTests: [2, 4]
163}, {
164	route: `bundles/${BUNDLE_NAME}/graphics/standard_1_smalttp.html`,
165	replicantPrefills: {
166		smalttpData: undefined
167	}
168}, {
169	route: `bundles/${BUNDLE_NAME}/graphics/standard_2.html`,
170	additionalDelay: STANDARD_DELAY,
171	replicantPrefills: STANDARD_REPLICANT_PREFILLS
172}, {
173	route: `bundles/${BUNDLE_NAME}/graphics/standard_3.html`,
174	additionalDelay: STANDARD_DELAY,
175	replicantPrefills: STANDARD_REPLICANT_PREFILLS
176}, {
177	route: `bundles/${BUNDLE_NAME}/graphics/standard_4.html`,
178	additionalDelay: STANDARD_DELAY,
179	replicantPrefills: STANDARD_REPLICANT_PREFILLS
180}, {
181	route: `bundles/${BUNDLE_NAME}/graphics/widescreen_1.html`,
182	additionalDelay: STANDARD_DELAY,
183	replicantPrefills: STANDARD_REPLICANT_PREFILLS
184}, {
185	route: `bundles/${BUNDLE_NAME}/graphics/widescreen_2.html`,
186	additionalDelay: STANDARD_DELAY,
187	replicantPrefills: STANDARD_REPLICANT_PREFILLS
188}, {
189	route: `bundles/${BUNDLE_NAME}/graphics/widescreen_4.html`,
190	additionalDelay: STANDARD_DELAY,
191	replicantPrefills: STANDARD_REPLICANT_PREFILLS
192}, {
193	route: `bundles/${BUNDLE_NAME}/graphics/widescreen_4_2.html`,
194	additionalDelay: STANDARD_DELAY,
195	replicantPrefills: STANDARD_REPLICANT_PREFILLS
196}];
197
198gameplayLayoutTestCases.forEach(testCase => {
199	module.exports.TEST_CASES.push({
200		...testCase,
201		nameAppendix: 'not_started',
202		replicantPrefills: {
203			...STANDARD_REPLICANT_PREFILLS,
204			...testCase.replicantPrefills,
205			gameAudioChannels: [{
206				sd: {muted: false, fadedBelowThreshold: false},
207				hd: {muted: false, fadedBelowThreshold: false}
208			}, {
209				sd: {muted: false, fadedBelowThreshold: false},
210				hd: {muted: false, fadedBelowThreshold: false}
211			}, {
212				sd: {muted: false, fadedBelowThreshold: false},
213				hd: {muted: false, fadedBelowThreshold: false}
214			}, {
215				sd: {muted: false, fadedBelowThreshold: false},
216				hd: {muted: false, fadedBelowThreshold: false}
217			}]
218		}
219	}, {
220		...testCase,
221		nameAppendix: 'running',
222		replicantPrefills: {
223			...STANDARD_REPLICANT_PREFILLS,
224			...testCase.replicantPrefills,
225			stopwatch: {
226				state: 'running',
227				time: {
228					days: 0,
229					hours: 1,
230					minutes: 2,
231					seconds: 3,
232					milliseconds: 400,
233					formatted: '1:02:03.4',
234					raw: 3723400,
235					timestamp: 1526531543450
236				},
237				results: [
238					null,
239					null,
240					null,
241					null
242				]
243			}
244		}
245	}, {
246		...testCase,
247		nameAppendix: 'finished',
248		additionalDelay: FINISHED_DELAY,
249		replicantPrefills: {
250			...STANDARD_REPLICANT_PREFILLS,
251			...testCase.replicantPrefills,
252			stopwatch: {
253				state: 'finished',
254				time: {
255					days: 0,
256					hours: 1,
257					minutes: 2,
258					seconds: 3,
259					milliseconds: 400,
260					formatted: '1:02:03.4',
261					raw: 3723400,
262					timestamp: 1526531543450
263				},
264				results: [{
265					time: {
266						days: 0,
267						hours: 1,
268						minutes: 2,
269						seconds: 3,
270						milliseconds: 400,
271						formatted: '1:02:03.4',
272						raw: 3723400,
273						timestamp: 1526589137479
274					},
275					place: 1,
276					forfeit: false
277				}, {
278					time: {
279						days: 0,
280						hours: 1,
281						minutes: 2,
282						seconds: 3,
283						milliseconds: 400,
284						formatted: '1:02:03.4',
285						raw: 3723400,
286						timestamp: 1526589137479
287					},
288					place: 2,
289					forfeit: true
290				}, {
291					time: {
292						days: 0,
293						hours: 1,
294						minutes: 2,
295						seconds: 3,
296						milliseconds: 400,
297						formatted: '1:02:03.4',
298						raw: 3723400,
299						timestamp: 1526589137479
300					},
301					place: 3,
302					forfeit: false
303				}, {
304					time: {
305						days: 0,
306						hours: 1,
307						minutes: 2,
308						seconds: 3,
309						milliseconds: 400,
310						formatted: '1:02:03.4',
311						raw: 3723400,
312						timestamp: 1526589137479
313					},
314					place: 4,
315					forfeit: false
316				}]
317			}
318		}
319	});
320
321	if (testCase.coopTests) {
322		testCase.coopTests.forEach(numberOfRunners => {
323			module.exports.TEST_CASES.push({
324				...testCase,
325				nameAppendix: `coop_${numberOfRunners}`,
326				replicantPrefills: {
327					...STANDARD_REPLICANT_PREFILLS,
328					...testCase.replicantPrefills,
329					currentRun: {
330						name: 'Pre-Show',
331						longName: 'Pre-Show',
332						console: 'Unknown',
333						commentators: 'Unknown',
334						category: 'Hype',
335						setupTime: '0',
336						order: 1,
337						estimate: '0:32:00',
338						releaseYear: '',
339						runners: [
340							{name: 'SpikeVegeta', stream: 'spikevegeta'},
341							{name: 'Blechy', stream: 'bellery_'},
342							{name: 'Protomagicalgirl', stream: 'protomagicalgirl'},
343							{name: 'JHobz', stream: 'jhobz296'}
344						].slice(0, numberOfRunners),
345						notes: '',
346						coop: true,
347						id: 2640,
348						pk: 2640,
349						type: 'run'
350					}
351				}
352			});
353		});
354	}
355});
356
357// Interview lowerthird tests.
358for (let i = 1; i <= MAX_LOWERTHIRD_NAMES; i++) {
359	module.exports.TEST_CASES.push({
360		route: `bundles/${BUNDLE_NAME}/graphics/interview.html`,
361		nameAppendix: `lowerthird-${i}`,
362		selector: 'gdq-lowerthird',
363		entranceMethodName: 'show',
364		entranceMethodArgs: [[
365			{name: 'one wwwwwWWWWWwwwwwWWWWWwwwwwWWWWW', title: 'one title WWWWWwwwwwWWWWWwwwww'},
366			{name: 'two', title: 'two title'},
367			{name: 'three wwwwwWWWWWwwwwwWWWWWwwwwwWWWWW', title: 'three title WWWWWwwwwwWWWWWwwwww'},
368			{name: 'four', title: ''},
369			{name: 'five wwwwwWWWWWwwwwwWWWWWwwwwwWWWWW', title: 'five title WWWWWwwwwwWWWWWwwwww'}
370		].slice(0, i)],
371		additionalDelay: STANDARD_DELAY
372	});
373}
374
Full Screen

Accelerate Your Automation Test Cycles With LambdaTest

Leverage LambdaTest’s cloud-based platform to execute your automation tests in parallel and trim down your test execution time significantly. Your first 100 automation testing minutes are on us.

Try LambdaTest

Run JavaScript Tests on LambdaTest Cloud Grid

Execute automation tests with Appium on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free
LambdaTestX

We use cookies to give you the best experience. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. Learn More in our Cookies policy, Privacy & Terms of service

Allow Cookie
Sarah

I hope you find the best code examples for your project.

If you want to accelerate automated browser testing, try LambdaTest. Your first 100 automation testing minutes are FREE.

Sarah Elson (Product & Growth Lead)