1.修改关键字 2.增加新InsertScriptsCase替换原Insert_Scripts_Case文件 3.添加新测试文件
This commit is contained in:
88
01-TestCase/tsg_ui/ui_settings/InsertScriptCase.robot
Normal file
88
01-TestCase/tsg_ui/ui_settings/InsertScriptCase.robot
Normal file
@@ -0,0 +1,88 @@
|
||||
*** Settings ***
|
||||
Force Tags tsg-ui settings insert_scripts
|
||||
Resource ../../../03-Variable/bifangapivariable.txt
|
||||
Library OperatingSystem
|
||||
Resource ../../../02-Keyword/tsg_ui/setting/Settings.robot
|
||||
|
||||
*** Test Cases ***
|
||||
CreateInsertScriptsTypeCss
|
||||
[Tags] PositiveTestCase css Settings InsertScript
|
||||
CreateInsertScripts lyf-test-001-css ${path}insert_files\\Create-Insert Scripts-test.css css name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
CreateInsertScriptsTypeJs
|
||||
[Tags] PositiveTestCase js Settings InsertScript
|
||||
CreateInsertScripts lyf-test-002-js ${path}insert_files\\Create-Insert_Scripts-test.js js name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
CreateInsertScriptsTypeCssNameMinSize
|
||||
[Tags] PositiveTestCase css Settings InsertScript
|
||||
CreateInsertScripts 1 ${path}insert_files\\Create-Insert Scripts-test.css css name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
CreateInsertScriptsTypeCssNameMaxSize
|
||||
[Tags] PositiveTestCase css Settings InsertScript
|
||||
CreateInsertScripts CreateInsertScriptsTypeCssNameMaxSizeCreateInsertScriptsTypeCssNameMaxSizeCreateInsertScriptsTypeCssNameMaxSizeCreateInsertScrip ${path}insert_files\\Create-Insert Scripts-test.css css name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
CreateInsertScriptsTypeJsNameMinSize
|
||||
[Tags] PositiveTestCase js Settings InsertScript
|
||||
CreateInsertScripts 1 ${path}insert_files\\Create-Insert_Scripts-test.js js name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
CreateInsertScriptsTypeJsNameMaxSize
|
||||
[Tags] PositiveTestCase js Settings InsertScript
|
||||
CreateInsertScripts CreateInsertScriptsTypeCssNameMaxSizeCreateInsertScriptsTypeCssNameMaxSizeCreateInsertScriptsTypeCssNameMaxSizeCreateInsertScrip ${path}insert_files\\Create-Insert_Scripts-test.js js name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
CreateInsertScriptsTypeJsAfterLoadInsertOn
|
||||
[Tags] PositiveTestCase js Settings InsertScript
|
||||
CreateInsertScripts CreateInsertScriptsTypeJsAfterLoadInsertOn-test ${path}insert_files\\Create-Insert_Scripts-test.js js name jstype=After Page Load
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
EditInsertScriptsTypeCssSearchId
|
||||
[Tags] PositiveTestCase css Settings InsertScript
|
||||
CreateInsertScripts lyf-test-001-css ${path}insert_files\\Create-Insert Scripts-test.css css name
|
||||
${id} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[1]/div/div/span
|
||||
EditInsertScripts ${id} lyf-Edit-test-001 ${path}insert_files\\Create-Insert Scripts-test.css css id
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
EditInsertScriptsTypeJsSearchName
|
||||
[Tags] PositiveTestCase js Settings InsertScript
|
||||
CreateInsertScripts 1 ${path}insert_files\\Create-Insert Scripts-test.css css name
|
||||
${name} get text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
EditInsertScripts ${name} lyf-Edit-test-008 ${path}insert_files\\Create-Insert_Scripts-test.js js name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
CreateInsertScriptSpecialFileName
|
||||
[Tags] PositiveTestCase css Settings InsertScript
|
||||
CreateInsertScripts CreateInsertScriptsSpecialFileName ${path}insert_files\\ВставкаСкриптов!@#$%^&(-+=‘;。,?.css css name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
InsertScriptsUpload20MFile
|
||||
[Tags] PositiveTestCase css Settings InsertScript
|
||||
CreateInsertScripts InsertScriptsUpload20MFile ${path}insert_files\\20MFile.css css name
|
||||
click xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span
|
||||
Delete
|
||||
|
||||
InsertScriptsUploadNullFile
|
||||
[Tags] NegtivetestCase css Settings InsertScript
|
||||
UploadFilesSize InsertScripts InsertScriptsUploadNullFile ${path}insert_files\\null.css Please choose to upload files
|
||||
|
||||
InsertScriptsUploadExceed20MFile
|
||||
[Tags] NegtivetestCase css Settings InsertScript
|
||||
UploadFilesSize InsertScripts InsertScriptsUploadNullFile ${path}insert_files\\Exceed20MFile.css File Maximum Limitation 100KB
|
||||
|
||||
InsertScriptsFileTypeDoesNotMatch
|
||||
[Tags] NegtivetestCase css Settings InsertScript
|
||||
UploadFilesSize InsertScripts InsertScriptsFileTypeDoesNotMatch ${path}insert_files\\Create-Insert_Scripts-test.js File upload failed.
|
||||
@@ -65,12 +65,12 @@ CreateResponsePagesSpecialFileName
|
||||
|
||||
ResponsePageUploadNullFile
|
||||
[Tags] NegtivetestCase html Settings ResponsePages
|
||||
UploadFilesSize ResponsePages ResponsePageUploadfile ${path}response_pages_files\\null.html
|
||||
${text} get text xpath=//*[@id="policy_Manipulation_create6"]/div[1]
|
||||
Should Be Equal As Strings ${text} Create Response Page
|
||||
UploadFilesSize ResponsePages ResponsePageUploadfile ${path}response_pages_files\\null.html Please choose to upload files
|
||||
|
||||
ResponsePageUploadExceed20MFile
|
||||
[Tags] NegtivetestCase html Settings ResponsePages
|
||||
UploadFilesSize ResponsePages ResponsePageUploadExceed20MFile ${path}response_pages_files\\Exceed20MFile.html
|
||||
${text} get text xpath=//*[@id="policy_Manipulation_create6"]/div[1]
|
||||
Should Be Equal As Strings ${text} Create Response Page
|
||||
UploadFilesSize ResponsePages ResponsePageUploadExceed20MFile ${path}response_pages_files\\Exceed20MFile.html File Maximum Limitation 20MB
|
||||
|
||||
ResponsePagesFileTypeDoesNotMatch
|
||||
[Tags] NegtivetestCase html Settings ResponsePages
|
||||
UploadFilesSize ResponsePages ResponsePagesFileTypeDoesNotMatch ${path}insert_files\\Create-Insert Scripts-test.css "html" and "htm" only
|
||||
@@ -437,7 +437,7 @@ Create-Hijack Files
|
||||
${text1} Get Text xpath=//*[@id="ly-table1-listcontent"]/div/div[3]/table/tbody/tr/td[2]/div/span #获取点击后页面文本信息
|
||||
Should Be Equal As Strings ${text1} ${name} #断言
|
||||
|
||||
Create-Insert Scripts
|
||||
CreateInsertScripts
|
||||
[Arguments] ${name} ${file} ${type} ${search} ${jstype}=Before Page Load
|
||||
Sleep 1
|
||||
click id=children6 #点击一级目录Settings
|
||||
@@ -498,7 +498,7 @@ Create-Traffic Mirror Profiles
|
||||
${text1} Get Text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div[1]/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span #获取点击后页面文本信息
|
||||
Should Be Equal As Strings ${text1} ${name} #断言
|
||||
|
||||
Edit-Insert Scripts
|
||||
EditInsertScripts
|
||||
[Arguments] ${id-name} ${name1} ${file} ${type} ${search} ${jstype}=Before Page Load
|
||||
[Documentation] 引用关键字,填入必填参数
|
||||
... 必填参数:
|
||||
@@ -536,6 +536,14 @@ Edit-Insert Scripts
|
||||
... AND click //span[.="${jstype}"]
|
||||
sleep 1
|
||||
click id=insertAddOk1 #点击ok提交
|
||||
run keyword if "${search}"=="id" run keywords sleep 1
|
||||
... AND Settings-Search ${id-name} ${search} #搜索框的关键字
|
||||
... ELSE IF "${search}"=="name" run keywords sleep 1
|
||||
... AND Settings-Search ${name1} ${search} #搜索框的关键字
|
||||
Sleep 1
|
||||
${text1} Get Text xpath=//*[@id="app"]/div/div[3]/div[2]/div/div[3]/div/div/div[2]/div/div[3]/table/tbody/tr[1]/td[2]/div/div/span #获取点击后页面文本信息
|
||||
Should Be Equal As Strings ${text1} ${name1} #断言
|
||||
|
||||
|
||||
CreateResponsePages
|
||||
[Arguments] ${name} ${file} ${search}
|
||||
@@ -1740,7 +1748,13 @@ Policy_Verify_Switch
|
||||
sleep 1
|
||||
|
||||
UploadFilesSize
|
||||
[Arguments] ${Page} ${name} ${file}
|
||||
[Arguments] ${Page} ${name} ${file} ${Promptinfor}
|
||||
[Documentation]
|
||||
... 必填参数:
|
||||
... ${Page}:测试页面Name包括ResponsePages、InsertScripts、HijackFiles
|
||||
... ${name}:新建页面name输入框里的内容
|
||||
... ${file}:上传文件本地
|
||||
... ${Promptinfor}:页面提示信息
|
||||
run keyword if "${Page}"=="ResponsePages" run keywords sleep 1
|
||||
... AND click id=children6 #点击一级目录Settings
|
||||
... AND Sleep 1
|
||||
@@ -1753,7 +1767,7 @@ UploadFilesSize
|
||||
... AND Choose File xpath=//*[@id="policy_Manipulation_create6"]/div[2]/form/div[2]/div/div/div/input ${file} #上传文件
|
||||
... AND Sleep 2
|
||||
... AND click id=responseAddOk1 #点击OK缇交
|
||||
... AND sleep 3
|
||||
... AND sleep 2
|
||||
run keyword if "${Page}"=="InsertScripts" run keywords sleep 1
|
||||
... AND click id=children6 #点击一级目录Settings
|
||||
... AND Sleep 1
|
||||
@@ -1772,6 +1786,7 @@ UploadFilesSize
|
||||
... AND click //span[.="css"] #选择css
|
||||
... AND sleep 1
|
||||
... AND click id=insertAddOk1 #点击OK
|
||||
... AND sleep 2
|
||||
run keyword if "${Page}"=="HijackFiles" run keywords sleep 1
|
||||
... AND click id=children6 #点击一级目录Settings
|
||||
... AND Sleep 1
|
||||
@@ -1790,4 +1805,6 @@ UploadFilesSize
|
||||
... AND Sleep 1
|
||||
... AND click ${type} #选择文件类型
|
||||
... AND sleep 2
|
||||
... AND click id=hijackAddOk1 #点击OK
|
||||
... AND click id=hijackAddOk1 #点击OK
|
||||
${text} get text xpath=/html/body/div/p
|
||||
Should Be Equal As Strings ${text} ${Promptinfor}
|
||||
501
05-Other/insert_files/20MFile.css
Normal file
501
05-Other/insert_files/20MFile.css
Normal file
File diff suppressed because one or more lines are too long
513
05-Other/insert_files/Exceed20MFile.css
Normal file
513
05-Other/insert_files/Exceed20MFile.css
Normal file
File diff suppressed because one or more lines are too long
0
05-Other/insert_files/null.css
Normal file
0
05-Other/insert_files/null.css
Normal file
185
05-Other/insert_files/ВставкаСкриптов!@#$%^&(-+=‘;。,?.css
Normal file
185
05-Other/insert_files/ВставкаСкриптов!@#$%^&(-+=‘;。,?.css
Normal file
@@ -0,0 +1,185 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>新建网页</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="keywords" content=""/>
|
||||
|
||||
<script type="text/javascript">
|
||||
//① 绘制地图
|
||||
function Map() {
|
||||
//私有成员(不会随便发生变化)
|
||||
var w = 800;
|
||||
var h = 400;
|
||||
|
||||
//成员方法,绘制地图
|
||||
this.showmap = function () {
|
||||
//创建div、设置css样式、追加给body
|
||||
var tu = document.createElement('div');
|
||||
|
||||
tu.style.width = w + "px";
|
||||
tu.style.height = h + "px";
|
||||
tu.style.backgroundImage = "url(./12.jpg)";
|
||||
|
||||
document.body.appendChild(tu);
|
||||
}
|
||||
}
|
||||
|
||||
//② 绘制食物
|
||||
function Food() {
|
||||
var len = 20;
|
||||
//把食物(权值)坐标声明为公开的,以便在外部访问
|
||||
this.xFood = 0;
|
||||
this.yFood = 0;
|
||||
this.piece = null; //页面上唯一的食物对象
|
||||
//绘制
|
||||
this.showfood = function () {
|
||||
//创建div、设置css样式、追加给body
|
||||
if (this.piece === null) {
|
||||
this.piece = document.createElement('div');
|
||||
this.piece.style.width = this.piece.style.height = len + "px";
|
||||
this.piece.style.backgroundColor = "green";
|
||||
this.piece.style.position = "absolute";
|
||||
|
||||
document.body.appendChild(this.piece);
|
||||
}
|
||||
//食物设置绝对定位(position/left/top)
|
||||
//食物位置“随机”摆放
|
||||
//移动步进值:20px
|
||||
//食物“权值”坐标: X轴(0-39) Y轴(0-19)
|
||||
//食物真实坐标:权值坐标 * 步进值
|
||||
this.xFood = Math.floor(Math.random() * 40); //0-39的随机数
|
||||
this.yFood = Math.floor(Math.random() * 20); //0-19的随机数
|
||||
|
||||
this.piece.style.left = this.xFood * len + "px";
|
||||
this.piece.style.top = this.yFood * len + "px";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//③ 小蛇
|
||||
function Snake() {
|
||||
var len = 20;
|
||||
this.redirect = "right"; //默认向右边移动
|
||||
//后期snakebody要变化,因此声明为公开的(每个蛇节:[x坐标,y坐标,颜色,蛇节对象])
|
||||
this.snakebody = [[0, 1, 'green', null], [1, 1, 'green', null], [2, 1, 'green', null], [3, 1, 'red', null]];
|
||||
//a.绘制小蛇
|
||||
this.showsnake = function () {
|
||||
//遍历小蛇的各个蛇节,并依次创建即可
|
||||
for (var i = 0; i < this.snakebody.length; i++) {
|
||||
//this.snakebody[i]//代表每个蛇节
|
||||
//创建蛇节div
|
||||
if (this.snakebody[i][3] === null) {//判断没有创建对应的蛇节
|
||||
this.snakebody[i][3] = document.createElement('div');
|
||||
//设置css样式(宽度、高度、颜色)
|
||||
this.snakebody[i][3].style.width = this.snakebody[i][3].style.height = len + "px";
|
||||
this.snakebody[i][3].style.backgroundColor = this.snakebody[i][2];
|
||||
//绝对定位及位置
|
||||
this.snakebody[i][3].style.position = "absolute";
|
||||
//把蛇节追加给body
|
||||
document.body.appendChild(this.snakebody[i][3]);
|
||||
}
|
||||
this.snakebody[i][3].style.left = this.snakebody[i][0] * len + "px";
|
||||
this.snakebody[i][3].style.top = this.snakebody[i][1] * len + "px";
|
||||
}
|
||||
}
|
||||
|
||||
//b.移动小蛇
|
||||
this.movesnake = function () {
|
||||
//非蛇头蛇节(当前蛇节的新坐标 是"下个蛇节"的旧坐标)
|
||||
for (var i = 0; i < this.snakebody.length - 1; i++) {
|
||||
this.snakebody[i][0] = this.snakebody[i + 1][0];
|
||||
this.snakebody[i][1] = this.snakebody[i + 1][1];
|
||||
}
|
||||
if (this.redirect == "right") {
|
||||
//蛇头x坐标递增
|
||||
this.snakebody[this.snakebody.length - 1][0] += 1;
|
||||
}
|
||||
if (this.redirect == "left") {
|
||||
//蛇头x坐标递减
|
||||
this.snakebody[this.snakebody.length - 1][0] -= 1;
|
||||
}
|
||||
if (this.redirect == "up") {
|
||||
//蛇头y坐标递减
|
||||
this.snakebody[this.snakebody.length - 1][1] -= 1;
|
||||
}
|
||||
if (this.redirect == "down") {
|
||||
//蛇头y坐标递增
|
||||
this.snakebody[this.snakebody.length - 1][1] += 1;
|
||||
}
|
||||
|
||||
//判断蛇头碰到食物
|
||||
//蛇头坐标
|
||||
var xSnake = this.snakebody[this.snakebody.length - 1][0];
|
||||
var ySnake = this.snakebody[this.snakebody.length - 1][1];
|
||||
//食物坐标food.xFood/food.yFood;
|
||||
if (xSnake == food.xFood && ySnake == food.yFood) {
|
||||
//吃食物增加蛇节
|
||||
var newjie = [this.snakebody[0][0], this.snakebody[0][1], 'green', null];
|
||||
this.snakebody.unshift(newjie);//把newjie放到数组的第一个位置去
|
||||
|
||||
//原食物消失,重新生成一个食物
|
||||
food.showfood();
|
||||
}
|
||||
|
||||
//控制小蛇在地图范围内移动
|
||||
if (xSnake < 0 || xSnake > 39 || ySnake < 0 || ySnake > 19) {
|
||||
alert('game over');
|
||||
clearInterval(mytime);
|
||||
return false;
|
||||
}
|
||||
//吃到自己判断(蛇头坐标与其他蛇节坐标一致)
|
||||
for (var k = 0; k < this.snakebody.length - 1; k++) {
|
||||
if (this.snakebody[k][0] == xSnake && this.snakebody[k][1] == ySnake) {
|
||||
alert('game over kill you by yourself');
|
||||
clearInterval(mytime);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//根据新坐标绘制小蛇
|
||||
this.showsnake();
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = function () {
|
||||
var map = new Map();
|
||||
map.showmap();
|
||||
|
||||
food = new Food();//声明为全局的以便在该加载事件函数外部访问
|
||||
food.showfood();
|
||||
|
||||
snake = new Snake();//声明为全局的snake对象
|
||||
snake.showsnake();
|
||||
|
||||
//移动小蛇
|
||||
//setInterval(全局变量,时间)
|
||||
mytime = setInterval("snake.movesnake()", 200);
|
||||
|
||||
//设置键盘事件,控制器小蛇移动方向
|
||||
document.onkeydown = function (evt) {
|
||||
var num = evt.keyCode;//通过事件对象获得数值码,进而知道被触发键子
|
||||
if (num == 38) {
|
||||
snake.redirect = "up";
|
||||
}
|
||||
if (num == 40) {
|
||||
snake.redirect = "down";
|
||||
}
|
||||
if (num == 37) {
|
||||
snake.redirect = "left";
|
||||
}
|
||||
if (num == 39) {
|
||||
snake.redirect = "right";
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<!--
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
</style> -->
|
||||
</head>
|
||||
<body></body>
|
||||
</html>
|
||||
0
05-Other/response_pages_files/null.html
Normal file
0
05-Other/response_pages_files/null.html
Normal file
Reference in New Issue
Block a user