添加元素信息类
This commit is contained in:
parent
51dde77727
commit
b72b0c1324
34
.classpath
34
.classpath
|
@ -21,6 +21,38 @@
|
|||
<classpathentry kind="con" path="org.testng.TESTNG_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="lib" path="lib/beautyeye_lnf.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path="target/generated-sources/annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" path=".apt_generated">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
|
||||
<attributes>
|
||||
<attribute name="optional" value="true"/>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
<attribute name="ignore_optional_problems" value="true"/>
|
||||
<attribute name="m2e-apt" value="true"/>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
/target/
|
||||
/.apt_generated/
|
||||
/.apt_generated_tests/
|
||||
|
|
|
@ -7,5 +7,6 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
|
|||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
|
||||
org.eclipse.jdt.core.compiler.processAnnotations=enabled
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
8
pom.xml
8
pom.xml
|
@ -152,7 +152,13 @@
|
|||
<version>1.18.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.testng</groupId>
|
||||
<artifactId>testng</artifactId>
|
||||
<version>7.3.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
package pres.auxiliary.tool.file;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import pres.auxiliary.tool.file.excel.ReplactFunction;
|
||||
|
||||
public abstract class AbstractWriteFile {
|
||||
/**
|
||||
* 用于对待替换词语的标记
|
||||
*/
|
||||
protected final String WORD_SIGN = "\\#";
|
||||
|
||||
/**
|
||||
* 用于存储待替换的词语以及被替换的词语
|
||||
*/
|
||||
protected HashMap<String, ReplactFunction> replaceWordMap = new HashMap<>(16);
|
||||
|
||||
/**
|
||||
* 用于设置需要被替换的词语。添加词语时无需添加特殊字符
|
||||
*
|
||||
* @param word 需要替换的词语
|
||||
* @param replactWord 被替换的词语
|
||||
*/
|
||||
public void setReplactWord(String word, String replactWord) {
|
||||
setReplactWord(word, (text) -> {
|
||||
return replactWord;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于根据需要替换的词语,设置需要动态写入到文本的内容。添加词语时无需添加特殊字符
|
||||
* @param word 需要替换的词语
|
||||
* @param replactFunction 替换规则
|
||||
*/
|
||||
public void setReplactWord(String word, ReplactFunction replactFunction) {
|
||||
replaceWordMap.put(word, replactFunction);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于对需要进行替换的特殊词语进行替换
|
||||
* @param contents 文本内容
|
||||
*/
|
||||
protected String[] replaceWord(String[] contents) {
|
||||
// 查找特殊词语,并对词语进行替换
|
||||
for (String word : replaceWordMap.keySet()) {
|
||||
// 查找所有的0内容,并将特殊词语进行替换
|
||||
for (int i = 0; i < contents.length; i++) {
|
||||
String regex = WORD_SIGN + word + WORD_SIGN;
|
||||
contents[i] = contents[i].replaceAll(regex, replaceWordMap.get(word).replact(word));
|
||||
}
|
||||
}
|
||||
|
||||
return contents;
|
||||
}
|
||||
}
|
|
@ -227,7 +227,7 @@ public abstract class AbstractWriteExcel<T extends AbstractWriteExcel<T>> {
|
|||
* @param replactWord 被替换的词语
|
||||
*/
|
||||
public void setReplactWord(String word, String replactWord) {
|
||||
setReplactWord(word, (text) -> {
|
||||
setReplactWord(word, (text) -> {
|
||||
return replactWord;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -205,7 +205,13 @@ public class JsEvent extends AbstractEvent {
|
|||
|
||||
// 执行代码,由于在获取元素信息时已经对元素的过期进行了判断,故此处无需在做判断
|
||||
js.executeScript(script, element.getWebElement());
|
||||
|
||||
|
||||
/*
|
||||
var a = document.getElementById('psd')
|
||||
var aa = a.parentNode
|
||||
aa.removeChild(a)
|
||||
*
|
||||
* */
|
||||
return json;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package pres.auxiliary.work.selenium.xml;
|
||||
|
||||
/**
|
||||
* <p><b>文件名:</b>ElementData.java</p>
|
||||
* <p><b>用途:</b>
|
||||
* 用于存储页面元素的基本信息,以便于在查找中进行使用
|
||||
* </p>
|
||||
* <p><b>编码时间:</b>2020年9月27日上午7:50:44</p>
|
||||
* <p><b>修改时间:</b>2020年9月27日上午7:50:44</p>
|
||||
* @author 彭宇琦
|
||||
* @version Ver1.0
|
||||
*
|
||||
*/
|
||||
public class ElementData {
|
||||
|
||||
}
|
|
@ -3,9 +3,9 @@ package pres.auxiliary.testcase.writecase;
|
|||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.testng.annotations.AfterClass;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import pres.auxiliary.work.old.testcase.change.Tab;
|
||||
import pres.auxiliary.work.old.testcase.templet.ZentaoTemplet;
|
||||
|
@ -20,7 +20,7 @@ public class TestAddInformation {
|
|||
static AddInformation a;
|
||||
|
||||
@BeforeClass
|
||||
public static void createTemplet() throws Exception {
|
||||
public void createTemplet() throws Exception {
|
||||
ZentaoTemplet.setCoverFile(true);
|
||||
ZentaoTemplet.create();
|
||||
|
||||
|
|
|
@ -63,6 +63,7 @@ public class JiraTestCaseWriteTest {
|
|||
@BeforeMethod
|
||||
public void addContent(Method method) {
|
||||
System.out.println("=======正在运行:" + method.getName() + "=======");
|
||||
wtc.switchSheet("测试用例");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,27 +156,4 @@ public class JiraTestCaseWriteTest {
|
|||
dlc.setReplaceWord(DataListCase.DATA_NAME, "用户");
|
||||
wtc.addCase(dlc.appBrowseListCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* 综合测试
|
||||
*/
|
||||
@Test
|
||||
public void synthesizeTest() {
|
||||
wtc.addTitle("测试一个标题")
|
||||
.addModule("企业", "标段现场")
|
||||
.addStep("步骤1", "步骤2")
|
||||
.addExcept("预期1", "预期2")
|
||||
.addStepAndExcept("步骤3", "预期3")
|
||||
.addContent(JiraFieldIdType.CASE_KEY.getName(), "1")
|
||||
.addContent(JiraFieldIdType.COMPONENT.getName(), "4")
|
||||
.addContent(JiraFieldIdType.ISSUES.getName(), "4")
|
||||
.addContent(JiraFieldIdType.OBJECTIVE.getName(), "目的")
|
||||
.addContent(JiraFieldIdType.OWNER.getName(), "彭宇琦")
|
||||
.addContent(JiraFieldIdType.PRECONDITION.getName(), "前置1", "前置2")
|
||||
.addContent(JiraFieldIdType.PRIORITY.getName(), "1")
|
||||
.addContent(JiraFieldIdType.STATUS.getName(), "3")
|
||||
.end()
|
||||
.changeTextColor(JiraFieldIdType.STEP.getName(), 0, MarkColorsType.GREEN)
|
||||
.fieldComment(JiraFieldIdType.FOLDER.getName(), "模块标记");
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,6 +9,6 @@ public class Test123 {
|
|||
System.out.println(ss.split("\\.").length);
|
||||
|
||||
System.out.println("The End");
|
||||
//System.out.println(UUID.randomUUID().toString());
|
||||
//System.out.pri ntln(UUID.randomUUID().toString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue