Skip to content
This repository was archived by the owner on Feb 12, 2019. It is now read-only.

Commit 044c60f

Browse files
authored
Merge pull request #4 from AlexanderMoskovkin/v0.1.1
Fix client side. Bump version.
2 parents e3422ee + 99fe0c6 commit 044c60f

2 files changed

Lines changed: 18 additions & 8 deletions

File tree

lib/client/index.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
'use strict';
22

33
(function () {
4+
function getDriver (callback) {
5+
var interval = window.setInterval(function () {
6+
var testCafeDriver = window['%testCafeDriverInstance%'];
7+
8+
if (testCafeDriver) {
9+
window.clearInterval(interval);
10+
callback(testCafeDriver);
11+
}
12+
}, 50);
13+
}
14+
415
// NOTE: enable interaction with a page when the last test is completed
5-
window.setTimeout(function () {
6-
const UNLOCK_PAGE_FLAG = 'testcafe-live|driver|unlock-page-flag';
16+
var UNLOCK_PAGE_FLAG = 'testcafe-live|driver|unlock-page-flag';
717

8-
// TestCafe > 0.18.5 required
9-
const testCafeDriver = window['%testCafeDriverInstance%'];
10-
const testCafeCore = window['%testCafeCore%'];
11-
const hammerhead = window['%hammerhead%'];
18+
// TestCafe > 0.18.5 required
19+
getDriver(function (testCafeDriver) {
20+
var testCafeCore = window['%testCafeCore%'];
21+
var hammerhead = window['%hammerhead%'];
1222

1323
testCafeDriver.setCustomCommandHandlers('unlock-page', function () {
1424
testCafeCore.disableRealEventsPreventing();
@@ -18,7 +28,7 @@
1828
return hammerhead.Promise.resolve();
1929
});
2030

21-
const chain = testCafeDriver.contextStorage ? hammerhead.Promise.resolve() : testCafeDriver.readyPromise;
31+
var chain = testCafeDriver.contextStorage ? hammerhead.Promise.resolve() : testCafeDriver.readyPromise;
2232

2333
chain.then(function () {
2434
if (testCafeDriver.contextStorage.getItem(UNLOCK_PAGE_FLAG))

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "testcafe-live",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "A watcher utility for TestCafe. Watches for changes in test files and automatically runs tests when these changes occur.",
55
"main": "lib/index.js",
66
"bin": {

0 commit comments

Comments
 (0)