Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java =================================================================== diff -u -r19060 -r19061 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java (.../ALL.java) (revision 19060) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java (.../ALL.java) (revision 19061) @@ -33,9 +33,7 @@ * */ -public class ALL -//extends AbstractCSSDTest -{ +public class ALL extends AbstractCSSDTest { protected Logger logger = Logger.getLogger(this.getClass()); @@ -90,11 +88,9 @@ login.login_secondSupplyRoom(true); Utils.retryingFindAndClick(By.id("enterpriseView")); Utils.retryingFindAndSwitchToFrame(By.id("iframe_enterpriseView")); - Utils.retryingFindAndClick(By - .xpath("//div/span[contains(text(), '后台监控管理')]")); + Utils.retryingFindAndClick(By.xpath("//div/span[contains(text(), '后台监控管理')]")); - Utils.retryingFindAndClick(By - .xpath("//div/a/span[contains(text(), '一次性物品管理')]")); + Utils.retryingFindAndClick(By.xpath("//div/a/span[contains(text(), '一次性物品管理')]")); one.One_use_Entry_success(); one.after(); @@ -107,125 +103,81 @@ @Test public void all() { try { -// initCSSDData(); -// // 由于省医增加配置一次性物品没库存无法申请,调整一次性物品入库到申请前 -// oneUse(); -// before(); -// System.out.print("回收开始:"); -// Utils.DateTime(); -// login.init(); -// final String SERVER_URL = Utils.settings.get("服务器地址").toString(); -// Utils.driver.get(SERVER_URL + "/?logonType=1080p"); -// login.login_secondSupplyRoom(false); -// /** 二级供应室回收 */ -// /** 二级供应室自定义入筐回收 */ -// recyle.recyle_custom(Utils.settings.getJSONObject("二级供应室清洗篮筐1") -// .getString("条码")); -// Utils.waitUntilUrlChange( -// SERVER_URL -// + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", -// 8); -// /** 二级供应室判断消毒物品申请单是否存在 */ -// Utils.retryingFind(By.tagName("body")); -// -// WebElement element = Utils.retryingFindForthCellOfTable(By -// .id("awaitForRecycleTable")); -// if (Utils.isFind(element)) { -// recyle.recyle_SecondSupplyRoom(); -// Utils.waitUntilUrlChange( -// SERVER_URL -// + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", -// 8); -// Utils.retryingFindAndClick(By.id("return")); -// Utils.waitUntilUrlChange(SERVER_URL -// + "/homepage/portalPage.jsp", 8); -// Utils.tryToCloseWarningWindow(); -// } else { -// Utils.waitUntilUrlChange( -// SERVER_URL -// + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", -// 8); -// Utils.retryingFindAndClick(By.id("return")); -// Utils.waitUntilUrlChange(SERVER_URL -// + "/homepage/portalPage.jsp", 8); -// Utils.tryToCloseWarningWindow(); -// } -// /** 二级供应室清洗成功 */ -// wash.wash_secondSupplyRoom(); -// logger.info("二级供应室清洗成功"); -// wash.after(); + initCSSDData(); + // 由于省医增加配置一次性物品没库存无法申请,调整一次性物品入库到申请前 + oneUse(); + before(); + System.out.print("回收开始:"); + Utils.DateTime(); + login.init(); + final String SERVER_URL = Utils.settings.get("服务器地址").toString(); + Utils.driver.get(SERVER_URL + "/?logonType=1080p"); + login.login_secondSupplyRoom(false); + /** 二级供应室回收 */ + /** 二级供应室自定义入筐回收 */ + recyle.recyle_custom(Utils.settings.getJSONObject("二级供应室清洗篮筐1").getString("条码")); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); + /** 二级供应室判断消毒物品申请单是否存在 */ + Utils.retryingFind(By.tagName("body")); + + WebElement element = Utils.retryingFindForthCellOfTable(By.id("awaitForRecycleTable")); + if (Utils.isFind(element)) { + recyle.recyle_SecondSupplyRoom(); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); + Utils.retryingFindAndClick(By.id("return")); + Utils.waitUntilUrlChange(SERVER_URL + "/homepage/portalPage.jsp", 8); + Utils.tryToCloseWarningWindow(); + } else { + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); + Utils.retryingFindAndClick(By.id("return")); + Utils.waitUntilUrlChange(SERVER_URL + "/homepage/portalPage.jsp", 8); + Utils.tryToCloseWarningWindow(); + } + /** 二级供应室清洗成功 */ + wash.wash_secondSupplyRoom(); + logger.info("二级供应室清洗成功"); + wash.after(); recyle.init(); /** 一级供应室回收带标识牌的回收单 */ recyle.recyle_recyleSignboardAndDropAndScrap(); - String SERVER_URL = Utils.settings.get("服务器地址").toString(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); logger.info("一级供应室回收带标识牌的回收单完成"); /** 一级供应室回收单确认 */ recyle.recyle_confirm_new(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); logger.info("一级供应室回收单确认"); /** 一级供应室回收部分终止的单 */ recyle.recyle_oneSupplyRoom(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/recycleForTouchScreen.jsp?resolution=1980", 8); logger.info("一级供应室回收部分终止的单完成"); /** 切换篮筐并丢失材料 */ recyle.recyle_changeBasket(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); logger.info("切换篮筐并丢失材料完成"); /** 一级供应室回收单确认 */ recyle.recyle_confirm_new(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); logger.info("一级供应室回收单确认完成"); /** 一级供应室回收申请单 */ recyle.recyle_oneSupplyRoomSignboard(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); logger.info("一级供应室回收申请单完成"); /** 一级供应室回收外来器械 */ recyle.recyle_Foreign_edit(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); recyle.recyle_Foreign(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); logger.info("一级供应室回收外来器械完成"); /** 判断自定义器械包申请单是否存在 */ Utils.retryingFind(By.tagName("body")); - WebElement - element = Utils.retryingFindForthCellOfTable(By - .id("awaitForRecycleTable")); + element = Utils.retryingFindForthCellOfTable(By.id("awaitForRecycleTable")); if (Utils.isFind(element)) { recyle.recyle_customSet(); - Utils.waitUntilUrlChange( - SERVER_URL - + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", - 8); + Utils.waitUntilUrlChange(SERVER_URL + "/disinfectsystem/touchScreen/recycle/awaitForRecycleList.jsp?resolution=1980", 8); } /** 判断消毒物品申请单是否存在 */ Utils.retryingFind(By.tagName("body")); - element = Utils.retryingFindForthCellOfTable(By - .id("awaitForRecycleTable")); + element = Utils.retryingFindForthCellOfTable(By.id("awaitForRecycleTable")); if (Utils.isFind(element)) { recyle.recyle_customSet(); recyle.after(); @@ -242,22 +194,19 @@ // 一级供应室清洗并清洗添加材料 wash.wash_oneSupplyRoom(); // 清洗删除篮筐再添加篮筐,扫描不同的责任人 - Utils.retryingFindAndClick(By - .xpath("//button[contains(text(), '添加')]")); + Utils.retryingFindAndClick(By.xpath("//button[contains(text(), '添加')]")); Utils.driver.switchTo().defaultContent(); String currentwindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(currentwindowhandle); wash.wash_washChangeBasket(); - Utils.retryingFindAndClick(By - .xpath("//button[contains(text(), '添加')]")); + Utils.retryingFindAndClick(By.xpath("//button[contains(text(), '添加')]")); Utils.driver.switchTo().defaultContent(); currentwindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(currentwindowhandle); // 清洗失败,重新清洗,清洗完成,清洗机需要设置为清洗确认 wash.wash_fail_reWash_Finish(); Utils.driver.switchTo().defaultContent(); - Utils.retryingFindAndClick(By - .xpath("//span[contains(text(), '个人桌面')]")); + Utils.retryingFindAndClick(By.xpath("//span[contains(text(), '个人桌面')]")); /*** 材料入库报损丢失的材料 ***/ System.out.print("报损补充开始:"); Utils.DateTime(); @@ -274,23 +223,17 @@ System.out.print("审核开始:"); Utils.DateTime(); Utils.driver.switchTo().defaultContent(); - Utils.retryingFindAndClick(By - .xpath("//span[contains(text(), '个人桌面')]")); + Utils.retryingFindAndClick(By.xpath("//span[contains(text(), '个人桌面')]")); Actions moveover = new Actions(Utils.driver); - moveover.moveToElement(Utils.retryingFind(By.id("reviewPacking"))) - .perform(); - Utils.retryingFindAndClick(By.linkText(Utils.settings - .getJSONObject("一级供应室装配组").getString("名称3"))); + moveover.moveToElement(Utils.retryingFind(By.id("reviewPacking"))).perform(); + Utils.retryingFindAndClick(By.linkText(Utils.settings.getJSONObject("一级供应室装配组").getString("名称3"))); Utils.retryingFindAndSwitchToFrame(By.id("iframe_reviewPacking")); - element = Utils.retryingFind(By - .xpath("//button[contains(text(), '进入审核列表')]")); + element = Utils.retryingFind(By.xpath("//button[contains(text(), '进入审核列表')]")); handleReview(element, review); Utils.refresh(); moveover = new Actions(Utils.driver); - moveover.moveToElement(Utils.retryingFind(By.id("packing"))) - .perform(); - Utils.retryingFindAndClick(By.linkText(Utils.settings - .getJSONObject("一级供应室装配组").getString("名称2"))); + moveover.moveToElement(Utils.retryingFind(By.id("packing"))).perform(); + Utils.retryingFindAndClick(By.linkText(Utils.settings.getJSONObject("一级供应室装配组").getString("名称2"))); Utils.retryingFindAndSwitchToFrame(By.id("iframe_packing")); /*** 一级供应室补充丢失的材料 ***/ assemble.assemble_supplementLoss(); @@ -329,13 +272,10 @@ Utils.refresh(); /*** 一级供应室审核器械包、敷料包 ***/ moveover = new Actions(Utils.driver); - moveover.moveToElement(Utils.retryingFind(By.id("reviewPacking"))) - .perform(); - Utils.retryingFindAndClick(By.linkText(Utils.settings - .getJSONObject("一级供应室装配组").getString("名称2"))); + moveover.moveToElement(Utils.retryingFind(By.id("reviewPacking"))).perform(); + Utils.retryingFindAndClick(By.linkText(Utils.settings.getJSONObject("一级供应室装配组").getString("名称2"))); Utils.retryingFindAndSwitchToFrame(By.id("iframe_reviewPacking")); - element = Utils.retryingFind(By - .xpath("//button[contains(text(), '进入审核列表')]")); + element = Utils.retryingFind(By.xpath("//button[contains(text(), '进入审核列表')]")); handleReview(element, review); /*** 一级供应室灭菌装载删除 ***/ disinfection.disinfection_loading(); @@ -362,8 +302,7 @@ System.out.print("归还借物开始:"); Utils.DateTime(); Utils.driver.switchTo().defaultContent(); - Utils.retryingFindAndClick(By - .xpath("//span[contains(text(), '个人桌面')]")); + Utils.retryingFindAndClick(By.xpath("//span[contains(text(), '个人桌面')]")); apply.apply_borrow_return(); apply.after(); } catch (Exception e) { @@ -390,23 +329,20 @@ if (Utils.driver instanceof RemoteWebDriver) { session = ((RemoteWebDriver) Utils.driver).getSessionId(); } else if (Utils.driver instanceof InternetExplorerDriver) { - session = ((InternetExplorerDriver) Utils.driver) - .getSessionId(); + session = ((InternetExplorerDriver) Utils.driver).getSessionId(); } if (session != null) { String webAppRootPath = PathUtils.getWebAppRootPath(); - String buildTempPath = webAppRootPath.replaceAll( - "/src/main/webapp", "/build/tmp"); + String buildTempPath = webAppRootPath.replaceAll("/src/main/webapp", "/build/tmp"); // 删除之前产生的png文件 final File folder = new File(buildTempPath); final File[] files = folder.listFiles(new FilenameFilter() { public boolean accept(final File dir, final String name) { - return name.endsWith(".png") - && name.startsWith("screenshot"); + return name.endsWith(".png") && name.startsWith("screenshot"); } }); for (final File file : files) { @@ -416,13 +352,10 @@ } // 截图 - File scrFile = ((TakesScreenshot) Utils.driver) - .getScreenshotAs(OutputType.FILE); + File scrFile = ((TakesScreenshot) Utils.driver).getScreenshotAs(OutputType.FILE); - String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss") - .format(new java.util.Date()); - FileUtils.copyFile(scrFile, new File(buildTempPath - + "/screenshot-" + timeStamp + ".png")); + String timeStamp = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss").format(new java.util.Date()); + FileUtils.copyFile(scrFile, new File(buildTempPath + "/screenshot-" + timeStamp + ".png")); } } catch (Exception e) { e.printStackTrace();