public void testThirdPayYJX() throws Exception { // 用户相关信息 UserDTO user = (new UserSet()).setNormalUser(); String username = user.getUsername(); String password = user.getPassword(); String payPwd = user.getPayPwd(); int loginId = user.getLoginId(); BigDecimal acc = user.getAcc(); // 账户最低余额:0-普通账户,-5000-vip账户 BigDecimal before_pay = null; // 支付前账户余额 BigDecimal after_pay = null; // 支付后账户余额 // 产品相关信息 ProductDTO[] products = new ProductDTO[2]; products[0] = (new ProductSet()).setYJX(); products[1] = (new ProductSet()).setYJX_Coupon(); // 登录 Ins_Front insF = new Ins_Front(); insF.loginFront(selenium, username, password); for (int i = 0; i < products.length; i++) { System.out.println(i + 1); String proName = products[i].getProName(); String proType = products[i].getProductType(); int coupon = products[i].getPCoupon(); // 支付时是否可以使用优惠券:0-不可以,1-可以 // 前台购买保险产品,购买前查询账户余额 before_pay = (new CommSql()).getAccBall(loginId, acc); PayResultDTO payResult = insF.pay_YJX(selenium, proName, payPwd, 4, true, loginId); Thread.sleep(30000); after_pay = (new CommSql()).getAccBall(loginId, acc); System.out.println("购买前账户余额:" + before_pay); System.out.println("购买后账户余额:" + after_pay); // 支付完成后判断订单、投保单状态及账户余额的正确性 CheckAfterPay check = new CheckAfterPay(); check.checkAfterThirdPay(selenium, before_pay, after_pay, payResult, coupon, proType); } }
@Test public void testTuiBao_XJ() throws Exception { selenium.open("/"); selenium.click("lra24"); selenium.waitForPageToLoad("30000"); selenium.type("username", "api-xiejie"); selenium.type("input2", "654321"); selenium.click("loginBut"); // 前台投保获得订单号 String orderID; Ins_Front inf = new Ins_Front(); orderID = inf.buy_YJX(selenium, "华泰“安达天下”国际旅游保险成人计划标准款", 8257, 1); selenium.type("payPwd", "65432100"); selenium.click("subAcc"); selenium.waitForPageToLoad("30000"); // 调用数据库,根据订单号获得投保单号 /*String u = "192.168.1.217"; Connection conn = DBManager.getConnection(u);*/ CommSql sql = new CommSql(); // AppDTO[] app=sql.getAppInfo(conn,orderID,""); AppDTO[] app = sql.getAppInfo(orderID); String AppID; AppID = app[0].getAppId(); Thread.sleep(30000); // 在新窗口中打开后台 String url = "http://cst.xyz.cn"; String win = "window"; selenium.openWindow(url, win); selenium.waitForPopUp("window", "30000"); selenium.selectWindow("window"); selenium.type("textfield2", "xiejie"); selenium.type("textfield", "654321"); selenium.click("//button[@type='submit']"); selenium.waitForPageToLoad("30000"); selenium.click("link=保单管理"); selenium.waitForPageToLoad("30000"); selenium.type("APP_ID", AppID); selenium.click("searchBtn"); selenium.waitForPageToLoad("30000"); selenium.click("link=退保登记"); selenium.waitForPageToLoad("30000"); selenium.type("policySurrenderDto.applyReason", "12345"); selenium.type("policySurrenderDto.applyName", "谢洁"); selenium.type("policySurrenderDto.applyTel", "86509906"); selenium.select("idtype", "label=军官证"); selenium.click("//option[@value='armcard']"); selenium.type("policySurrenderDto.cardNo", "123"); selenium.click("surrenderCheck"); // 上传文件 Thread.sleep(10000); String baseRoot = System.getProperty("user.dir"); String CancelINSAffixUp = null; Properties p = new Properties(); InputStream in = new FileInputStream(new File("src/test/resources/instest-sys.properties")); p.load(in); CancelINSAffixUp = baseRoot + p.getProperty("CancelINSAffixUp"); Runtime.getRuntime().exec(CancelINSAffixUp); // Runtime.getRuntime().exec("D:\\ins-seleniumTest\\src\\test\\resources\\AutoIt\\CancelINSAffixUp.exe"); Thread.sleep(15000); selenium.click("link=上传"); Thread.sleep(15000); selenium.click("//button[@type='submit']"); Thread.sleep(15000); // 查询数据库,获取保单ID // AppDTO policy=sql.getPolicyInfo(conn,AppID); PolicyDTO policy = sql.getPolicyInfo(AppID); String policyID; policyID = policy.getPolicyNo(); Thread.sleep(30000); // 开始退保 selenium.type("POLICY_NO", policyID); selenium.click("searchBtn"); selenium.waitForPageToLoad("30000"); selenium.click("link=处理"); selenium.waitForPageToLoad("30000"); selenium.click("surrenderCheck"); selenium.click("toAudit"); selenium.waitForPageToLoad("30000"); selenium.type("POLICY_NO", policyID); selenium.click("link=审核"); selenium.waitForPageToLoad("30000"); selenium.click("surrenderCheck"); selenium.click("//input[@name=\"policySurrenderDto.surrenderStatus\"][1]"); selenium.click("//button[@type='submit']"); // 查询保单状态 Thread.sleep(30000); // AppDTO policy1=sql.getPolicyInfo(conn,AppID); PolicyDTO policy1 = sql.getPolicyInfo(AppID); int policyStatus = policy1.getPolicyStatus(); if (policyStatus == 2) { System.out.print("退保成功"); } else { System.out.print("退保未成功"); } }