1 Star 0 Fork 9

Jack Chen/TestWeb

forked from lichao/TestWeb 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.js 2.65 KB
一键复制 编辑 原始数据 按行查看 历史
/*!
OC_webtest v0.0.1
Copyright 2014 OrChange Inc. All rights reserved.
Licensed under the GPL License.
*/
script = {
"MAIN" : false,
"EDIT" : false,
"TEST" : false,
"DEBUG": false,
};
/**=====================
* GLOBAL DEFINE!
*=====================*/
var config = {
// Set loop times that you want in default.
"DEFAULT_LOOP_COUNT" : 2000,
// User can define to use this delay.
// When new DelayStep.
"DEFAULT_DELAY" : 4000,
// Do you need output error to console?
"DEBUG_MODE" : true,
// This setting just affect delay model.
"DELAY_RATIO" : 1.0,
// Enable / Disable the mode of ratio of delay.
"DELAY_RATIO_MODE" : false,
// If the value is true, script will overriding
// function alert() in the iframe.window object.
"DISABLE_ALERT" : false,
"EVENT_TEST_CYCLE" : 50,
"EVENT_TIMEOUT":10000,
// If use focus "stepby" mode, all method of
// step will be lose efficacy.
"FOCUS_STEPBY" : false,
// How long will the highlight div disappeared.
"HIGHLIGHT_REMOVE_DELAY" : 2000,
// You can use a new name of the jQuery object
// whitch include the iframe element.
"IFRAME_HANDLE" : "$iframe",
// Highlight the DOM of operation when doing
// test.
"SHOW_AREA_MODE" : false,
// Define the title of probe.html
"TITLE" : "PROBE",
// Define the url of Test Management Server.
"TEST_SERVER" : "http://localhost/testweb/",
"TEST_SCRIPT_PATH" : "http://localhost/testweb/",
};
/**=====================
* RUNTIME
*=====================*/
$(document).ready(function(){
// PROBE initialization
$("head").html("<title>"+config.TITLE+"</title>");
$("html").css({
"padding":"0px",
"margin":"0px",
"height":"100%",
});
$("body").html('<iframe></iframe><a id="StepTrigger"></a>').css({
"padding":"0px",
"margin":"0px",
"height":"100%",
"overflow":"hidden",
});
$("iframe").attr("height","100%").css({
"margin":"0",
"padding":"0",
"border":"none",
"width":"100%",
});
$("#StepTrigger").css({
"display" : "block",
"width" : "20px",
"height" : "20px",
"position" : "fixed",
"bottom" : "0px",
"right" : "0px",
"background" : "green"
});
// Get jQuery object of the iframe.
window[config.IFRAME_HANDLE] = $('iframe');
$.getScript( config.TEST_SERVER+'test.js',function(){
if( config.DEBUG_MODE === true ){
$.getScript( config.TEST_SERVER+'debug.js');
}
});
// Overriding iframe.alert() if DISABLE_ALERT
// is true.
if( config.DISABLE_ALERT ){
//TODO test it !
$('iframe').load(function(){
this.contentWindow.alert = function(str){
console.log(str);
}
});
}
$iframe.attr("src","http://www.or-change.com.cn/Task/");
});
// Mark main.js have been loaded successfully.
script.MAIN = true;
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/unverssky/TestWeb.git
git@gitee.com:unverssky/TestWeb.git
unverssky
TestWeb
TestWeb
master

搜索帮助