Comparing version 1.2.0 to 1.2.1
{ | ||
"name": "lc2", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "browser automation library", | ||
@@ -8,3 +8,3 @@ "main": "index.js", | ||
"test": "ava", | ||
"dev": "webpack-dev-server", | ||
"dev": "webpack-dev-server --host 0.0.0.0 --port 3001", | ||
"build": "webpack && webpack -p --output-filename lemoncase.min.js" | ||
@@ -11,0 +11,0 @@ }, |
@@ -106,3 +106,3 @@ /*jslint vars: true, sloppy: true, nomen: true */ | ||
if (typeof expFn === 'function') { | ||
return expFn(this.vars, this.$objectList, this.$loopData, | ||
return expFn(this.$$vars, this.$objectList, this.$loopData, | ||
_.countDOM, _.getInnerHTML, _.isVisible); | ||
@@ -109,0 +109,0 @@ } |
@@ -73,3 +73,3 @@ /*jslint plusplus: true, sloppy: true, nomen: true */ | ||
// stacks | ||
this.vars = {}; | ||
this.$$vars = {}; | ||
this.$$blockStack = []; // {counter, segment} | ||
@@ -79,2 +79,3 @@ this.$$scopeStack = []; // {blockIndex, vars} | ||
// buffer | ||
this.$$lastInstruction = undefined; | ||
this.$$instructionBuffer = undefined; | ||
@@ -131,2 +132,4 @@ this.$$tempInstruction = undefined; | ||
this.$$lastInstruction = this.$$instructionBuffer; | ||
if (tmpIns) { | ||
@@ -146,6 +149,5 @@ this.$setTempInstruction(); | ||
this.$$popInstruction().execute(); | ||
settings.runCallback.call(this); | ||
} catch (error) { | ||
console.error('[Error FROM LC2]:' + error); | ||
settings.runExceptionHandle.call(this, error); | ||
settings.runCallback(this); | ||
} catch (e) { | ||
console.error('[Error FROM LC2 Core]:' + e); | ||
} | ||
@@ -152,0 +154,0 @@ return this; |
@@ -67,3 +67,4 @@ /*jslint vars: true, sloppy: true, nomen: true */ | ||
} | ||
//TODO 它不存在就不应该有任何输出 | ||
//TODO 它不存在就不应该有任何输出,抽象一个match函数降低生成工厂压力 | ||
// 输入字符串为null时直接返回false | ||
return 'Error:No such HTMLElement.'; | ||
@@ -77,3 +78,3 @@ }, | ||
return (DOM.offsetHeight === 0 && DOM.offsetWidth === 0 ) ? false : true; | ||
return (DOM.offsetHeight === 0 && DOM.offsetWidth === 0) ? false : true; | ||
} | ||
@@ -90,3 +91,5 @@ }; | ||
runCallback: _.noop, | ||
runExceptionHandle: _.noop, | ||
runExceptionHandle: function () { | ||
console.log(arguments); | ||
}, | ||
successCallback: _.noop, | ||
@@ -93,0 +96,0 @@ readyCallback: _.noop, |
@@ -27,3 +27,3 @@ /*jslint sloppy: true, nomen: true */ | ||
PASSED = 1, | ||
FAILURE = 0 | ||
FAILURE = 0, | ||
@@ -61,2 +61,8 @@ trigger = require('oc-trigger'); | ||
this.body('preFn')(); | ||
if (!flag) { | ||
settings.runExceptionHandle(this.$case); | ||
} | ||
CASE.$pushLog([EXIT, flag], this.line()) | ||
@@ -67,5 +73,6 @@ .$markLog(flag, CASE.getCurrentLoop()) | ||
}, | ||
bodyFactory: function (isSuccess) { | ||
bodyFactory: function (isSuccess, preFn) { | ||
return { | ||
isSuccess: isSuccess | ||
isSuccess: isSuccess, | ||
preFn: preFn || _.noop | ||
}; | ||
@@ -101,10 +108,15 @@ } | ||
operation: function Trigger() { | ||
var cssPath = this.$case.$runExp(this.body('object')), | ||
var DOM, cssPath = this.$case.$runExp(this.body('object')), | ||
param = { | ||
value: this.$case.$runExp(this.body('param')) | ||
}, | ||
action = this.body('action'), | ||
action = this.body('action'); | ||
try { | ||
DOM = _.document().querySelectorAll(cssPath)[0]; | ||
if (!DOM) { | ||
if (!DOM) { | ||
throw 'Can not find a DOM by cssPath: ' + cssPath; | ||
} | ||
} catch (msg) { | ||
console.log(msg); | ||
this.$case | ||
@@ -114,3 +126,2 @@ .$pushLog([TRIGGER, FAILURE, cssPath, action, param], this.line()) | ||
console.log('Can not find a DOM by cssPath: ' + cssPath); | ||
return; | ||
@@ -120,3 +131,3 @@ } | ||
trigger(DOM).does(action, param); | ||
settings.triggerCallback.call(this.$case, DOM); | ||
settings.triggerCallback(DOM, this.$case); | ||
@@ -156,3 +167,5 @@ this.$case | ||
CASE.$setTempInstruction(IF(EXIT).create(false).assignCase(CASE)); | ||
CASE.$setTempInstruction(IF(EXIT).create(false, function () { | ||
CASE.$pushLog([ASSERT, FAILURE], ins.line()); | ||
}).assignCase(CASE)); | ||
@@ -176,4 +189,2 @@ if (timeout && timeout > 2 * settings.defaultClock) { | ||
} | ||
} else if (!timeout) { | ||
CASE.$pushLog([ASSERT, FAILURE], this.line()); | ||
} | ||
@@ -180,0 +191,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242493
6196