Commit 84115892 authored by 马博's avatar 马博

update

parent fdecc52f
......@@ -71,6 +71,7 @@ public class 修改兑吧商品_ExchangeTest extends DuibaTestBase {
//编辑
doUpdateAppItemService.doUpdateAppItem(appId,appItemId,title,"10","coupon","31658");
Response response2=developerObjectService.editAppItem2(appItemId);
System.out.println(response2.asString());
Assert.assertEquals(response2.jsonPath().getString("data.title"), "【SaaS-自动化测试】优惠券勿动", "校验兑吧优惠券商品标题失败");
Assert.assertEquals(response2.jsonPath().getString("data.credits"), "10", "校验兑吧优惠券商品失败");
......
......@@ -489,6 +489,11 @@ public class 新集卡_开奖流程_DuibaTest extends DuibaTestBase {
}
return statusResponse;
}
// @Test
public void test() throws Exception {
Response response = openPrize("5193",2691,"nomal");
response.prettyPrint();
}
......
......@@ -171,6 +171,7 @@ public class 秒杀自有老虚拟商品_兑换限制_SeckillTest extends DuibaT
queryResponse.prettyPrint();
// if(queryResponse.asString().contains("好可惜,没抢到"))return;
String orderId = MatcherString.getString(queryResponse.asString(),"orderId: '(.*?)'",1);
......
package http.cases.SignTest;
import base.DuibaTestBase;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.hd.SigninService;
......@@ -12,10 +14,9 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CountDownLatch;
public class ContractSign_Cash_signTest extends DuibaTestBase {
@Autowired
......@@ -175,11 +176,44 @@ public class ContractSign_Cash_signTest extends DuibaTestBase {
Assert.assertEquals(doneStatus, "WAIT_REWARD", "当前期次完成状态不正确");
String winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "33333", "瓜分奖励金额不正确");
//领奖
Response rewardRes = ContractSignService.getReward(contractId1,uid1);
String rewardStatus = rewardRes.jsonPath().getString("success");
String rewardAmount = rewardRes.jsonPath().getString("data");
//领奖-并发
CountDownLatch latch = new CountDownLatch(5);
List<String> list = new CopyOnWriteArrayList();
for (int i = 0; i < 5; i++) {
new Thread(() -> {
try {
Response rewardRes = ContractSignService.getReward(contractId1,uid1);
list.add(rewardRes.asString());
} catch (Exception e) {
e.printStackTrace();
}
latch.countDown();
}).start();
}
latch.await();
int fail=0,success=0;
JSONObject json=null;
for (String s:
list) {
if(s.contains("操作太频繁啦,稍后再试")){
fail++;
}else{
success++;
json = JSON.parseObject(s);
}
}
String rewardAmount = json.getString("data");
String rewardStatus = json.getString("success");
Assert.assertEquals(rewardStatus,"true","领取奖励结果不正确");
Assert.assertEquals(rewardAmount,winCount,"领取奖励金额不正确");
Assert.assertEquals(fail,4);
}
}
......@@ -14,10 +14,8 @@ import io.restassured.response.Response;
import java.net.SocketImpl;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutionException;
import utils.RedisUtil;
......@@ -361,7 +359,27 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
rewardRes = ContractSignService.getReward(contractId4,uid4);
rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 4125, "uid4领取奖励数不正确");
List<String> list = new CopyOnWriteArrayList<>();
// uid6领奖
// for (int i = 0; i < 20; i++) {
// new Thread(() -> {
// try {
// Response rewardRess = ContractSignService.getReward(contractId6, uid6);
// list.add(rewardRess.asString());
// } catch (Exception e) {
// e.printStackTrace();
// }
//
//
// }).start();
//
// }
// Thread.sleep(20000);
// for (String s:
// list) {
// System.out.println(s);
// }
rewardRes = ContractSignService.getReward(contractId6,uid6);
rewardCount = rewardRes.jsonPath().getInt("data");
Assert.assertEquals(rewardCount, 825, "uid6领取奖励数不正确");
......@@ -373,6 +391,12 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
String desc = rewardRes.jsonPath().getString("desc");
Assert.assertEquals(success, "false", "uid1领取结果不正确");
Assert.assertEquals(desc,"领奖处理失败","uid1领取描述不正确");
rewardRes = ContractSignService.getReward(contractId6,uid6);
rewardRes.prettyPrint();
}
//@Test(description = "多梯度中奖轮播",priority = 7,dependsOnMethods = { "多梯度领奖" })
......
......@@ -207,13 +207,13 @@ public class ContractSignService {
map.put("contractId", ContractId);
logger.info("请求getReward接口,契约id=" + ContractId);
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(activityHost+"/sign/contract/getReward");
try{
Assert.assertEquals(response.jsonPath().getString("success"), "true", "/sign/contract/getReward接口请求失败");
} catch (Exception e) {
throw new Exception("/sign/contract/getReward接口失败,返回信息" + response.asString());
} catch (Error er) {
throw new Exception("/sign/contract/getReward接口失败,返回信息:" + response.asString());
}
// try{
// Assert.assertEquals(response.jsonPath().getString("success"), "true", "/sign/contract/getReward接口请求失败");
// } catch (Exception e) {
// throw new Exception("/sign/contract/getReward接口失败,返回信息" + response.asString());
// } catch (Error er) {
// throw new Exception("/sign/contract/getReward接口失败,返回信息:" + response.asString());
// }
return response;
}
......
package ui.cases;
import base.DuibaBaseUi;
import base.DuibaBases;
import base.DuibaLog;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.codeborne.selenide.WebDriverRunner;
import com.codeborne.selenide.testng.ScreenShooter;
import http.service.Authorization;
import io.restassured.response.Response;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.ITestResult;
import org.testng.Reporter;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
import ui.common.ProxyFactory;
import ui.common.StatusCheckor;
import ui.common.WebDriverFactory;
import ui.common.WebDriverType;
import utils.MatcherString;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import static com.codeborne.selenide.Condition.text;
import static com.codeborne.selenide.Selenide.$;
import static com.codeborne.selenide.Selenide.open;
import static com.codeborne.selenide.Selenide.sleep;
......@@ -247,9 +230,9 @@ public class test extends DuibaBases {
@Test
public void 红包广场(){
// Map<String,String> map = new HashMap<>();
// map.put("opId","22489");
// map.put("shareCode","11nrktm");
// map.put("uid","4885");
// map.put("opId","22877");
// map.put("shareCode","11nszu");
// map.put("uid","1");
//
// String url = "http://activity.m.duibatest.com.cn";
//
......@@ -257,7 +240,10 @@ public class test extends DuibaBases {
// header.put("User-Agent","windows mabo");
//
//
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(4885));
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(1));
// cookie.put("_duibaServiceGroupKey","miria-938");
//
//
// //有拦截日志,接口返回true
// Response response = given().headers(header).cookies(cookie).params(map).post(url+"/aaw/lotterySquare/shareLinkClick");
// response.prettyPrint();
......@@ -266,9 +252,9 @@ public class test extends DuibaBases {
Map<String,String> map = new HashMap<>();
map.put("opId","22489");
map.put("shareCode","11nrktm");
map.put("acitivityId","59");
map.put("opId","22877");
map.put("shareCode","11nszu");
map.put("acitivityId","1");
String url = "http://activity.m.duibatest.com.cn";
......@@ -276,7 +262,8 @@ public class test extends DuibaBases {
header.put("User-Agent","windows mabo");
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(4885));
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(1));
cookie.put("_duibaServiceGroupKey","miria-938");
//有拦截日志,接口返回true
Response response = given().headers(header).cookies(cookie).params(map).post(url+"/aaw/lotterySquare/bind");
response.prettyPrint();
......@@ -290,36 +277,37 @@ public class test extends DuibaBases {
@Test
public void 砍价(){
// Map<String,String> map = new HashMap<>();
// map.put("goodsId","6");
// map.put("activityId","1");
//
// String url = "http://activity.m.duibatest.com.cn";
//
// Map<String,String> header = new HashMap<>();
// header.put("User-Agent","windows mabo");
//
//
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(4662));
// Response response = given().headers(header).cookies(cookie).params(map).post(url+"/aaw/bargainActivity/doBargain");
// response.prettyPrint();
Map<String,String> map = new HashMap<>();
map.put("orderId","246");
map.put("goodsId","6");
map.put("activityId","1");
String url = "http://activity.m.duibatest.com.cn";
Map<String,String> header = new HashMap<>();
// header.put("User-Agent","windows mabo");
header.put("User-Agent","windows mabo");
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(4817));
Response response = given().headers(header).cookies(cookie).params(map).post(url+"/aaw/bargainActivity/helpBargain");
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(4662));
cookie.put("_duibaServiceGroupKey","miria-938");
Response response = given().headers(header).cookies(cookie).params(map).post(url+"/aaw/bargainActivity/doBargain");
response.prettyPrint();
// Map<String,String> map = new HashMap<>();
// map.put("orderId","246");
// map.put("activityId","1");
//
// String url = "http://activity.m.duibatest.com.cn";
//
// Map<String,String> header = new HashMap<>();
//// header.put("User-Agent","windows mabo");
//
//
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(4817));
// Response response = given().headers(header).cookies(cookie).params(map).post(url+"/aaw/bargainActivity/helpBargain");
// response.prettyPrint();
}
@Test
......@@ -443,9 +431,28 @@ public class test extends DuibaBases {
Map<String,String> map = new HashMap<>();
map.put("id","90");
// map.put("signDate",getTime(0));
String url = "http://activity.m.duibatest.com.cn";
Map<String,String> header = new HashMap<>();
header.put("User-Agent","windows mabo");
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(6));
cookie.put("_duibaServiceGroupKey","miria-938");
Response response = given().headers(header).cookies(cookie).params(map).get(url+"/signactivity/doSign");
response.prettyPrint();
// Map<String,String> map = new HashMap<>();
// map.put("id","90");
//// map.put("signDate",getTime(0));
// map.put("signDate",getTime(0));
//
// String url = "http://activity.m.duibatest.com.cn";
//
......@@ -454,43 +461,45 @@ public class test extends DuibaBases {
//
//
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(6));
// Response response = given().headers(header).cookies(cookie).params(map).get(url+"/signactivity/doSign");
// Response response = given().headers(header).cookies(cookie).params(map).get(url+"/signactivity/reSign");
// response.prettyPrint();
}
Map<String,String> map = new HashMap<>();
map.put("id","90");
map.put("signDate",getTime(0));
@Test
public void 契约签到(){
String url = "http://activity.m.duibatest.com.cn";
Map<String,String> header = new HashMap<>();
header.put("User-Agent","windows mabo");
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(6));
Response response = given().headers(header).cookies(cookie).params(map).get(url+"/signactivity/reSign");
response.prettyPrint();
}
@Test
public void 契约签到(){
Map<String,String> map = new HashMap<>();
map.put("activityId","149");
map.put("betAmount","100");
String url = "http://activity.m.duibatest.com.cn";
Map<String,String> header = new HashMap<>();
header.put("User-Agent","windows mabo");
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(2));
cookie.put("_duibaServiceGroupKey","miria-938");
Response response = given().headers(header).cookies(cookie).params(map).get(url+"/sign/contract/doJoin");
response.prettyPrint();
// Map<String,String> map = new HashMap<>();
// map.put("activityId","149");
// map.put("betAmount","100");
//
// String url = "http://activity.m.duibatest.com.cn";
//
......@@ -499,14 +508,13 @@ public class test extends DuibaBases {
//
//
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(2));
// Response response = given().headers(header).cookies(cookie).params(map).get(url+"/sign/contract/doJoin");
// Response response = given().headers(header).cookies(cookie).params(map).get(url+"/sign/contract/doSign");
// response.prettyPrint();
// Map<String,String> map = new HashMap<>();
// map.put("activityId","149");
// map.put("contractId","3123");
//
// String url = "http://activity.m.duibatest.com.cn";
//
......@@ -514,27 +522,12 @@ public class test extends DuibaBases {
// header.put("User-Agent","windows mabo");
//
//
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(2));
// Response response = given().headers(header).cookies(cookie).params(map).get(url+"/sign/contract/doSign");
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(5));
// Response response = given().headers(header).cookies(cookie).params(map).get(url+"/sign/contract/getReward");
// response.prettyPrint();
Map<String,String> map = new HashMap<>();
map.put("contractId","3123");
String url = "http://activity.m.duibatest.com.cn";
Map<String,String> header = new HashMap<>();
header.put("User-Agent","windows mabo");
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(5));
Response response = given().headers(header).cookies(cookie).params(map).get(url+"/sign/contract/getReward");
response.prettyPrint();
......@@ -557,6 +550,7 @@ public class test extends DuibaBases {
Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(3580));
cookie.put("_duibaServiceGroupKey","miria-938");
Response response = given().headers(header).cookies(cookie).params(map).post(url+"/signpet/adopte");
response.prettyPrint();
......@@ -820,4 +814,82 @@ public class test extends DuibaBases {
@Test
public void 日历签到补签(){
Map<String,String> map = new HashMap<>();
map.put("id","90");
map.put("signDate",getTime(0));
String url = "http://activity.m.duibatest.com.cn";
Map<String,String> header = new HashMap<>();
// header.put("User-Agent","windows mabo");
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(6));
Response response = given().get("http://activity.m.duibatest.com.cn/hdtool/duiba?id=35709&appKey=jlg88lyxz7siqtmr&openBs=openbs");
response.getCookies();
response = given().headers(header).cookies(response.getCookies()).params(map).get(url+"/signactivity/reSign");
response.prettyPrint();
}
@Test
public void 契约签到1(){
Map<String,String> map = new HashMap<>();
map.put("activityId","131");
map.put("betAmount","100");
String url = "http://activity.m.duibatest.com.cn";
Response response = given().get("http://activity.m.duibatest.com.cn/hdtool/duiba?id=35709&appKey=jlg88lyxz7siqtmr&openBs=openbs");
Map<String,String> cookies = response.getCookies();
Response response1 = given().cookies(cookies).params(map).get(url+"/sign/contract/doJoin");
response1.prettyPrint();
Map<String,String> map1 = new HashMap<>();
map1.put("activityId","131");
// String url = "http://activity.m.duibatest.com.cn";
// Response response = given().get("http://activity.m.duibatest.com.cn/hdtool/duiba?id=35709&appKey=jlg88lyxz7siqtmr&openBs=openbs");
response = given().cookies(cookies).params(map1).get(url+"/sign/contract/doSign");
response.prettyPrint();
// Map<String,String> map = new HashMap<>();
// map.put("contractId","3123");
//
// String url = "http://activity.m.duibatest.com.cn";
//
// Map<String,String> header = new HashMap<>();
// header.put("User-Agent","windows mabo");
//
//
// Map<String,String> cookie = new HashMap<>(authorization.dafuwengLoginTest(5));
// Response response = given().headers(header).cookies(cookie).params(map).get(url+"/sign/contract/getReward");
// response.prettyPrint();
}
}
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