Commit e2fa7b8a by xyy

Merge remote-tracking branch 'origin/master'

parents af65ed1b 87ee3c3e
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="课程模块场景case"> <!-- 起一个好听且唯一的名字-->
<test name="课程模块测试" preserve-order="true" verbose="3"> <!-- 再起一个听且唯一的名字 -->
<packages>
<package name="com.xiaomai.cases.polar.course.*"></package> <!-- 添加自己想要集成测试的case 范围自己定 -->
</packages>
</test>
<listeners>
<listener class-name="com.xiaomai.client.RetryListener" />
<listener class-name="com.xiaomai.client.TestListener" />
<listener class-name="com.xiaomai.client.ExtentTestNGIReporterListener"/>
</listeners>
</suite>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="财务中心场景case"> <!-- 起一个好听且唯一的名字-->
<test name="财务中心模块测试" preserve-order="true" verbose="3"> <!-- 再起一个听且唯一的名字 -->
<packages>
<package name="com.xiaomai.cases.polar.finance.*"></package> <!-- 添加自己想要集成测试的case 范围自己定 -->
</packages>
</test>
<listeners>
<listener class-name="com.xiaomai.client.RetryListener" />
<listener class-name="com.xiaomai.client.TestListener" />
<listener class-name="com.xiaomai.client.ExtentTestNGIReporterListener"/>
</listeners>
</suite>
\ No newline at end of file
......@@ -43,6 +43,10 @@ public class AdminTools extends XMBaseTest {
avatar.put("content",name.charAt(name.length() - 1));
body.put("avatar",avatar); // 员工头像未设置取昵称最后一个字
body.put("gender","MAN");
body.put("userId",dataApi.getLoginInfo().getUser());
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
JSONArray roles = new JSONArray(); // 角色
JSONObject teaching = new JSONObject();
......
......@@ -11,6 +11,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
import javax.swing.*;
import java.util.Random;
/**
......@@ -18,7 +19,7 @@ import java.util.Random;
* @BelongsPackage: com.xiaomai.cases.polar.admin
* @Author: xuyamei
* @CreateTime: 2024-02-29 11:48
* @Description: 新建角色
* @Description: 新建员工
* @Version: 1.0
*/
public class TestAddStudioAdmin extends BaseTestImpl {
......@@ -30,7 +31,7 @@ public class TestAddStudioAdmin extends BaseTestImpl {
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Admin,"API_addStudioAdmin", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_addStudioAdmin", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
......@@ -51,12 +52,27 @@ public class TestAddStudioAdmin extends BaseTestImpl {
String[] resultString = {"name","phone","roles","teaching"}; // 新建之后验证相应的值
for (int i = 0; i < resultString.length; i++){
// check 1:创建员工时的值与查询员工详情时的值是否一致
Assert.assertEquals(addRequest.getString(resultString[i]),adminInfo.getJSONObject("result").getString(resultString[i]),"添加员工失败,员工详情与创建员工时的信息不一致");
String checkResult = resultString[i].equals("roles") ? addRequest.getJSONArray("roles").getString(0) : addRequest.getString(resultString[i]);
String expected = resultString[i].equals("roles") ? adminInfo.getJSONObject("result").getJSONArray(resultString[i]).getJSONObject(0).getString("code") : adminInfo.getJSONObject("result").getString(resultString[i]);
Assert.assertEquals(checkResult,expected,"添加员工失败,员工详情与创建员工时的信息不一致");
}
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// check 2: 生成对应的操作日志
String body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"ADD_ADMIN\"}";
String body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"brandId\": \""+xmAppApi.getLoginInfo().getBrandId()+"\",\"studioId\": \""+xmAppApi.getLoginInfo().getStudioId()+"\",\"content\": \""+adminInfo.getJSONObject("result").getString("name")+"\",\"opEventKey\":\"ADD_ADMIN\"}";
JSONObject response = configTools.getOpauditPage(body);
Assert.assertEquals(response.getJSONObject("result").getJSONArray("records").getJSONObject(0).getJSONObject("target").getString("targetId"),result,"添加员工未生成操作日志");
}
@Test(description = "添加员工,由于没有删除员工的操作,则每次随机取一个角色")
public void testAddStudioAdmin1(){
for (int i = 0; i < 2; i++){
JSONObject addRequest = adminTools.addStudioAdmin("教练");
}
}
}
......@@ -27,7 +27,7 @@ public class TestCheckExistInStudio extends BaseTestImpl {
@BeforeClass
@Override
public void beforeTest() {
setTestInfo(ApiModule.Polar_Admin,"API_checkExistInStudio", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_checkExistInStudio", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
......
package com.xiaomai.cases.polar.admin;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
......@@ -23,25 +24,33 @@ public class TestCheckPermConfigDup extends BaseTestImpl {
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Admin,"API_checkPermConfigDup", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_checkPermConfigDup", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@DataProvider()
public Object[][] data(){
return new Object[][]{
{"{\"permCodes\": [\"FitHeadPage\", \"FitCluePrivate\", \"FitSeeValidMember\", \"FitCluePublic\", \"FitAddClue\", \"FitEditClue\", \"FitReleaseClue\"],\n" +
" \"configMap\": {\n" +
" \"memberAccess\": false,\n" +
" \"scheduleAccess\": false,\n" +
" \"reserveAccess\": false,\n" +
" \"followUpAccess\": false,\n" +
" \"importAccess\": false,\n" +
" \"exportAccess\": false,\n" +
" \"taskAccess\": false,\n" +
" \"potentialPhoneMask\": true,\n" +
" \"memberPhoneMask\": false,\n" +
" \"historyPhoneMask\": true}}",true}, // 存在有相同权限的角色
{"{\n" +
"\t\"permCodes\": [\"FitHeadInfo\", \"FitIncomeExpense\", \"FitSeeOrder\", \"FitEditOrder\", \"FitSeeXmPay\", \"FitManageXmPay\", \"FitFinanceData\"],\n" +
"\t\"configMap\": {\n" +
"\t\t\"memberAccess\": true,\n" +
"\t\t\"scheduleAccess\": false,\n" +
"\t\t\"reserveAccess\": false,\n" +
"\t\t\"followUpAccess\": false,\n" +
"\t\t\"importAccess\": true,\n" +
"\t\t\"exportAccess\": true,\n" +
"\t\t\"taskAccess\": true,\n" +
"\t\t\"orderAccess\": true,\n" +
"\t\t\"incomeExpenseAccess\": true,\n" +
"\t\t\"potentialPhoneMask\": false,\n" +
"\t\t\"memberPhoneMask\": false,\n" +
"\t\t\"historyPhoneMask\": false\n" +
"\t},\n" +
"\t\"brandId\": \"1796482011391729666\",\n" +
"\t\"studioId\": \"1800375402938871809\",\n" +
"\t\"operatorId\": \"1796482250721169409\"\n" +
"}",true}, // 存在有相同权限的角色
{"{\n" +
" \"permCodes\": [\"FitHeadPage\", \"FitCluePublic\", \"FitAddClue\", \"FitEditClue\", \"FitReleaseClue\"],\n" +
" \"configMap\": {\n" +
......@@ -60,6 +69,10 @@ public class TestCheckPermConfigDup extends BaseTestImpl {
}
@Test(dataProvider = "data")
public void testCheckPermConfigDup(String body,boolean flag){
JSONObject request = JSONObject.parseObject(body);
request.put("brandId",xmAppApi.getLoginInfo().getBrandId());
request.put("studioId",xmAppApi.getLoginInfo().getStudioId());
request.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
JSONObject response = xmAppApi.getBodyInJSON();
Assert.assertEquals(response.getJSONArray("result").size()>0,flag,"校验角色权限配置是否重复");
......
......@@ -24,7 +24,7 @@ public class TestCheckRoleNameDup extends BaseTestImpl {
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Admin,"API_checkRoleNameDup", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_checkRoleNameDup", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
......
......@@ -31,7 +31,7 @@ public class TestDepartStudioAdmin extends BaseTestImpl {
@BeforeClass
@Override
public void beforeTest() {
setTestInfo(ApiModule.Polar_Admin,"API_departStudioAdmin", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_departStudioAdmin", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
......@@ -44,6 +44,7 @@ public class TestDepartStudioAdmin extends BaseTestImpl {
if (total>1){
String adminId = adminPage.getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("id");
String phone = adminPage.getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("phone");
String name = adminPage.getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("name");
body = "{\"id\":\""+adminId+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
try {
......@@ -56,9 +57,13 @@ public class TestDepartStudioAdmin extends BaseTestImpl {
adminPage = adminTools.pageStudioAdmin(body);
total = Integer.parseInt(adminPage.getJSONObject("result").getString("total"));
Assert.assertEquals(total,1,"员工离职失败,用手机号查询离职员工未返回数据");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// check 2: 生成对应的操作日志
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"LEFT_ADMIN\"}";
body = "{\"current\":0,\"size\":10,\"content\": \""+name+"\",\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"brandId\": \""+xmAppApi.getLoginInfo().getBrandId()+"\",\"studioId\": \""+xmAppApi.getLoginInfo().getStudioId()+"\",\n\"opEventKey\":\"LEFT_ADMIN\"}";
JSONObject response = configTools.getOpauditPage(body);
Assert.assertEquals(response.getJSONObject("result").getJSONArray("records").getJSONObject(0).getJSONObject("target").getString("targetId"),adminId,"员工离职未生成操作日志");
......
......@@ -31,7 +31,7 @@ public class TestEditStudioAdmin extends BaseTestImpl {
@BeforeClass
@Override
public void beforeTest() {
setTestInfo(ApiModule.Polar_Admin,"API_editStudioAdmin", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_editStudioAdmin", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
......@@ -97,13 +97,26 @@ public class TestEditStudioAdmin extends BaseTestImpl {
String[] resultString = {"id","phone","name","nickName","gender","avatar","roles","teaching","birthDate","entryDate","memo"}; // 修改之后验证的值
for (int i = 0; i < resultString.length; i++){
String result = adminInfo.getJSONObject("result").getString(resultString[i]);
System.out.println("-------"+resultString[i]);
if (resultString[i].equals("roles")){
JSONArray arr = new JSONArray();
for (int j=0;j<adminInfo.getJSONObject("result").getJSONArray(resultString[i]).size();j++){
arr.add(adminInfo.getJSONObject("result").getJSONArray(resultString[i]).getJSONObject(j).getString("code"));
}
result = arr.toJSONString();
System.out.println("---------------2"+result);
}
Assert.assertEquals(result, requestBody.getString(resultString[i]));
System.out.println(resultString[i] + " : " + result);
System.out.println(adminInfo.getJSONObject("result").getString(resultString[i]));
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// check 2: 生成对应的操作日志
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"EDIT_ADMIN\"}";
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"content\": \""+name+"\",\"brandId\": \""+xmAppApi.getLoginInfo().getBrandId()+"\",\"studioId\": \""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"EDIT_ADMIN\"}";
JSONObject response = configTools.getOpauditPage(body);
Assert.assertEquals(response.getJSONObject("result").getJSONArray("records").getJSONObject(0).getJSONObject("target").getString("targetId"),adminId,"编辑员工未生成操作日志");
......
......@@ -23,7 +23,7 @@ public class TestGetAdmin extends XMBaseTest {
public void beforeTest() {
xmAppApi.setApiModule(ApiModule.Polar_Admin) // API 所属模块
.setApiName("API_getAdmin")
.setLoginUser(LoginAccount.XYM_DEV) // http 接口,测试账号
.setLoginUser(LoginAccount.GYM_PROD) // http 接口,测试账号
.setTerminal(Terminal.B); // 所属端位(B端,C端,M端等, 必传)
dal.setCase_owner("xym")
.setCase_name( Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
......
......@@ -29,7 +29,7 @@ public class TestReinStateStudioAdmin extends BaseTestImpl {
@BeforeClass
@Override
public void beforeTest() {
setTestInfo(ApiModule.Polar_Admin,"API_reinStateStudioAdmin", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_reinStateStudioAdmin", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
......@@ -42,6 +42,7 @@ public class TestReinStateStudioAdmin extends BaseTestImpl {
if (total>1){
String adminId = adminPage.getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("id");
String phone = adminPage.getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("phone");
String name = adminPage.getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("name");
body = "{\"id\":\""+adminId+"\"}";
xmAppApi.doRequest(RequestType.JSON,params,body,headers).assetsSuccess(true);
try {
......@@ -55,8 +56,13 @@ public class TestReinStateStudioAdmin extends BaseTestImpl {
total = Integer.parseInt(adminPage.getJSONObject("result").getString("total"));
Assert.assertEquals(total,1,"员工离职失败,用手机号查询离职员工未返回数据");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// check 2: 生成对应的操作日志
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"RESTORE_ADMIN\"}";
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"content\": \""+name+"\",\"brandId\":\""+xmAppApi.getLoginInfo().getBrandId()+"\",\"studioId\": \""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"RESTORE_ADMIN\"}";
JSONObject response = configTools.getOpauditPage(body);
Assert.assertEquals(response.getJSONObject("result").getJSONArray("records").getJSONObject(0).getJSONObject("target").getString("targetId"),adminId,"员工离职未生成操作日志");
......
......@@ -32,7 +32,7 @@ public class TestStudioRoleCreate extends BaseTestImpl {
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Admin,"API_studioRole_create", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_studioRole_create", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test(description = "新建角色 --> 查询列表是否有该角色 --> 删除新建的角色")
......@@ -87,7 +87,7 @@ public class TestStudioRoleCreate extends BaseTestImpl {
throw new RuntimeException(e);
}
// 校验2:查询日志是否有创建员工角色记录
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"ADD_ROLE\"}";
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"content\": \"角#色设定##\",\"brandId\": \""+xmAppApi.getLoginInfo().getBrandId()+"\",\"studioId\": \""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"ADD_ROLE\"}";
JSONObject response = configTools.getOpauditPage(body);
Assert.assertEquals(response.getJSONObject("result").getJSONArray("records").getJSONObject(0).getJSONObject("target").getString("targetId"),id,"添加角色未生成操作日志");
......
......@@ -30,7 +30,7 @@ public class TestStudioRoleEdit extends BaseTestImpl {
ConfigTools configTools;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Admin,"API_studioRole_edit", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_studioRole_edit", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
private String roleCode;
......@@ -87,12 +87,12 @@ public class TestStudioRoleEdit extends BaseTestImpl {
Assert.assertEquals(response.getJSONObject("result").getString("name"),"编辑角色名称","编辑角色名称失败");
try {
Thread.sleep(3000);
Thread.sleep(4000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// 校验2:查询日志是否有编辑员工角色记录
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"EDIT_ROLE\"}";
body = "{\"current\":0,\"size\":10,\"domainId\":\""+xmAppApi.getLoginInfo().getStudioId()+"\",\"content\": \"编辑角色名称\",\"brandId\": \""+xmAppApi.getLoginInfo().getBrandId()+"\",\"studioId\": \""+xmAppApi.getLoginInfo().getStudioId()+"\",\"opEventKey\":\"EDIT_ROLE\"}";
response = configTools.getOpauditPage(body);
Assert.assertEquals(response.getJSONObject("result").getJSONArray("records").getJSONObject(0).getJSONObject("target").getString("targetId"),id,"编辑角色未生成操作日志");
......
......@@ -23,7 +23,7 @@ import javax.annotation.Resource;
public class TestStudioRoleGetPermList extends BaseTestImpl {
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Admin,"API_studioRole_getPermList", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_studioRole_getPermList", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
......@@ -33,7 +33,7 @@ public class TestStudioRoleGetPermList extends BaseTestImpl {
JSONArray jsonArray = xmAppApi.getBodyInJSONArray("$.result");
// 校验1:校验返回结果是否包含8个功能权限
Assert.assertEquals(jsonArray.size()>=8,true,"功能权限缺失" );
String[] arr = {"FitHeadPageCenter","FitBrandCenter","FitSalesCenter","FitMarketingTool","FitMemberCenter","FitBusinessCenter","FitFinanceCenter","FitManage"};
String[] arr = {"FitHeadPageCenter","FitBrandCenter","FitSalesCenter","FitDataCenter","FitMemberCenter","FitBusinessCenter","FitFinanceCenter","FitManage"};
JSONArray arr1 = new JSONArray();
for (String s : arr){
arr1.add(s);
......@@ -44,7 +44,7 @@ public class TestStudioRoleGetPermList extends BaseTestImpl {
result.add(jsonArray.getJSONObject(i).getString("code"));
}
// 校验2:校验返回结果是否包含既定的功能权限
Assert.assertEquals(result.equals(arr1),true,"功能权限模块缺失" );
Assert.assertEquals(result.containsAll(arr1),true,"功能权限模块缺失" );
}
}
......@@ -23,7 +23,7 @@ import org.testng.annotations.Test;
public class TestStudioRoleListByStudioId extends BaseTestImpl {
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Admin,"API_studioRole_listByStudioId", LoginAccount.XYM_DEV, Terminal.B,"xym");
setTestInfo(ApiModule.Polar_Admin,"API_studioRole_listByStudioId", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
......
package com.xiaomai.cases.polar.course;
import com.alibaba.fastjson.JSONArray;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.cases.polar.setting.courseCategory.CourseCategoryTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.course
* @Author: xuyamei
* @CreateTime: 2024-05-06 18:19
* @Description: 校验课程名称重复
* @Version: 1.0
*/
public class TestCheckCourseNameDup extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
@Resource(name = "courseTools")
CourseTools courseTools;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Course,"API_checkCourseNameDup", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@DataProvider()
public Object[][] data(){
return new Object[][]{
{"1对多名称是否重复校验哈哈哈哈哈哈哈",false,"校验名称重复不存在但返回了true"},
{"课程",true,"校验名称重复存在但返回了false"}
};
}
@Test(dataProvider = "data")
public void testCheckCourseNameDup(String name,boolean isDup,String msg) {
// 为了校验存在的课程名称返回的是否正确
if(isDup){
// 获取课程分类
String categoryId = courseCategoryTools.getCourseCategoryPage("瑜伽");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
JSONArray arr = courseTools.getPersonalOrGroupCourseId("GROUP",name,categoryId,"STUDIO","",2,1);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
name = arr.getString(1);
}
Assert.assertEquals(courseTools.checkCourseNameDup(name),isDup,msg);
}
}
package com.xiaomai.cases.polar.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.cases.polar.setting.courseCategory.CourseCategoryTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
import java.util.Random;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.course
* @Author: xuyamei
* @CreateTime: 2024-05-07 17:06
* @Description: 创建团课
* @Version: 1.0
*/
public class TestCreateGroupCourse extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
@Resource(name = "courseTools")
CourseTools courseTools;
private String courseId;
@BeforeClass
public void beforeTest() {
setTestInfo(ApiModule.Polar_Course, "API_createGroupCourse", LoginAccount.GYM_PROD, Terminal.B, "xym");
super.beforeTest();
}
@Test
public void testCreateGroupCourse() {
// 查询存量的课程分类
String categoryId = courseCategoryTools.getCourseCategoryPage("瑜伽");
String courseName = "瑜伽团课" + TimeUtils.getCurrentTime();
Random random = new Random();
int duration = random.nextInt(60)+10; // 时长
int difficulty = random.nextInt(5)+1; // 难度
int calorie = random.nextInt(100)+100;
String introduction = "{\"items\":[{\"content\":\"花花世界的\",\"aspect\":\"\",\"type\":\"TEXT\"}]}";
JSONObject body= new JSONObject();
body.put("courseName", courseName);
body.put("duration", duration); // 时长
body.put("difficulty", difficulty); // 难度
body.put("color", "#AACF53");
body.put("coverId", "0");
body.put("timeUnit", "MINUTE");
body.put("categoryId", categoryId);
body.put("introduction", introduction);
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body.put("sourceId", xmAppApi.getLoginInfo().getStudioId()); // 来源:场馆、品牌
body.put("sourceType", "STUDIO");
body.put("brandId", xmAppApi.getLoginInfo().getBrandId()); // 品牌
body.put("studioId", xmAppApi.getLoginInfo().getStudioId()); // 场馆
body.put("calorie", calorie);
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
// 获取课程id
courseId = xmAppApi.getBodyInJSON().getString("result");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// check 1:列表是否有该团课数据
JSONObject coursePage = courseTools.getGroupClassPage("ON",0,courseName,categoryId);
String total = coursePage.getString("total");
Assert.assertEquals(total,"1","新建之后团课列表没有找到相关数据");
// check 2:团课详情内容是否与新建一致
String[] keys = {"courseName","duration","difficulty","color","coverId","timeUnit","categoryId","sourceId","sourceType","brandId","calorie"};
String[] values = {courseName,String.valueOf(duration),String.valueOf(difficulty),"#AACF53","1772108160765263873","MINUTE",categoryId,xmAppApi.getLoginInfo().getStudioId(),"STUDIO",xmAppApi.getLoginInfo().getBrandId(),String.valueOf(calorie)};
JSONObject courseDetail = courseTools.getCourseDetail(courseId);
for (int i = 0; i < keys.length; i++) {
String result = values[i];
Assert.assertEquals(courseDetail.getString(keys[i]),result,"新建之后课程详情与新建内容不一致");
}
}
@Test(description = "清除增量数据",priority = 1)
public void del(){
// 删除课程数据
courseTools.modifyCourseStatus(courseId,"DELETE",false);
}
}
package com.xiaomai.cases.polar.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.cases.polar.setting.courseCategory.CourseCategoryTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.course
* @Author: xuyamei
* @CreateTime: 2024-04-23 14:15
* @Description: 创建私教课程
* @Version: 1.0
*/
public class TestCreatePersonalCourse extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
@Resource(name = "courseTools")
CourseTools courseTools;
private JSONArray courseIds = new JSONArray();
@BeforeClass
public void beforeTest() {
setTestInfo(ApiModule.Polar_Course, "API_personalCreate", LoginAccount.GYM_PROD, Terminal.B, "xym");
super.beforeTest();
}
@DataProvider()
public Object[][] data(){
return new Object[][]{
{"1对多","ONE_TO_MANY"}, // 1对多
{"1对1","ONE_TO_ONE"}, // 1对1
};
}
@Test(dataProvider = "data")
public void testCreatePersonalCourse(String name,String sizeType) {
// 获取课程分类
String categoryId = courseCategoryTools.getCourseCategoryPage("私教课分类"+ TimeUtils.getCurrentTime());
// 新建课程参数
JSONObject body = new JSONObject();
String courseName = name + "私教课程"+ TimeUtils.getCurrentTime();
body.put("courseName", courseName);
body.put("duration", 60); // 时长
body.put("difficulty", 3); // 难度
body.put("color", "#AACF53");
body.put("coverId", "0");
body.put("timeUnit", "MINUTE");
body.put("categoryId", categoryId); // 课程分类id
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body.put("sourceId", xmAppApi.getLoginInfo().getStudioId()); // 来源:场馆、品牌
body.put("sourceType", "STUDIO"); // 来源类型:场馆、品牌
body.put("brandId", xmAppApi.getLoginInfo().getBrandId()); // 品牌
body.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("sizeType", sizeType); // 私教模式
body.put("allArea", false); // 场地
JSONArray coachIds = new JSONArray();
coachIds.add(xmAppApi.getLoginInfo().getAdminId());
body.put("coachIds", coachIds);
if (sizeType.equals("ONE_TO_MANY")){
body.put("capacity", 2); // 课容量
body.put("minCapacity", 1); // 开课人数
}
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
String courseId = xmAppApi.getBodyInJSON().getString("result");
courseIds.add(courseId);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// check 1:查询私教课程列表
String total = courseTools.getPersonalPage("ON",0,courseName,categoryId,sizeType,"").getString("total");
Assert.assertEquals(total,"1","新建之后私教列表没有找到相关数据");
// check 2: 查看课程详情是否与新建内容一致
JSONObject courseDetail = courseTools.getCourseDetail(courseId);
String[] keys = {"courseName","duration","difficulty","color","coverId","timeUnit","categoryId","sourceId","sourceType","brandId","sizeType","allArea","capacity","minCapacity"};
String[] values = {courseName,"60","3","#AACF53","1772108160765263873","MINUTE",categoryId,xmAppApi.getLoginInfo().getStudioId(),"STUDIO",xmAppApi.getLoginInfo().getBrandId(),sizeType,"false","2","1"};
for (int i = 0; i < keys.length; i++) {
String result = values[i];
// 1对1的容量为1
if (sizeType.equals("ONE_TO_ONE") && keys[i].equals("capacity")){
result = "1";
}
Assert.assertEquals(courseDetail.getString(keys[i]),result,"新建之后课程详情与新建内容不一致");
}
}
@Test(description = "清除增量数据",priority = 1)
public void del(){
// 删除课程数据
for (int i = 0; i < courseIds.size(); i++){
courseTools.modifyCourseStatus(courseIds.getString(i),"DELETE",false);
}
}
}
package com.xiaomai.cases.polar.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.course
* @Author: xuyamei
* @CreateTime: 2024-04-25 11:43
* @Description: 创建特定日期可约
* @Version: 1.0
*/
public class TestCreateSpecialDate extends BaseTestImpl {
@BeforeClass
public void beforeTest() {
setTestInfo(ApiModule.Polar_Admin, "API_createSpecialDate", LoginAccount.GYM_PROD, Terminal.B, "xym");
super.beforeTest();
}
@Test
public void testCreateSpecialDate() {
JSONObject body = new JSONObject();
body.put("brandId", xmAppApi.getLoginInfo().getBrandId());
body.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("coachId", "1762382404818898946");
// 特定时间
JSONObject specialTimeInfoRequest = new JSONObject();
specialTimeInfoRequest.put("dutyType", "OFF_DUTY");
JSONArray specialTimeInfoRequestArray = new JSONArray();
specialTimeInfoRequestArray.add(TimeUtils.getBeforeDayDate(3));
specialTimeInfoRequest.put("selectedDates", specialTimeInfoRequestArray);
body.put("specialTimeInfoRequest", specialTimeInfoRequest);
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
}
}
package com.xiaomai.cases.polar.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.cases.polar.setting.courseCategory.CourseCategoryTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
import java.util.Random;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.course
* @Author: xuyamei
* @CreateTime: 2024-05-07 17:36
* @Description: 编辑团课
* @Version: 1.0
*/
public class TestEditGroupCourse extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
@Resource(name = "courseTools")
CourseTools courseTools;
@BeforeClass
public void beforeTest() {
setTestInfo(ApiModule.Polar_Course, "API_editGroupCourse", LoginAccount.GYM_PROD, Terminal.B, "xym");
super.beforeTest();
}
@Test
public void testEditGroupCourse() {
String categoryId = courseCategoryTools.getCourseCategoryPage("");
String courseId = courseTools.getPersonalOrGroupCourseId("GROUP", "存量瑜伽团课课程", categoryId, "STUDIO", "", 2, 1).getString(0);
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Random random = new Random();
int duration = random.nextInt(60) + 10;
int difficulty = random.nextInt(5) + 1;
int calorie = random.nextInt(100) + 100;
String introduction = "{\"items\":[{\"content\":\"花花世界的\",\"aspect\":\"\",\"type\":\"TEXT\"}]}";
String courseName = "存量瑜伽团课课程" + TimeUtils.getCurrentTime();
JSONObject body = new JSONObject();
body.put("courseName", courseName);
body.put("duration", duration); // 时长
body.put("difficulty", difficulty); // 难度
body.put("color", "#AACF53");
body.put("coverId", "0");
body.put("timeUnit", "MINUTE");
body.put("categoryId", categoryId);
body.put("introduction", introduction);
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body.put("sourceId", xmAppApi.getLoginInfo().getStudioId()); // 来源:场馆、品牌
body.put("sourceType", "STUDIO");
body.put("studioId", xmAppApi.getLoginInfo().getStudioId()); // 场馆
body.put("calorie", calorie); // 卡路里
body.put("brandCourseId", courseId);
xmAppApi.doRequest(RequestType.JSON, params, body.toString(), headers).assetsSuccess(true);
String[] keys = {"courseName", "duration", "difficulty", "color", "coverId", "timeUnit", "categoryId", "sourceId", "sourceType", "brandId", "calorie"};
String[] values = {courseName, String.valueOf(duration), String.valueOf(difficulty), "#AACF53", "1772108160765263873", "MINUTE", categoryId, xmAppApi.getLoginInfo().getStudioId(), "STUDIO", xmAppApi.getLoginInfo().getBrandId(), String.valueOf(calorie)};
// 校验内容与编辑的是否一致
JSONObject courseDetail = courseTools.getCourseDetail(courseId);
for (int i = 0; i < keys.length; i++) {
String result = values[i];
Assert.assertEquals(courseDetail.getString(keys[i]), result, "编辑之后课程详情与编辑内容不一致");
}
}
}
\ No newline at end of file
package com.xiaomai.cases.polar.course;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.cases.polar.setting.courseCategory.CourseCategoryTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
import java.util.Random;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.course
* @Author: xuyamei
* @CreateTime: 2024-05-07 14:36
* @Description: 编辑私教课
* @Version: 1.0
*/
public class TestEditPersonalCourse extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
@Resource(name = "courseTools")
CourseTools courseTools;
@BeforeClass
public void beforeTest() {
setTestInfo(ApiModule.Polar_Course, "API_editPersonalCourse", LoginAccount.GYM_PROD, Terminal.B, "xym");
super.beforeTest();
}
@Test
public void testEditPersonalCourse() {
String categoryId = courseCategoryTools.getCourseCategoryPage("瑜伽");
// 查询存量的课程用于编辑
JSONArray courseIdArray = courseTools.getPersonalOrGroupCourseId("PERSONAL", "存量瑜伽课程", categoryId, "STUDIO", "ONE_TO_MANY", 2, 1);
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
String courseId = courseIdArray.getString(0);
Random random = new Random();
JSONObject courseDetail = courseTools.getCourseDetail(courseId);
int duration = random.nextInt(60)+10;
int difficulty = random.nextInt(5)+1;
int capacity = random.nextInt(10)+1;
String courseName = "存量瑜伽课程"+ TimeUtils.getCurrentTime();
JSONObject body = new JSONObject();
body.put("categoryId", courseDetail.getString("categoryId"));
body.put("courseName", courseName);
body.put("duration", duration); // 时长
body.put("difficulty", difficulty); // 难度
body.put("color", "#AACF53");
body.put("coverId", "0");
body.put("timeUnit", "MINUTE");
body.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
body.put("sourceId", xmAppApi.getLoginInfo().getStudioId()); // 来源:场馆、品牌
body.put("sourceType", "STUDIO"); // 来源类型:场馆、品牌
body.put("brandId", xmAppApi.getLoginInfo().getBrandId()); // 品牌
body.put("studioId", xmAppApi.getLoginInfo().getStudioId());
body.put("sizeType", "ONE_TO_MANY"); // 私教模式
body.put("allArea", false); // 场地
JSONArray coachIds = new JSONArray();
coachIds.add(xmAppApi.getLoginInfo().getAdminId());
body.put("coachIds", coachIds);
body.put("capacity", capacity); // 课容量
body.put("minCapacity", 1); // 开课人数
body.put("brandCourseId", courseId);
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
String[] keys = {"courseName","duration","difficulty","color","coverId","timeUnit","categoryId","sourceId","sourceType","brandId","sizeType","allArea","capacity","minCapacity"};
String[] values = {courseName,String.valueOf(duration),String.valueOf(difficulty),"#AACF53","1772108160765263873","MINUTE",categoryId,xmAppApi.getLoginInfo().getStudioId(),"STUDIO",xmAppApi.getLoginInfo().getBrandId(),"ONE_TO_MANY","false",String.valueOf(capacity),"1"};
// 校验内容与编辑的是否一致
courseDetail = courseTools.getCourseDetail(courseId);
for (int i = 0; i < keys.length; i++) {
String result = values[i];
Assert.assertEquals(courseDetail.getString(keys[i]),result,"编辑之后课程详情与编辑内容不一致");
}
}
}
package com.xiaomai.cases.polar.finance.order;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.client.DataUserInfo;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
public class OrderTools extends XMBaseTest {
/**
* @param
* @description:获取会员详情-订单管理列表
* @author: yangfangfang
**/
public JSONObject testPageMemberVoucher(String current,String size,String supplierId,String receiverId,String brandId,String studioId,String operatorId,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageMemberVoucher")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("current","");
jsonObject.put("size","");
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:获取会员详情-订单管理金额统计
* @author: yangfangfang
**/
public JSONObject testSumMemberVoucherAmount(String current,String size,String supplierId,String receiverId,String brandId,String studioId,String operatorId,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_sumMemberVoucherAmount")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("current","");
jsonObject.put("size","");
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:获取会员详情-订单明细列表
* @author: yangfangfang
**/
public JSONObject testPageMemberVoucherItem(String current,String size,String supplierId,String receiverId,String brandId,String studioId,String operatorId,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageMemberVoucherItem")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("current","");
jsonObject.put("size","");
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:获取订单管理-订单管理列表
* @author: yangfangfang
**/
public JSONObject testPageVoucher(String current,String size,String supplierId,String receiverId,String brandId,String studioId,String operatorId,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageVoucher")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("current","");
jsonObject.put("size","");
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:获取订单管理-订单管理金额统计
* @author: yangfangfang
**/
public JSONObject testSumVoucherAmount(String current,String size,String supplierId,String receiverId,String brandId,String studioId,String operatorId,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_sumVoucherAmount")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject = new JSONObject();
jsonObject.put("current", "");
jsonObject.put("size", "");
jsonObject.put("supplierId", "");
jsonObject.put("receiverId", "");
jsonObject.put("brandId", "");
jsonObject.put("studioId", "");
jsonObject.put("operatorId", "");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:获取订单管理-订单明细列表
* @author: yangfangfang
**/
public JSONObject testPageVoucherItem(String current,String size,String supplierId,String receiverId,String brandId,String studioId,String operatorId,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageVoucherItem")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("current","");
jsonObject.put("size","");
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
/**
* @param
* @description:获取订单管理-订单明细金额统计
* @author: yangfangfang
**/
public JSONObject testSumVoucherItemAmount(String current,String size,String supplierId,String receiverId,String brandId,String studioId,String operatorId,DataUserInfo...dataUserInfos){
dataApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_sumVoucherItemAmount")
.setTerminal(Terminal.B);
super.beforeDataRequest(dataUserInfos);
JSONObject jsonObject=new JSONObject();
jsonObject.put("current","");
jsonObject.put("size","");
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
dataApi.doRequest(RequestType.JSON, dataparams, jsonObject.toJSONString(), dataheadrs).assetsSuccess(true);
JSONObject response=dataApi.getBodyInJSON();
return response;
}
}
package com.xiaomai.cases.polar.finance.order;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestPageMemberVoucher extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageMemberVoucher")
.setLoginUser(LoginAccount.YFF_DEV)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "获取会员详情-订单管理列表")
public void testPageMemberVoucher(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","1777254935106740226");
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","获取会员详情-订单管理列表失败");
}
@Test(description = "获取会员详情-订单管理列表-无会员ID")
public void testPageMemberVoucher1(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(false);
}
}
package com.xiaomai.cases.polar.finance.order;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestPageMemberVoucherItem extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageMemberVoucherItem")
.setLoginUser(LoginAccount.YFF_DEV)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "获取会员详情-订单明细列表")
public void testPageMemberVoucherItem(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","1777254935106740226");
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","获取会员详情-订单明细列表失败");
}
@Test(description = "获取会员详情-订单明细列表-无会员ID")
public void testPageMemberVoucherItem1(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(false);
}
}
package com.xiaomai.cases.polar.finance.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestPageVoucher extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageVoucher")
.setLoginUser(LoginAccount.YFF_DEV)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "获取财务中心-订单管理列表-无筛选")
public void testPageVoucher(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","获取订单管理列表失败");
}
@Test(description = "获取财务中心-订单管理列表-无筛选-无卖家ID(场馆ID)、场馆ID、品牌ID、操作人ID")
public void testPageVoucher1(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(false);
}
@Test(description = "获取财务中心-订单管理列表-有筛选")
public void testPageVoucher_sift(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("source","OFFLINE_SOURCE");
JSONArray states=new JSONArray();
states.add("ARREARS");
states.add("PAID");
states.add("WAITING");
states.add("CANCEL");
states.add("DISCARD");
states.add("TIMEOUT");
jsonObject.put("states",states);
jsonObject.put("type","SIGN");
jsonObject.put("createdStart", TimeUtils.getMonthFristDay());
jsonObject.put("createdEnd",TimeUtils.getCurrentTime());
jsonObject.put("lastPaymentTimeStart",TimeUtils.getMonthFristDay());
jsonObject.put("lastPaymentTimeEnd",TimeUtils.getCurrentTime());
jsonObject.put("operationTimeStart", TimeUtils.getMonthFristDay());
jsonObject.put("operationTimeEnd",TimeUtils.getCurrentTime());
JSONArray salesmanIds=new JSONArray();
salesmanIds.add("1772880092185255937");
salesmanIds.add("1774376463837065218");
jsonObject.put("salesmanIds",salesmanIds);
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","筛选订单管理列表失败");
}
}
package com.xiaomai.cases.polar.finance.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestPageVoucherItem extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_pageVoucherItem")
.setLoginUser(LoginAccount.YFF_DEV)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "获取财务中心-订单明细列表-无筛选")
public void testPageVoucherItem(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","获取订单明细列表失败");
}
@Test(description = "获取财务中心-订单明细列表-无筛选-无卖家ID(场馆ID)、场馆ID、品牌ID、操作人ID")
public void testPageVoucherItem1(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(false);
}
@Test(description = "获取财务中心-订单明细列表-有筛选")
public void testPageVoucherItem_sift(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("createdStart", TimeUtils.getMonthFristDay());
jsonObject.put("createdEnd",TimeUtils.getCurrentTime());
jsonObject.put("lastPaymentTimeStart",TimeUtils.getMonthFristDay());
jsonObject.put("lastPaymentTimeEnd",TimeUtils.getCurrentTime());
jsonObject.put("operationTimeStart", TimeUtils.getMonthFristDay());
jsonObject.put("operationTimeEnd",TimeUtils.getCurrentTime());
JSONArray salesmanIds=new JSONArray();
salesmanIds.add("1772880092185255937");
salesmanIds.add("1774376463837065218");
jsonObject.put("salesmanIds",salesmanIds);
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","筛选订单明细列表失败");
}
}
package com.xiaomai.cases.polar.finance.order;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestSumMemberVoucherAmount extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_sumMemberVoucherAmount")
.setLoginUser(LoginAccount.YFF_DEV)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "获取会员详情-订单管理金额统计")
public void testSumMemberVoucherAmount(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","1777254935106740226");
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","获取会员详情-订单管理金额统计失败");
float totalActualAmount= Float.parseFloat(response.getJSONObject("result").getString("totalActualAmount"));
float totalUnpaidAmount=Float.parseFloat(response.getJSONObject("result").getString("totalUnpaidAmount"));
boolean flag=true;
if(totalActualAmount < 0){
flag=false;
}
Assert.assertEquals(flag,true,"获取会员详情-订单金额统计小于0");
}
@Test(description = "获取会员详情-订单管理金额统计-无会员ID")
public void testSumMemberVoucherAmount1() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("current", 0);
jsonObject.put("size", 20);
jsonObject.put("supplierId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId", "");
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers).assetsSuccess(false);
}
}
package com.xiaomai.cases.polar.finance.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestSumVoucherAmount extends XMBaseTest {
@BeforeMethod
public void beforeTest() {
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_sumVoucherAmount")
.setLoginUser(LoginAccount.YFF_DEV)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "获取财务中心-订单金额统计-不带筛选")
public void testSumVoucherAmount() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("current", 0);
jsonObject.put("size", 20);
jsonObject.put("supplierId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId", "");
jsonObject.put("brandId", xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId", xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId", xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers).assetsSuccess(true);
JSONObject response = xmAppApi.getBodyInJSON();
String success = response.getString("success");
Assert.assertEquals(success, "true", "获取财务中心-订单金额统计失败");
float totalActualAmount= Float.parseFloat(response.getJSONObject("result").getString("totalActualAmount"));
float totalUnpaidAmount=Float.parseFloat(response.getJSONObject("result").getString("totalUnpaidAmount"));
boolean flag=true;
if(totalActualAmount < 0){
flag=false;
}
Assert.assertEquals(flag,true,"获取财务中心-订单金额统计小于0");
}
@Test(description = "获取财务中心-订单金额统计-带筛选")
public void testSumVoucherAmount_sift() {
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("source","OFFLINE_SOURCE");
JSONArray states=new JSONArray();
states.add("ARREARS");
states.add("PAID");
states.add("WAITING");
states.add("CANCEL");
states.add("DISCARD");
states.add("TIMEOUT");
jsonObject.put("states",states);
jsonObject.put("type","SIGN");
jsonObject.put("createdStart", TimeUtils.getMonthFristDay());
jsonObject.put("createdEnd",TimeUtils.getCurrentTime());
jsonObject.put("lastPaymentTimeStart",TimeUtils.getMonthFristDay());
jsonObject.put("lastPaymentTimeEnd",TimeUtils.getCurrentTime());
jsonObject.put("operationTimeStart", TimeUtils.getMonthFristDay());
jsonObject.put("operationTimeEnd",TimeUtils.getCurrentTime());
JSONArray salesmanIds=new JSONArray();
salesmanIds.add("1772880092185255937");
salesmanIds.add("1774376463837065218");
jsonObject.put("salesmanIds",salesmanIds);
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers).assetsSuccess(true);
JSONObject response = xmAppApi.getBodyInJSON();
String success = response.getString("success");
Assert.assertEquals(success, "true", "获取财务中心-订单金额统计(带筛选)失败");
}
@Test(description = "获取财务中心-订单金额统计-无场馆ID、品牌ID、操作人ID")
public void testSumVoucherAmount1() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("current", 0);
jsonObject.put("size", 20);
jsonObject.put("supplierId", "");
jsonObject.put("receiverId", "");
jsonObject.put("brandId", "");
jsonObject.put("studioId", "");
jsonObject.put("operatorId", "");
xmAppApi.doRequest(RequestType.JSON, params, jsonObject.toJSONString(), headers).assetsSuccess(false);
}
}
\ No newline at end of file
package com.xiaomai.cases.polar.finance.order;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import com.xiaomai.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
public class TestSumVoucherItemAmount extends XMBaseTest {
@BeforeMethod
public void beforeTest(){
xmAppApi.setApiModule(ApiModule.Polar_Finance)
.setApiName("API_sumVoucherItemAmount")
.setLoginUser(LoginAccount.YFF_DEV)
.setTerminal(Terminal.B);
dal.setCase_owner("yff")
.setCase_name(Thread.currentThread().getStackTrace()[1].getFileName().split("\\.")[0]);
super.beforeTest();
}
@Test(description = "获取财务中心-订单明细小计-无筛选")
public void testPageVoucherItem(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","获取财务中心-订单明细小计失败");
float totalActualAmount= Float.parseFloat(response.getJSONObject("result").getString("totalActualAmount"));
boolean flag=true;
if(totalActualAmount < 0){
flag=false;
}
Assert.assertEquals(flag,true,"获取财务中心-订单明细统计小于0");
}
@Test(description = "获取财务中心-订单明细小计-无筛选-无场馆ID、品牌ID、操作人ID")
public void testPageVoucherItem1(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId","");
jsonObject.put("receiverId","");
jsonObject.put("brandId","");
jsonObject.put("studioId","");
jsonObject.put("operatorId","");
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(false);
}
@Test(description = "获取财务中心-订单明细小计-有筛选")
public void testPageVoucherItem_sift(){
JSONObject jsonObject=new JSONObject();
jsonObject.put("current",0);
jsonObject.put("size",20);
jsonObject.put("supplierId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("receiverId","");
jsonObject.put("createdStart", TimeUtils.getMonthFristDay());
jsonObject.put("createdEnd",TimeUtils.getCurrentTime());
jsonObject.put("lastPaymentTimeStart",TimeUtils.getMonthFristDay());
jsonObject.put("lastPaymentTimeEnd",TimeUtils.getCurrentTime());
jsonObject.put("operationTimeStart", TimeUtils.getMonthFristDay());
jsonObject.put("operationTimeEnd",TimeUtils.getCurrentTime());
JSONArray salesmanIds=new JSONArray();
salesmanIds.add("1772880092185255937");
salesmanIds.add("1774376463837065218");
jsonObject.put("salesmanIds",salesmanIds);
jsonObject.put("brandId",xmAppApi.getLoginInfo().getBrandId());
jsonObject.put("studioId",xmAppApi.getLoginInfo().getStudioId());
jsonObject.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers).assetsSuccess(true);
JSONObject response=xmAppApi.getBodyInJSON();
String success=response.getString("success");
Assert.assertEquals(success,"true","筛选财务中心-订单明细小计失败");
}
}
package com.xiaomai.cases.polar.setting.courseCategory;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.springframework.stereotype.Component;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.courseCategory
* @Author: xuyamei
* @CreateTime: 2024-04-29 09:40
* @Description: 课程分类工具类
* @Version: 1.0
*/
@Component("courseCategoryTools")
public class CourseCategoryTools extends XMBaseTest {
/**
* @description: 获取课程分类列表
* @author: xuyamei
* @date: 2024/4/29 08:08
* @param current
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONObject getCourseCategoryDetailPage(int current){
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_courseCategory_getDetailPage")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body= new JSONObject();
body.put("current",current);
body.put("size",10);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
return dataApi.getBodyInJSON();
}
/**
* @description:获取存量的课程分类
* @author: xuyamei
* @date: 2024/5/6 11:32
* @param categoryName :新建的课程类型名称
* @return: java.lang.String
**/
public String getCourseCategoryPage(String categoryName){
// 获取存量的课程分类,列表数据存在则取第二条数据
JSONObject detailPage = getCourseCategoryDetailPage(0);
if (Integer.parseInt(detailPage.getJSONObject("result").getString("total"))>1){
return detailPage.getJSONObject("result").getJSONArray("records").getJSONObject(1).getString("id");
}
// 没有则创建
if (!checkCategoryNameDup(categoryName,"")){
return createCourseCategory(categoryName);
}
return null;
}
/**
* @description:校验课程分类名称重复
* @author: xuyamei
* @date: 2024/4/29 18:55
* @param
* @return: java.lang.String
**/
public boolean checkCategoryNameDup(String categoryName,String oldCategoryId){
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_checkCategoryNameDup")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body = new JSONObject();
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("categoryName",categoryName);
if (oldCategoryId.equals("")){
body.put("oldCategoryId",oldCategoryId);
}
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers);
return dataApi.getBodyInJSON().getBoolean("result");
}
/**
* @description:创建课程分类
* @author: xuyamei
* @date: 2024/4/29 19:16
* @param categoryName
* @return: com.alibaba.fastjson.JSONObject
**/
public String createCourseCategory(String categoryName){
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_createCourseCategory")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body = new JSONObject();
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("categoryName",categoryName);
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers);
return dataApi.getBodyInJSON().getJSONObject("result").getString("id");
}
/**
* @description:删除课程分类
* @author: xuyamei
* @date: 2024/4/29 19:35
* @param categoryId
* @return: void
**/
public void deleteCourseCategory(String categoryId){
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_deleteCourseCategory")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body = new JSONObject();
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("categoryId",categoryId);
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
}
/**
* @description:校验课程分类是否可编辑/删除
* @author: xuyamei
* @date: 2024/4/29 19:40
* @param categoryId :课程分类名称
* @param del:是否编辑操作
* @return:
**/
public boolean canModifyCourseCategory(String categoryId,boolean del){
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_canModifyCourseCategory")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body = new JSONObject();
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("categoryId",categoryId);
body.put("del",del);
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers);
return dataApi.getBodyInJSON().getBoolean("result");
}
}
package com.xiaomai.cases.polar.setting.courseCategory;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.cases.polar.course.CourseTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.courseCategory
* @Author: xuyamei
* @CreateTime: 2024-05-07 10:52
* @Description: 课程分类是否能编辑
* @Version: 1.0
*/
public class TestCanModifyCourseCategory extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
private String categoryId;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_canModifyCourseCategory", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testCanModifyCourseCategory(){
// 创建课程分类
categoryId = courseCategoryTools.createCourseCategory("课程分类"+ TimeUtils.getCurrentTime());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
Assert.assertTrue(courseCategoryTools.canModifyCourseCategory(categoryId,true),"没有被其他场馆使用,正常可以编辑");
}
@Test(description = "清除增量数据",priority = 1)
public void del(){
courseCategoryTools.deleteCourseCategory(categoryId);
}
}
package com.xiaomai.cases.polar.setting.courseCategory;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.courseCategory
* @Author: xuyamei
* @CreateTime: 2024-04-29 18:59
* @Description: 校验课程分类名称是否重复
* @Version: 1.0
*/
public class TestCheckCategoryNameDup extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_checkCategoryNameDup", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testCheckCategoryNameDup(){
boolean flag = courseCategoryTools.checkCategoryNameDup("不存在的课程分类名称","");
Assert.assertFalse(flag,"不存在的课程分类名称提示存在");
}
}
package com.xiaomai.cases.polar.setting.courseCategory;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.courseCategory
* @Author: xuyamei
* @CreateTime: 2024-04-29 09:08
* @Description:创建课程分类
* @Version: 1.0
*/
public class TestCreateCourseCategory extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
private String categoryId;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_courseCategory_getDetailPage", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test(description = "查询要创建的名称是否存在-->不存在则新建-->查询新建之后的数据是否存在")
public void testCourseCategoryGetDetailPage(){
// 查询课程分类是否超过50个上限
JSONObject detailPage = courseCategoryTools.getCourseCategoryDetailPage(0);
if (detailPage.getJSONObject("result").getInteger("total").equals("50"))
return;
String courseCategoryName = "课程分类名称"+ TimeUtils.getCurrentTime();
// 验证课程名称是否重复,不重复则新建
if(courseCategoryTools.checkCategoryNameDup(courseCategoryName,""))
return;
//创建课程分类
categoryId = courseCategoryTools.createCourseCategory(courseCategoryName);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
//获取课程分类详情
detailPage = courseCategoryTools.getCourseCategoryDetailPage(0);
String operatorId = detailPage.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("lastOperatorId"); // 最后操作人
String courseCategoryId = detailPage.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("id"); // 课程分类id
String categoryName = detailPage.getJSONObject("result").getJSONArray("records").getJSONObject(0).getString("categoryName"); // 课程分类名称
Assert.assertEquals(operatorId.equals(xmAppApi.getLoginInfo().getAdminId()) && courseCategoryId.equals(categoryId) && categoryName.equals(courseCategoryName),true,"新建的课程分类与查询的不一致");
}
@Test(description = "清除增量数据",priority = 1)
public void del(){
boolean flag = courseCategoryTools.canModifyCourseCategory(categoryId,true);
if (flag){
courseCategoryTools.deleteCourseCategory(categoryId);
}
}
}
package com.xiaomai.cases.polar.setting.courseCategory;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.cases.polar.course.CourseTools;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.courseCategory
* @Author: xuyamei
* @CreateTime: 2024-05-07 11:07
* @Description: 删除课程分类
* @Version: 1.0
*/
public class TestDeleteCourseCategory extends BaseTestImpl {
@Resource(name = "courseTools")
CourseTools courseTools;
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
private String categoryId;
private String courseId;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_deleteCourseCategory", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@DataProvider()
public Object[][] data(){
return new Object[][]{
{false,"课程分类关联其他课程,不能删除"},
{true,"课程分类没有关联任何课程,无法删除"}
};
}
@Test(dataProvider = "data")
public void testDeleteCourseCategory(boolean flag,String msg) throws InterruptedException {
JSONObject body = new JSONObject();
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
if (flag){
// 删除课程
courseTools.modifyCourseStatus(courseId,"DELETE",false);
}else{
// 创建课程分类
categoryId = courseCategoryTools.createCourseCategory("课程分类"+ TimeUtils.getCurrentTime());
Thread.sleep(1000);
// 创建团课程
courseId = courseTools.createGroupCourse("自动化测试课程",categoryId,"STUDIO");
Thread.sleep(2500);
}
body.put("categoryId",categoryId);
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(flag,msg);
}
}
package com.xiaomai.cases.polar.setting.courseCategory;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.TimeUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.courseCategory
* @Author: xuyamei
* @CreateTime: 2024-04-29 20:02
* @Description: 编辑课程分类
* @Version: 1.0
*/
public class TestEditCourseCategory extends BaseTestImpl {
@Resource(name = "courseCategoryTools")
CourseCategoryTools courseCategoryTools;
private String categoryId;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_editCourseCategory", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test(description = "创建课程分类 --> 编辑课程分类 --> 查询课程分类")
public void testEditCourseCategory() {
String name = "新建课程分类"+ TimeUtils.getCurrentTime();
// 创建课程分类
categoryId = courseCategoryTools.createCourseCategory(name);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
name = name+"_编辑";
// 编辑课程分类
JSONObject body = new JSONObject();
body.put("categoryId",categoryId);
body.put("categoryName",name);
body.put("operatorId",xmAppApi.getLoginInfo().getAdminId());
body.put("studioId",xmAppApi.getLoginInfo().getStudioId());
body.put("brandId",xmAppApi.getLoginInfo().getBrandId());
xmAppApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
//获取课程分类详情
JSONArray detailPage = courseCategoryTools.getCourseCategoryDetailPage(0).getJSONObject("result").getJSONArray("records");
for (int i = 0; i < detailPage.size(); i++){
if (detailPage.getJSONObject(i).getString("id").equals(categoryId)){
String operatorId = detailPage.getJSONObject(0).getString("lastOperatorId"); // 最后操作人
String categoryName = detailPage.getJSONObject(0).getString("categoryName"); // 课程分类名称
// 校验编辑后的课程分类名称及操作人
Assert.assertEquals(operatorId.equals(xmAppApi.getLoginInfo().getAdminId()) && categoryName.equals(name),true,"编辑的课程分类与查询后的不一致");
break;
}
}
}
@Test(description = "清除增量数据",priority = 1)
public void del(){
boolean flag = courseCategoryTools.canModifyCourseCategory(categoryId,true);
if (flag){
courseCategoryTools.deleteCourseCategory(categoryId);
}
}
}
package com.xiaomai.cases.polar.setting.rules;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.springframework.stereotype.Component;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.rules
* @Author: xuyamei
* @CreateTime: 2024-05-13 16:10
* @Description: 预约规则工具类
* @Version: 1.0
*/
@Component("ruleTools")
public class RuleTools extends XMBaseTest {
/**
* @description:保存预约规则
* @author: xuyamei
* @date: 2024/5/13 17:31
* @param id :规则id
* @param allowQueuing:是否允许排队
* @param bookingSeatCount:预约人数
* @param xcxAutoSignIn:小程序自主签到
* @param scanSignIn:扫码签到
* @param signInBeforeMinutes:开课前多少分钟允许签到
* @param startRuleRequestLimit:是否开启预约时间限制
* @param startComingDayMinuteOffset:几点开放预约
* @param startComingDays:可约近几天的课
* @param endRuleRequestLimit:是否开启截止预约限制
* @param endBeforeMinutes:截止预约时间
* @param endBeforeUnit:截止预约时间单位
* @param cancelRuleLimit:是否开启取消预约限制
* @param cancelMinutes:截止取消预约时间
* @param cancelUnit:截止取消预约时间单位
**/
public void saveGroupBookingRules(String id,boolean allowQueuing,int bookingSeatCount,boolean xcxAutoSignIn,boolean scanSignIn,int signInBeforeMinutes,boolean startRuleRequestLimit,int startComingDayMinuteOffset,int startComingDays,boolean endRuleRequestLimit,int endBeforeMinutes,String endBeforeUnit,boolean cancelRuleLimit,int cancelMinutes,String cancelUnit){
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_saveGroupBookingRules")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body = new JSONObject();
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
body.put("id",id); // 规则id
body.put("allowQueuing",allowQueuing); // 是否允许排队
body.put("bookingSeatCount",bookingSeatCount); // 预约席位
body.put("xcxAutoSignIn",xcxAutoSignIn); // 小程序签到
body.put("scanSignIn",scanSignIn); // 扫码签到
body.put("signInBeforeMinutes",signInBeforeMinutes); // 开课前多久允许签到
JSONObject bookingStartRuleRequest = new JSONObject(); // 预约时间限制
if (startRuleRequestLimit){ // 开启预约时间限制
bookingStartRuleRequest.put("bookingStartComingDayMinuteOffset",startComingDayMinuteOffset); // 几点开放预约
bookingStartRuleRequest.put("bookingStartComingDays",startComingDays); // 可约近几天的课
}
bookingStartRuleRequest.put("limit",startRuleRequestLimit); // 是否开启预约时间限制
body.put("bookingStartRuleRequest",bookingStartRuleRequest); // 预约时间限制
JSONObject bookingEndRuleRequest = new JSONObject(); // 截止预约限制
if (endRuleRequestLimit){
bookingEndRuleRequest.put("bookingEndBeforeMinutes",endBeforeMinutes); // 截止预约前多长时间
bookingEndRuleRequest.put("bookingEndBeforeUnit",endBeforeUnit); // 单位
}
bookingEndRuleRequest.put("limit",endRuleRequestLimit); // 截止预约限制
body.put("bookingEndRuleRequest",bookingEndRuleRequest); //截止时间限制
JSONObject cancelStartClassRuleRequest = new JSONObject(); // 取消开课限制
cancelStartClassRuleRequest.put("limit",false);
body.put("cancelStartClassRuleRequest",cancelStartClassRuleRequest);
JSONObject cancelBookingRuleRequest = new JSONObject();
if (cancelRuleLimit){
cancelBookingRuleRequest.put("cancelBookingBeforeMinutes",cancelMinutes); // 开课前截止取消预约
cancelBookingRuleRequest.put("cancelBookingBeforeUnit",cancelUnit); // 单位
}
cancelBookingRuleRequest.put("limit",cancelRuleLimit);
body.put("cancelBookingRuleRequest",cancelBookingRuleRequest);
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
}
/**
* @description:获取团课预约规则
* @author: xuyamei
* @date: 2024/5/13 16:27
* @param
* @return: com.alibaba.fastjson.JSONObject
**/
public JSONObject getGroupBookingRules(){
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_getGroupBookingRules")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body= new JSONObject();
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
}
package com.xiaomai.cases.polar.setting.rules;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import javax.annotation.Resource;
import java.util.Random;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.rules
* @Author: xuyamei
* @CreateTime: 2024-05-13 16:05
* @Description: 保存规则
* @Version: 1.0
*/
public class TestSaveGroupBookingRules extends BaseTestImpl {
@Resource(name = "ruleTools")
RuleTools ruleTools;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_saveGroupBookingRules", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@DataProvider
public Object[][] dataProvider(){
Random random = new Random();
int bookingSeatCount = random.nextInt(10)+1; // 席位
return new Object[][]{
{true,bookingSeatCount,true,true,random.nextInt(30)+10,true,random.nextInt(1000)+10,random.nextInt(5)+1,true,random.nextInt(1000)+10,"hour",true,random.nextInt(1000)+10,"hour"},
{false,bookingSeatCount,false,false,random.nextInt(30)+10,false,random.nextInt(1000)+10,random.nextInt(5)+1,false,random.nextInt(1000)+10,"hour",false,random.nextInt(1000)+10,"hour"},
};
}
@Test(dataProvider = "dataProvider")
public void testSaveGroupBookingRules(boolean allowQueuing,int bookingSeatCount,boolean xcxAutoSignIn,boolean scanSignIn,int signInBeforeMinutes,
boolean bookingStartRuleRequest,int startComingDayMinuteOffset,int startComingDays,boolean bookingEndRuleRequest,
int endBeforeMinutes,String endBeforeUnit,boolean cancelBookingRuleRequest,int cancelBookingBeforeMinutes,String cancelBookingBeforeUnit) {
JSONObject getRules = ruleTools.getGroupBookingRules(); // 获取场馆团课预约规则
String id = getRules.getString("id"); // 获取规则id
ruleTools.saveGroupBookingRules(id,allowQueuing,bookingSeatCount,xcxAutoSignIn,scanSignIn,signInBeforeMinutes,bookingStartRuleRequest,startComingDayMinuteOffset,startComingDays,bookingEndRuleRequest,endBeforeMinutes,endBeforeUnit,cancelBookingRuleRequest,cancelBookingBeforeMinutes,cancelBookingBeforeUnit);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
getRules = ruleTools.getGroupBookingRules(); // 获取场馆团课预约规则
for (int i = 0; i < 14; i++){
Assert.assertEquals(getRules.getBooleanValue("allowQueuing"),allowQueuing);
Assert.assertEquals(getRules.getIntValue("bookingSeatCount"),bookingSeatCount);
Assert.assertEquals(getRules.getBooleanValue("xcxAutoSignIn"),xcxAutoSignIn);
Assert.assertEquals(getRules.getBooleanValue("scanSignIn"),scanSignIn);
Assert.assertEquals(getRules.getIntValue("signInBeforeMinutes"),signInBeforeMinutes);
if (bookingStartRuleRequest){ // 预约时间限制
Assert.assertEquals(getRules.getJSONObject("groupBookingStartRuleVO").getIntValue("bookingStartComingDays"),startComingDays);
Assert.assertEquals(getRules.getJSONObject("groupBookingStartRuleVO").getIntValue("bookingStartComingDayMinuteOffset"),startComingDayMinuteOffset);
}
Assert.assertEquals(getRules.getJSONObject("groupBookingStartRuleVO").getBooleanValue("limit"),bookingStartRuleRequest);
if (bookingEndRuleRequest){ // 截止预约时间限制
Assert.assertEquals(getRules.getJSONObject("groupBookingEndRuleVO").getIntValue("bookingEndBeforeMinutes"),endBeforeMinutes);
Assert.assertEquals(getRules.getJSONObject("groupBookingEndRuleVO").getString("bookingEndBeforeUnit"),endBeforeUnit);
}
Assert.assertEquals(getRules.getJSONObject("groupBookingEndRuleVO").getBooleanValue("limit"),bookingEndRuleRequest);
if (cancelBookingRuleRequest){ // 取消预约限制
Assert.assertEquals(getRules.getJSONObject("cancelGroupBookingRuleVO").getIntValue("cancelBookingBeforeMinutes"),cancelBookingBeforeMinutes);
Assert.assertEquals(getRules.getJSONObject("cancelGroupBookingRuleVO").getString("cancelBookingBeforeUnit"),cancelBookingBeforeUnit);
}
Assert.assertEquals(getRules.getJSONObject("cancelGroupBookingRuleVO").getBooleanValue("limit"),cancelBookingRuleRequest);
}
}
}
package com.xiaomai.cases.polar.setting.venue;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.venue
* @Author: xuyamei
* @CreateTime: 2024-05-08 11:25
* @Description: 创建场地
* @Version: 1.0
*/
public class TestCreateVenueArea extends BaseTestImpl {
@Resource(name = "venueAreaTools")
VenueAreaTools venueAreaTools;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_createVenueArea", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
private String groupId;
@Test
public void testCreateVenueArea() {
String name = "瑜伽场地" + System.currentTimeMillis();
groupId = venueAreaTools.createVenueArea(name);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
// check:新建之后查询列表数据
JSONObject response = venueAreaTools.getVenueAreaPage();
String id = response.getJSONArray("records").getJSONObject(0).getString("groupId");
String groupName = response.getJSONArray("records").getJSONObject(0).getString("groupName");
Assert.assertEquals(id.equals(groupId) && groupName.equals(name) , true,"新建之后查询到的数据与新建不一致");
}
@Test(description = "清除增量数据",priority = 1)
public void del() {
venueAreaTools.deleteVenueArea(groupId);
}
}
package com.xiaomai.cases.polar.setting.venue;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.venue
* @Author: xuyamei
* @CreateTime: 2024-05-08 14:37
* @Description: 删除场地
* @Version: 1.0
*/
public class TestDeleteVenueArea extends BaseTestImpl {
@Resource(name = "venueAreaTools")
VenueAreaTools venueAreaTools;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_createVenueArea", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
@Test
public void testCreateVenueArea() {
// 新建之前查询列表数据
JSONObject response = venueAreaTools.getVenueAreaPage();
int beforeTotal = Integer.parseInt(response.getString("total"));
String name = "瑜伽场地" + System.currentTimeMillis();
String groupId = venueAreaTools.createVenueArea(name);
// 删除场地
venueAreaTools.deleteVenueArea(groupId);
// check:删除之后查询列表数据
response = venueAreaTools.getVenueAreaPage();
int afterTotal = Integer.parseInt(response.getString("total"));
Assert.assertEquals(afterTotal-beforeTotal, 0,"删除之后列表数据没有减少");
}
}
package com.xiaomai.cases.polar.setting.venue;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.basetest.BaseTestImpl;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.LoginAccount;
import com.xiaomai.enums.Terminal;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import javax.annotation.Resource;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.venue
* @Author: xuyamei
* @CreateTime: 2024-05-08 14:33
* @Description: 编辑场地
* @Version: 1.0
*/
public class TestEditVenueArea extends BaseTestImpl {
@Resource(name = "venueAreaTools")
VenueAreaTools venueAreaTools;
@BeforeClass
public void beforeTest(){
setTestInfo(ApiModule.Polar_Setting,"API_editVenueArea", LoginAccount.GYM_PROD, Terminal.B,"xym");
super.beforeTest();
}
private String groupId;
@Test
public void testEditVenueArea() {
String name = "瑜伽场地" + System.currentTimeMillis();
groupId = venueAreaTools.createVenueArea(name);
// 编辑名称
name = "编辑瑜伽场地"+System.currentTimeMillis();
venueAreaTools.editVenueAreaPage(groupId,name);
// check:编辑之后查询列表数据
JSONObject response = venueAreaTools.getVenueAreaPage();
String id = response.getJSONArray("records").getJSONObject(0).getString("groupId");
String groupName = response.getJSONArray("records").getJSONObject(0).getString("groupName");
Assert.assertEquals(id.equals(groupId) && groupName.equals(name) , true,"编辑之后查询到的数据与编辑不一致");
}
@Test(description = "清除增量数据",priority = 1)
public void del() {
venueAreaTools.deleteVenueArea(groupId);
}
}
package com.xiaomai.cases.polar.setting.venue;
import com.alibaba.fastjson.JSONObject;
import com.xiaomai.enums.ApiModule;
import com.xiaomai.enums.RequestType;
import com.xiaomai.enums.Terminal;
import com.xiaomai.utils.XMBaseTest;
import org.springframework.stereotype.Component;
/**
* @BelongsProject: xm-sportstest
* @BelongsPackage: com.xiaomai.cases.polar.setting.venue
* @Author: xuyamei
* @CreateTime: 2024-05-08 11:26
* @Description: 场地工具类
* @Version: 1.0
*/
@Component("venueAreaTools")
public class VenueAreaTools extends XMBaseTest {
/**
* @description:创建场地
* @author: xuyamei
* @date: 2024/5/8 13:55
* @param areaName:场地名称
* @return: java.lang.String
**/
public String createVenueArea(String areaName) {
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_createVenueArea")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body = new JSONObject();
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
body.put("groupName",areaName);
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
return dataApi.getBodyInJSON().getString("result");
}
public void deleteVenueArea(String groupId) {
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_deleteVenueArea")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body= new JSONObject();
body.put("groupId",groupId);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
}
/**
* @description:查看场地列表数据
* @author: xuyamei
* @date: 2024/5/8 13:58
* @return: :返回列表数据
**/
public JSONObject getVenueAreaPage() {
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_getVenueAreaPage")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body= new JSONObject();
body.put("current",0);
body.put("size",20);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
/**
* @description:编辑场地
* @author: xuyamei
* @date: 2024/5/8 14:14
* @param groupId :场地id
* @param groupName :场地名称
* @return: void
**/
public void editVenueAreaPage(String groupId,String groupName) {
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_editVenueArea")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body= new JSONObject();
body.put("groupName",groupName);
body.put("groupId",groupId);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
}
/**
* @description:根据课程id获取场地详情
* @author: xuyamei
* @date: 2024/5/8 14:14
* @param courseId :课程id
* @return:
**/
public JSONObject getListByStudioCourseId(String courseId){
dataApi.setApiModule(ApiModule.Polar_Setting)
.setApiName("API_getListByStudioCourseId")
.setTerminal(Terminal.B);
super.beforeDataRequest();
JSONObject body= new JSONObject();
body.put("brandCourseId",courseId);
body.put("brandId",dataApi.getLoginInfo().getBrandId());
body.put("studioId",dataApi.getLoginInfo().getStudioId());
body.put("operatorId",dataApi.getLoginInfo().getAdminId());
dataApi.doRequest(RequestType.JSON,params,body.toString(),headers).assetsSuccess(true);
return dataApi.getBodyInJSON().getJSONObject("result");
}
}
......@@ -10,6 +10,9 @@ public class ApiModule {
public static String Polar_Setting ="polar_setting";//通用设置
public static String Polar_Clue ="polar_clue";
public static String Polar_Member ="polar_member";//会员管理
public static String Polar_Course ="polar_course";//会员管理
public static String Polar_Finance="polar_finance";//财务中心
......
......@@ -10,5 +10,9 @@ public class LoginAccount {
public static String YFF_DEV = "yff_dev";
public static String ZYX_DEV = "zyx_dev";
public static String ADU_PROD = "adu_prod";
public static String GYM_PROD = "GYM_PROd" +
"";
}
#默认执行环境
env=dev
env=prod
# Dev
dev=https://dev-fit.xiaomai5.com
#rc
......@@ -7,9 +7,9 @@ dev=https://dev-fit.xiaomai5.com
# gray
#gray=https://gray-heimdall.xiaomai5.com
#prod
#prod=https://heimdall.xiaomai5.com
prod=https://prod-fit.xiaomai5.com
# 测试运行环境 本地调试时,可指定调试环境。完成本地调试后,请注释此变量
#runningEnv = gray
testData=\\src\\main\\resources\\dataprovider\\APIcase.xls
# �����˺�
testAccount=/src/main/resources/parameter.json
\ No newline at end of file
#testAccount=/src/main/resources/parameter.json
\ No newline at end of file
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