Commit 838a8369 authored by 别湘灵's avatar 别湘灵

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	.idea/compiler.xml
#	src/test/java/com/kjj/config/BasicConfig.java
#	src/test/liveTestNG.xml
parents 06420dbc dd82d44a
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
\ No newline at end of file
# Default ignored files
/workspace.xml
\ No newline at end of file
kjj
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Gradle Imported" enabled="true">
<outputRelativeToContentRoot value="true" />
<processorPath useClasspath="false">
<entry name="$USER_HOME$/Applications/gradle-6.6.1/caches/modules-2/files-2.1/org.projectlombok/lombok/1.18.12/48e4e5d60309ebd833bc528dcf77668eab3cd72c/lombok-1.18.12.jar" />
</processorPath>
<module name="kjj.main" />
<module name="kjj.test" />
</profile>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="kjj" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel target="1.8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="delegatedBuild" value="true" />
<option name="testRunner" value="PLATFORM" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="http://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="http://repo.spring.io/plugins-release" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenLocal" />
<option name="name" value="MavenLocal" />
<option name="url" value="file:$MAVEN_REPOSITORY$/" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="http://nexus.dui88.com:8081/nexus/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://plugins.gradle.org/m2/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
......@@ -90,26 +90,24 @@ public class Boss {
Assert.assertNotNull(visitorName,network.message(USER_INFO,"获取sellerName失败",response.body().asString()));
}*/
//邀请结果判断
@Test(description="邀请结果",priority = 7)
public void 邀请结果() throws IOException{
Map<String, Object> params = new HashMap<String, Object>();
params.put("inviterSid",sellerId);
params.put("inviteType",2);
network.agentCookies.put("tku",VISITOR_TKU);
Response response = network.getResponse(params,BOSS_BOUND);
boolean data =true;// response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败
Assert.assertTrue(data, network.message(params,BOSS_BOUND,"接受邀请失败",response.body().asString()));
//获取被邀请人上级昵称
Map<String, Object> inviteparams = new HashMap<String, Object>();
params.put("sellerId",vistorId);
Response responses = network.getResponse(inviteparams,BOSS_BOSS);
String name = responses.jsonPath().getString("data");
Assert.assertEquals(name,sellerName,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
}
// //邀请结果判断
// @Test(description="邀请结果",priority = 7)
// public void 邀请结果() throws IOException{
// Map<String, Object> params = new HashMap<String, Object>();
// params.put("inviterSid",sellerId);
// params.put("inviteType",2);
// network.agentCookies.put("tku",VISITOR_TKU);
// Response response = network.getResponse(params,BOSS_BOUND);
// boolean data =true;// response.jsonPath().getBoolean("data"); //1 true:邀请成功;2 false:邀请失败
// Assert.assertTrue(data, network.message(params,BOSS_BOUND,"接受邀请失败",response.body().asString()));
// //获取被邀请人上级昵称
// Map<String, Object> inviteparams = new HashMap<String, Object>();
// params.put("sellerId",vistorId);
// Response responses = network.getResponse(inviteparams,BOSS_BOSS);
// String name = responses.jsonPath().getString("data");
// Assert.assertEquals(name,sellerName,network.message(params,BOSS_BOSS,"昵称不匹配",response.body().asString()));
// }
//重新获取列表,代理人有无上下级判断;
@Test(description="当前代理人角色二次判断",priority = 8)
......
......@@ -48,12 +48,13 @@ public class SellerCard {
Assert.assertEquals(userVersion, 2, network.message(params, VERSION_INFO,"会员类型版本判断:判断错误,此版本为通用版",response.body().asString()));
}
@Test(description = "是否关注红号", priority = 2) //priorty 方法执行优先级
public void 是否关注红号() throws IOException {
Response response = network.getResponse(ISVIPSUBSCRIBE);
boolean vipSubscribe = response.jsonPath().getBoolean("data.vipSubscribe");
Assert.assertFalse(false, network.message(ISVIPSUBSCRIBE,"vip号是否关注判断错误",response.body().asString()));
}
// @Test(description = "是否关注红号", priority = 2) //priorty 方法执行优先级
// public void 是否关注红号() throws IOException {
// Response response = network.getResponse(ISVIPSUBSCRIBE);
// boolean vipSubscribe = response.jsonPath().getBoolean("data.vipSubscribe");
// System.out.println(vipSubscribe);
// Assert.assertFalse(false, network.message(ISVIPSUBSCRIBE,"vip号是否关注判断错误",response.body().asString()));
// }
@Test(description = "头部展示", priority = 3)
......
......@@ -20,12 +20,12 @@ public class Upload {
System.out.println();
}
@Test(description="会员判断",priority = 1)
public void 会员判断() throws IOException{
Response response = network.getResponse(ISVIPSUBSCRIBE);
boolean isVip = response.jsonPath().getBoolean("data.vip");
Assert.assertTrue(true, network.message(ISVIPSUBSCRIBE,"会员判断错误",response.body().asString()));
}
// @Test(description="会员判断",priority = 1)
// public void 会员判断() throws IOException{
// Response response = network.getResponse(ISVIPSUBSCRIBE);
// boolean isVip = response.jsonPath().getBoolean("data.vip");
// Assert.assertTrue(true, network.message(ISVIPSUBSCRIBE,"会员判断错误",response.body().asString()));
// }
@Test(description = "上传_文章链接",priority = 2)
public void 上传_文章链接() throws IOException {
......
......@@ -20,7 +20,7 @@ public class CloseLive implements AdminAuthorization{
@Test(description = "结束直播", priority = 1)
public void closeLive() {
public void 结束直播() {
Map<String, Object> closeParam = new HashMap<>();
closeParam.put("liveid", LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey()));
closeParam.put("cid", 90);
......
This diff is collapsed.
......@@ -3,9 +3,7 @@ package com.kjj.cases.live;
import com.kjj.utils.NetworkUtils;
/**
* 管理员后台授权
* @author zhanghuifeng
* date 2021/2/20-13:46
* 管理员小程序授权
*/
public interface MngAuthorization {
......
......@@ -6,6 +6,7 @@ import com.kjj.bean.RewardPkBean;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.utils.BaseUtils;
import com.kjj.utils.IdMakeUtil;
import io.restassured.response.Response;
import org.apache.commons.lang3.time.DateUtils;
import org.testng.Assert;
......@@ -15,6 +16,7 @@ import java.util.*;
public class SaveAndUpdate implements AdminAuthorization {
public String liveID;
public String EncodeLiveID;
@Test(description = "创建直播", priority = 1)
public void 创建直播() {
......@@ -31,7 +33,6 @@ public class SaveAndUpdate implements AdminAuthorization {
saveAndUpdateParam.put("companyId", 101);
saveAndUpdateParam.put("agentInviteAuthType", 1);
saveAndUpdateParam.put("agentInviteAuthLimitNum", 1);
long noticeTime = DateUtils.addHours(new Date(), 2).getTime();
long broadcastTime = DateUtils.addHours(new Date(), 5).getTime();
saveAndUpdateParam.put("noticeTime", noticeTime);
......@@ -42,8 +43,10 @@ public class SaveAndUpdate implements AdminAuthorization {
Response response = network.postResponse(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE);
liveID = response.jsonPath().getString("data");
EncodeLiveID = IdMakeUtil.encodingId(Long.valueOf(liveID));
System.out.println(liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey(),liveID);
LiveConstants.setValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey(),EncodeLiveID);
Assert.assertNotNull(liveID, network.message(saveAndUpdateParam, BasicConfig.MANAGER_SAVEANDUPDATE, "新增直播失败", response.body().asString()));
LiveConstants.getValue(LiveConstants.StringKeyEnum.LIVE_ID.getKey());
......@@ -125,7 +128,7 @@ public class SaveAndUpdate implements AdminAuthorization {
ids2.add(356L);
ids2.add(357L);
ids2.add(358L);
//ids2.add(359L);
ids2.add(359L);
saveOrUpdate3Param.put("ids", ids2);
Response saveOrUpdate3Res = network.postResponse(saveOrUpdate3Param, BasicConfig.MANAGER_SAVEORUPDATE3);
boolean data4 = saveOrUpdate3Res.jsonPath().getBoolean("data");
......
package com.kjj.cases.live;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class User implements AdminAuthorization{
public String shareSign;
@BeforeClass
public void setUp() {
visitorAuth();
agentAuth();
}
//代理人分享直播链接
@Test(description = "分享直播间", priority = 1)
public void 分享直播间() {
Map<String, Object> signParam = new HashMap<>();
signParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
signParam.put("shareType", 1);
Response signRes = network.getResponse(signParam, BasicConfig.MOBILE_GETSHARESIGN);
HashMap data = signRes.jsonPath().getJsonObject("data");
this.shareSign = (String)data.get("shareSign");
System.out.println(shareSign);
Assert.assertNotNull(shareSign, network.message(signParam, BasicConfig.MOBILE_GETSHARESIGN, "分享失败", signRes.body().asString()));
}
//访客与代理人建立绑定关系
@Test(description = "邀请关系绑定", priority = 2)
public void 邀请关系绑定() {
Map<String, Object> bindingParam = new HashMap<>();
bindingParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
bindingParam.put("shareType", shareSign);
Response bindingRes = network.postResponse(bindingParam, BasicConfig.MOBILE_BINDING);
boolean success = bindingRes.jsonPath().getJsonObject("success");
System.out.println(success);
Assert.assertTrue(success, network.message(bindingParam, BasicConfig.MOBILE_BINDING, "绑定失败", bindingRes.body().asString()));
}
@Test(description = "预约直播间", priority = 3)
public void 预约直播间() {
Map<String, Object> sycParam = new HashMap<>();
sycParam.put("bizId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
sycParam.put("bizType", 1);
List<Long> markIds1 = new ArrayList<>();
markIds1.add(142L);
markIds1.add(143L);
markIds1.add(140L);
sycParam.put("markIds", markIds1);
Response sycRes = network.postResponse(sycParam, BasicConfig.USER_SYCAPPOINTMENT);
Object data = sycRes.jsonPath().getJsonObject("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(sycParam, BasicConfig.USER_SYCAPPOINTMENT, "预约失败", sycRes.body().asString()));
}
@Test(description = "关注直播间", priority = 4)
public void 关注直播间() {
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
List<Long> markIds2 = new ArrayList<>();
markIds2.add(146L);
markIds2.add(144L);
subscribeParam.put("markIds", markIds2);
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
@Test(description = "查询关注状态", priority = 5)
public void 查询关注状态() {
Map<String, Object> findParam = new HashMap<>();
findParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response findRes = network.getResponse(findParam, BasicConfig.USER_FIND);
boolean data = findRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(findParam, BasicConfig.USER_FIND, "关注失败", findRes.body().asString()));
}
@Test(description = "保存海报获得抽奖码", priority = 6)
public void 保存海报获得抽奖码() {
Map<String, Object> savePosterParam = new HashMap<>();
savePosterParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response savePosterRes = network.postResponse(savePosterParam, BasicConfig.USER_SAVEPOSTER);
boolean data = savePosterRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(savePosterParam, BasicConfig.USER_SAVEPOSTER, "海报保存失败", savePosterRes.body().asString()));
}
@Test(description = "我的抽奖码数量", priority = 7)
public void 我的抽奖码数量() {
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_MYCOUNT);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_MYCOUNT, "获取抽奖码数量失败", myCountRes.body().asString()));
}
}
......@@ -21,6 +21,7 @@ public class LiveConstants {
@AllArgsConstructor
public enum StringKeyEnum{
LIVE_ID(1,"直播ID的key"),
ENCODE_LIVE_ID(2,"直播加密ID的key"),
;
private Integer key;
private String desc;
......
package com.kjj.utils;
import org.apache.commons.lang.StringUtils;
import java.util.Base64;
/**
* Created by dugq on 2019-10-23.
*
* 把ID转换后通过base64编码得出来的值
* 规律: 以Kj2 开头。第四位为base64结尾'='的个数。避免url encoding
* 数字部分利用二进制左移3位,后三位补1 把数字变换掉,再base64转码。支持最大值为 2^(64-4)
* 兼容:旧版本以kjj开头 第四位取原数字第一位补充。 加密已删除,揭秘通过kjj 和 kj2 区分
* 修改原因: 旧版本太长, 且要处理URL编码问题导致多了一次转换16进制。 加密的主要方案在于 数字左移和补最高位,鉴于base64的高效,所以使用base64encode来美化ID
*
* base64加密效率: 加密 1 - 2千万 1s以内完成
*/
public class IdMakeUtil {
private static final Base64.Encoder encoder = Base64.getEncoder();
private static final Base64.Decoder decoder = Base64.getDecoder();
private static final String PREFIX = "Kj2";
private IdMakeUtil(){}
public static String encodingId(Long id) {
id = (id << 3) ^ 7;
String encode = encoder.encodeToString(Long.toString(id).getBytes());
String replace = encode.replace("=", "");
return PREFIX + (encode.length() - replace.length()) + replace;
}
public static Long decodingId(String encode) {
if (StringUtils.isBlank(encode)) {
return null;
}
try {
StringBuilder substring = new StringBuilder(encode.substring(4));
String decode = new String(decoder.decode(substring.toString()));
return Long.valueOf(decode) >> 3;
} catch (Exception e) {
return null;
}
}
}
......@@ -225,7 +225,7 @@ public class MysqlUtils {
MysqlUtils jdbcUtils = new MysqlUtils("tuia_adver");
jdbcUtils.getConnection();
Map<String, Object> map = jdbcUtils.findSimpleResult("select * from account where company_name=?","吧科技有限公司");
Map<String, Object> map = jdbcUtils.findSimpleResult("select * from account where company_name=?","吧科技有限公司");
jdbcUtils.releaseConn();
......
......@@ -4,7 +4,7 @@
<suite-files>
<suite-file path="liveTestNG.xml"></suite-file>
<suite-file path="wechatTestNG.xml"></suite-file>
<!-- <suite-file path="wechatTestNG.xml"></suite-file>-->
</suite-files>
<!-- 监听器-->
......
......@@ -11,11 +11,11 @@
<!-- <class name="com.kjj.qa.cases.Novice"/>-->
<!-- </classes>-->
<!-- </test>-->
<!-- <test preserve-order="true" name="支付">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.basics.Pay"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="支付">
<classes>
<class name="com.kjj.cases.basics.Pay"/>
</classes>
</test>
<test preserve-order="true" name="名片">
<classes>
<class name="com.kjj.cases.basics.SellerCard"/>
......@@ -46,11 +46,11 @@
<class name="com.kjj.cases.basics.BossTest"/>
</classes>
</test>
<!-- <test preserve-order="true" name="贺卡">-->
<!-- <classes>-->
<!-- <class name="com.kjj.cases.basics.GreetingCard"/>-->
<!-- </classes>-->
<!-- </test>-->
<test preserve-order="true" name="贺卡">
<classes>
<class name="com.kjj.cases.basics.GreetingCard"/>
</classes>
</test>
</suite>
<!-- Suite -->
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment