Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/ApplyTest.java =================================================================== diff -u -r26347 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/ApplyTest.java (.../ApplyTest.java) (revision 26347) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/ApplyTest.java (.../ApplyTest.java) (revision 33420) @@ -271,15 +271,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Assemble.java =================================================================== diff -u -r26540 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Assemble.java (.../Assemble.java) (revision 26540) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Assemble.java (.../Assemble.java) (revision 33420) @@ -3,6 +3,7 @@ import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.List; import java.util.function.Function; import org.apache.log4j.Logger; @@ -1015,23 +1016,33 @@ By.cssSelector("input[name='basketBarcodeInput']"), Utils.settings.getJSONObject("二级供应室清洗篮筐2").getString("条码") + "\n"); + //全选按钮 Utils.retryingFindAndClick(By.id("checkAllTaskNode-inputRow")); - - Utils.retryingFindAndClick(By.id("sterilingType-triggerWrap")); - - String name = Utils.settings.getJSONObject("灭菌程序").getString("名称1"); - - Utils.retryingFindAndClick(By - .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - - Utils.retryingFindAndClick(By.id("packageType-triggerWrap")); - - name = Utils.settings.getJSONObject("包装类型").getString("名称1"); - - Utils.retryingFindAndClickBySeleniumAPI(By - .xpath("//div/ul/li[contains(text(), '" + name + "')]")); - - isAlertPresent(); + //灭菌程序下拉框 + WebElement sterilingType = Utils.retryingFind(By.id("sterilingType-triggerWrap")); + //包装类型下拉框 + WebElement packageType = Utils.retryingFind(By.id("sterilingType-triggerWrap")); + //获取勾选的待装配物品的行数 + List trList = Utils.driver.findElements(By.xpath("//*[@id='basketTreeGrid-body']//tr")); + if(trList.size()>1){ + //勾选的物品种类数量大于1,则灭菌程序和包装类型是不可编辑的 + assertTrue(sterilingType.isDisplayed()); + assertTrue(packageType.isDisplayed()); + }else if(trList.size()==1){ + ////勾选的物品种类数量等于1则修改灭菌程序和包装类型 + sterilingType.click(); + String name = Utils.settings.getJSONObject("灭菌程序").getString("名称1"); + Utils.retryingFindAndClick(By + .xpath("//div/ul/li[contains(text(), '" + name + "')]")); + packageType.click(); + name = Utils.settings.getJSONObject("包装类型").getString("名称1"); + Utils.retryingFindAndClickBySeleniumAPI(By + .xpath("//div/ul/li[contains(text(), '" + name + "')]")); + isAlertPresent(); + }else{ + throw new RuntimeException("未勾选待装配物品,无法装配!"); + } + Utils.retryingFindAndClick(By.id("save_print")); /** 获取装配成功后的条码 **/ JSWaiter.waitUntilJQueryReady(); @@ -1055,7 +1066,7 @@ Utils.driver.switchTo().defaultContent(); Utils.retryingFindAndSwitchToFrame(By.id("iframe_packing")); Utils.retryingFindAndClick(By - .xpath("//span[contains(text(), '添加质量监测')]")); + .xpath("//span[contains(text(), '质量监测')]")); Utils.retryingFindAndClick(By.id("qualityMonitoringWin")); if (Utils.isFind(Utils.retryingFind(By .cssSelector("textarea[name='remark']")))) { @@ -1359,17 +1370,8 @@ public void after() { JSWaiter.waitUntilJQueryReady(); Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } /** Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Disinfection.java =================================================================== diff -u -r26575 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Disinfection.java (.../Disinfection.java) (revision 26575) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Disinfection.java (.../Disinfection.java) (revision 33420) @@ -1409,17 +1409,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } /** Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Intervene.java =================================================================== diff -u -r27702 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Intervene.java (.../Intervene.java) (revision 27702) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Intervene.java (.../Intervene.java) (revision 33420) @@ -341,17 +341,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Set_manager.java =================================================================== diff -u -r26347 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Set_manager.java (.../Set_manager.java) (revision 26347) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Set_manager.java (.../Set_manager.java) (revision 33420) @@ -76,17 +76,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java =================================================================== diff -u -r27844 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java (.../ALL.java) (revision 27844) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/ALL.java (.../ALL.java) (revision 33420) @@ -14,14 +14,12 @@ import org.junit.After; import org.junit.Test; import org.openqa.selenium.By; -import org.openqa.selenium.Keys; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebElement; import org.openqa.selenium.ie.InternetExplorerDriver; import org.openqa.selenium.remote.RemoteWebDriver; import org.openqa.selenium.remote.SessionId; -import org.springframework.beans.factory.annotation.Autowired; import test.forgon.disinfectsystem.AbstractCSSDTest; import test.forgon.disinfectsystem.selenium.apply.applyConstants.DeskIconEnum; @@ -31,7 +29,6 @@ import test.forgon.disinfectsystem.selenium.tools.LoginUtil; import test.forgon.disinfectsystem.selenium.tools.Utils; -import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; import com.forgon.tools.util.PathUtils; /** @@ -41,8 +38,6 @@ public class ALL extends AbstractCSSDTest { - @Autowired - private SupplyRoomConfigManager supplyRoomConfigManager; protected Logger logger = Logger.getLogger(this.getClass()); private Recyle recyle = new Recyle(); private Wash wash = new Wash(); @@ -163,19 +158,6 @@ Utils.init(); /** - * 将二级供应室自动发货设为“不启用” - */ -// List supplyRoomConfigs = supplyRoomConfigManager.getSupplyRoomList(SupplyRoomConfig.SUPPLYROOM_TYPE_SYSTEM_CONFIG); -// SupplyRoomConfig supplyRoomConfig = supplyRoomConfigs.get(0); -// supplyRoomConfig.setIsSecondSupplyRoomAutoInvoice(SupplyRoomConfig.SECONDSUPPLYROOM_AUTOINVOICE_DISABLE); -// supplyRoomConfigManager.save(supplyRoomConfig); - - /** - * 开启配置项 - */ - Utils.setAndWriteConfigByNameAndValueForAutoTest("enbaleCheckToConfirm", true);//开启清点确认 - - /** * 一次性物品入库以及修改消毒物品包定义 * (由于省医增加配置一次性物品没库存无法申请,调整一次性物品入库到申请前) */ @@ -189,21 +171,7 @@ /** * 申请外部代理灭菌单 */ - login.login_oneSupplyRoom();//一级供应室登录 - Utils.retryingFindAndClick(By.id("recyclingApplication"));//点击科室申领图标 - Utils.switchToFrame(Utils.retryingFind(By.name("desktopIframe")));//切换frame - Utils.retryingFindAndClick(By.xpath("//button[contains(text(),'申请外部代理灭菌包')]"));//点击申请外部代理灭菌包按钮 - Utils.driver.switchTo().window(Utils.driver.getWindowHandle());//切换到申领窗口 - JSWaiter.waitUntilJQueryReady(); - Utils.retryingFindAndSendKeys(By.id("package1"), Keys.DOWN);//物品名称输入框 - Utils.retryingFindAndClick(By.xpath("//*[contains(text(),'4#压力蒸汽灭菌包')]"));//选择外部代理灭菌包 - Utils.driver.findElement(By.xpath("//*[@id='foreignProxyDisinfectionGrid']//td[7]//img")).click();//灭菌程序下拉按钮 - Utils.retryingFindAndClick(By.xpath("//*[contains(text(),'P01')]"));//选择灭菌程序 - Utils.retryingFindAndClearAndSendKeys(By.id("count1"), "2");//数量 - Utils.retryingFindAndClick(By.xpath("//*[contains(text(),'添加')]"));//添加 - Utils.retryingFindAndClick(By.xpath("//*[contains(text(),'提交')]"));//提交 - Utils.retryingFindAndClick(By.xpath("//button[contains(text(),'是')]"));//确认框 - login.login_Out();//退出登录 + apply.apply_external_agent_sterilization(); /** * 回收 @@ -1079,22 +1047,8 @@ logger.info(windowID); JSWaiter.waitUntilJQueryReady(); Utils.driver.quit(); -// WindowsUtils.killByName("conhost.exe"); -// WindowsUtils -// .killByName("IEDriverServer.exe *32"); -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils -// .killByName("Command line server for the IE Driver.exe"); -// // TODO:暂时用下面语句杀掉IE进程,解决IE8,win7运行后装配界面没有关闭的问题 -// WindowsUtils.killByName("iexplore.exe *32"); - - Runtime.getRuntime().exec("Taskkill /F /IM conhost.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe *32"); - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM Command line server for the IE Driver.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); continue; } } else { Index: ssts-web/src/test/resources/test/forgon/disinfectsystem/selenium/config/all/settings.json =================================================================== diff -u -r26967 -r33420 --- ssts-web/src/test/resources/test/forgon/disinfectsystem/selenium/config/all/settings.json (.../settings.json) (revision 26967) +++ ssts-web/src/test/resources/test/forgon/disinfectsystem/selenium/config/all/settings.json (.../settings.json) (revision 33420) @@ -1,9 +1,9 @@ { - "seleniumBrowserApplicationName": "11", + "seleniumBrowserApplicationName": "chrome", "seleniumBrowserVersion": "11.0", "seleniumHubURL": "http://192.168.2.20:4445/wd/hub", - "configJSPath" : "c:/xxx/config.js", - "服务器地址": "http://192.168.2.111/gdsy", + "configJSPath" : "C:/各项目tomcat/Autotest/apache-tomcat-8.0.53/webapps/ROOT", + "服务器地址": "http://192.168.2.60:8050", "触摸屏清洗服务地址": "/logon.jsp?logonType=washform", "一级供应室用户": { "工号": "cssduser1", Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Delivery.java =================================================================== diff -u -r26582 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Delivery.java (.../Delivery.java) (revision 26582) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Delivery.java (.../Delivery.java) (revision 33420) @@ -765,17 +765,8 @@ @After public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/service/ApplyComboServiceImpl.java =================================================================== diff -u -r26741 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/service/ApplyComboServiceImpl.java (.../ApplyComboServiceImpl.java) (revision 26741) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/service/ApplyComboServiceImpl.java (.../ApplyComboServiceImpl.java) (revision 33420) @@ -47,6 +47,7 @@ Map templateDisposableGoods = ApplyHelper.createTemplateGoods(new Integer[][]{{0, 5}}); Map map = new HashMap<>(); map.put("一级供应室消毒物品1", 5); + map.put("一级供应室一次性物品", 5); ApplyHelper.handleApplyGoodWithTemplate(applyGoodBo, map, templateTousseGoods, templateDisposableGoods); } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Reject.java =================================================================== diff -u -r26427 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Reject.java (.../Reject.java) (revision 26427) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Reject.java (.../Reject.java) (revision 33420) @@ -243,17 +243,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/ComboApplyTest.java =================================================================== diff -u -r26347 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/ComboApplyTest.java (.../ComboApplyTest.java) (revision 26347) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/ComboApplyTest.java (.../ComboApplyTest.java) (revision 33420) @@ -78,14 +78,7 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Consume.java =================================================================== diff -u -r26347 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Consume.java (.../Consume.java) (revision 26347) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Consume.java (.../Consume.java) (revision 33420) @@ -126,17 +126,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/CSSDTestDataProcess.java =================================================================== diff -u -r31763 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/CSSDTestDataProcess.java (.../CSSDTestDataProcess.java) (revision 31763) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/CSSDTestDataProcess.java (.../CSSDTestDataProcess.java) (revision 33420) @@ -2311,6 +2311,7 @@ tousseDefinition1.setPackingAmountPerVirtualBasket(5); //包装类型 tousseDefinition1.setPackageType("纸塑"); + tousseDefinition1.setSterilingMethod("P01"); MaterialInstance materialInstance1 = new MaterialInstance(); materialInstance1.setTousse(tousseDefinition1); @@ -2351,6 +2352,7 @@ tousseDefinition2.setIsTraceable(TousseDefinition.STR_YES); //包装类型 tousseDefinition2.setPackageType("纸塑"); + tousseDefinition2.setSterilingMethod("P01"); MaterialInstance materialInstance3 = new MaterialInstance(); materialInstance3.setMaterialDefinition(materialDefinition2); @@ -2440,6 +2442,7 @@ tousseDefinition3.setIsConvertApplyGoods(TousseDefinition.STR_YES); //包装类型 tousseDefinition3.setPackageType("纸塑"); + tousseDefinition3.setSterilingMethod("P01"); MaterialInstance materialInstance5 = new MaterialInstance(); materialInstance5.setMaterialDefinition(materialDefinition1); @@ -2480,6 +2483,7 @@ tousseDefinition4.setIsConvertApplyGoods(TousseDefinition.STR_NO); //包装类型 tousseDefinition4.setPackageType("纸塑"); + tousseDefinition4.setSterilingMethod("P01"); MaterialInstance materialInstance7 = new MaterialInstance(); materialInstance7.setMaterialDefinition(materialDefinition2); @@ -2514,6 +2518,7 @@ tousseDefinition5.setIsCustomPacking(TousseDefinition.STR_NO); //包装类型 tousseDefinition5.setPackageType("纸塑"); + tousseDefinition5.setSterilingMethod("P01"); MaterialInstance materialInstance9 = new MaterialInstance(); materialInstance9.setMaterialDefinition(materialDefinition4); @@ -2548,6 +2553,7 @@ tousseDefinition6.setIsCustomPacking(TousseDefinition.STR_NO); //包装类型 tousseDefinition6.setPackageType("纸塑"); + tousseDefinition6.setSterilingMethod("P01"); MaterialInstance materialInstance11 = new MaterialInstance(); materialInstance11.setMaterialDefinition(materialDefinition4); @@ -2606,6 +2612,7 @@ tousseDefinition7.setIsRecycling(TousseDefinition.STR_NO); //包装类型 tousseDefinition7.setPackageType("纸塑"); + tousseDefinition7.setSterilingMethod("P01"); MaterialInstance materialInstance100 = new MaterialInstance(); materialInstance100.setMaterialDefinition(materialDefinition2); @@ -2641,6 +2648,7 @@ tousseDefinition8.getMaterialInstances().add(materialInstance15); //包装类型 tousseDefinition8.setPackageType("纸塑"); + tousseDefinition8.setSterilingMethod("P01"); tousseDefinitionManager.saveOrUpdate(tousseDefinition8); TousseDefinition tousseDefinition9 = new TousseDefinition(); @@ -2670,20 +2678,22 @@ tousseDefinition9.getMaterialInstances().add(materialInstance17); //包装类型 tousseDefinition9.setPackageType("纸塑"); + tousseDefinition9.setSterilingMethod("P01"); tousseDefinitionManager.saveOrUpdate(tousseDefinition9); //新增加清创包与宫碘包的定义以支撑各个测试用的用例数据 TousseDefinition tousseDefinition10 = new TousseDefinition(); //普通器械包 tousseDefinition10.setName("Test清创包"); - tousseDefinition10.setIsCleanedEntirely("是"); + tousseDefinition10.setIsCleanedEntirely(TousseDefinition.STR_NO); tousseDefinition10.setTaskGroup(Constants.TASKGROUP_LINCHUANGQIXIEZU); tousseDefinition10.setTousseType(TousseDefinition.PACKAGE_TYPE_INSIDE); tousseDefinition10.setHandlerDepartCode(Constants.ORG_UNIT_CODE_CSSD); tousseDefinition10.setHandlerDepartName(Constants.ORG_UNIT_NAME_CSSD); tousseDefinition10.setUnit(""); //包装类型 tousseDefinition10.setPackageType("纸塑"); + tousseDefinition10.setSterilingMethod("P01"); MaterialInstance materialInstance18 = new MaterialInstance(); materialInstance18.setTousse(tousseDefinition10); @@ -2703,14 +2713,15 @@ TousseDefinition tousseDefinition11 = new TousseDefinition(); //普通器械包 tousseDefinition11.setName("Test宫碘包"); - tousseDefinition11.setIsCleanedEntirely("是"); + tousseDefinition11.setIsCleanedEntirely(TousseDefinition.STR_YES); tousseDefinition11.setTaskGroup(Constants.TASKGROUP_LINCHUANGQIXIEZU); tousseDefinition11.setTousseType(TousseDefinition.PACKAGE_TYPE_INSIDE); tousseDefinition11.setHandlerDepartCode(Constants.ORG_UNIT_CODE_CSSD); tousseDefinition11.setHandlerDepartName(Constants.ORG_UNIT_NAME_CSSD); tousseDefinition11.setUnit(""); //包装类型 tousseDefinition11.setPackageType("纸塑"); + tousseDefinition11.setSterilingMethod("P01"); MaterialInstance materialInstance20 = new MaterialInstance(); materialInstance20.setTousse(tousseDefinition11); @@ -2750,6 +2761,7 @@ tousseDefinition12.setIsRecycling(TousseDefinition.STR_NO); //包装类型 tousseDefinition12.setPackageType("纸塑"); + tousseDefinition12.setSterilingMethod("P01"); MaterialInstance materialInstance101 = new MaterialInstance(); materialInstance101.setMaterialDefinition(materialDefinition2); @@ -2783,6 +2795,7 @@ tousseDefinition13.setIsRecycling(TousseDefinition.STR_NO); //包装类型 tousseDefinition13.setPackageType("纸塑"); + tousseDefinition13.setSterilingMethod("P01"); MaterialInstance materialInstance102 = new MaterialInstance(); materialInstance102.setMaterialDefinition(materialDefinition2); @@ -2899,6 +2912,7 @@ tousseDefinition1.setForDisplay(true); tousseDefinition1.setPackageType("纸塑"); tousseDefinition1.setUnit(""); + tousseDefinition1.setSterilingMethod("P01"); objectDao.saveOrUpdate(materialInstance1); @@ -2946,6 +2960,7 @@ tousseDefinition2.setForDisplay(true); tousseDefinition2.setPackageType("纸塑"); tousseDefinition2.setUnit(""); + tousseDefinition2.setSterilingMethod("P01"); materialInstances = new ArrayList(); materialInstances.add(materialInstance2); @@ -2987,6 +3002,7 @@ tousseDefinition3.setForDisplay(true); tousseDefinition3.setPackageType("纸塑"); tousseDefinition3.setUnit(""); + tousseDefinition3.setSterilingMethod("P01"); materialInstances = new ArrayList(); materialInstances.add(materialInstance3); Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/Utils.java =================================================================== diff -u -r26712 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/Utils.java (.../Utils.java) (revision 26712) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/tools/Utils.java (.../Utils.java) (revision 33420) @@ -1,5 +1,6 @@ package test.forgon.disinfectsystem.selenium.tools; +import java.awt.AWTException; import java.awt.GraphicsConfiguration; import java.awt.GraphicsEnvironment; import java.io.BufferedReader; @@ -46,14 +47,14 @@ import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Wait; import org.openqa.selenium.support.ui.WebDriverWait; +import org.springframework.beans.factory.annotation.Autowired; import org.testng.Assert; import org.testng.AssertJUnit; import test.forgon.disinfectsystem.selenium.factory.WaitFactory; import com.fasterxml.jackson.core.JsonParser.Feature; import com.fasterxml.jackson.databind.ObjectMapper; -import com.forgon.tools.Path; import com.forgon.tools.util.ConfigUtils; import static org.monte.media.FormatKeys.EncodingKey; @@ -67,6 +68,9 @@ import static org.monte.media.VideoFormatKeys.ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE; import static org.monte.media.VideoFormatKeys.QualityKey; +import com.forgon.disinfectsystem.basedatamanager.supplyroomconfig.service.SupplyRoomConfigManager; +import com.forgon.disinfectsystem.entity.basedatamanager.supplyroomconfig.SupplyRoomConfig; + /** * @author Terry Date : 2016-02-29 23:17 工具类 */ @@ -80,6 +84,9 @@ public static final String ACTION_SWITCH_TO_FRAME = "switchToFrame"; public static final String ACTION_CLEAR = "clear"; + @Autowired + private static SupplyRoomConfigManager supplyRoomConfigManager; + /** * 屏幕录制 */ @@ -217,37 +224,103 @@ } /** + * 视频录制 + */ + private static void initscreenRecorder(){ + GraphicsConfiguration gconfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); + try { + screenRecorder = new ScreenRecorder(gconfig, new Format(MediaTypeKey, + MediaType.FILE, MimeTypeKey, MIME_AVI), new Format( + MediaTypeKey, MediaType.VIDEO, EncodingKey, + ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, CompressorNameKey, + ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey, (int) 24, + FrameRateKey, Rational.valueOf(15), QualityKey, 1.0f, + KeyFrameIntervalKey, (int) (15 * 60)), new Format(MediaTypeKey, + MediaType.VIDEO, EncodingKey, "black", FrameRateKey, + Rational.valueOf(30)), null); + // 开始捕获视频 + screenRecorder.start(); + } catch (IOException e) { + e.printStackTrace(); + } catch (AWTException e) { + e.printStackTrace(); + } + + } + + /** + * 修改科室供应室配置:将二级供应室自动发货设为“不启用” + */ + private static void modifyTheConfigurationOfTheDepartmentSupplyRoom(){ + List supplyRoomConfigs = supplyRoomConfigManager.getSupplyRoomList(SupplyRoomConfig.SUPPLYROOM_TYPE_SYSTEM_CONFIG); + SupplyRoomConfig supplyRoomConfig = supplyRoomConfigs.get(0); + supplyRoomConfig.setIsSecondSupplyRoomAutoInvoice(SupplyRoomConfig.SECONDSUPPLYROOM_AUTOINVOICE_DISABLE); + supplyRoomConfigManager.save(supplyRoomConfig); + } + + /** + * 结束相关进程 + * @throws IOException + */ + public static void killTasks() { + String browser = Utils.settings.get("seleniumBrowserApplicationName").toString(); + try { + if("ie".equals(browser)){ + //如果参数值输入ie,则关闭ie相关进程 + Runtime.getRuntime().exec("Taskkill /F /IM conhost.exe"); + Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe *32"); + Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); + Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); + Runtime.getRuntime().exec("Taskkill /F /IM Command line server for the IE Driver.exe"); + Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); + }else if("chrome".equals(browser)){ + //如果参数值输入chrome,则关闭chrome相关进程 + Runtime.getRuntime().exec("Taskkill /F /IM chromedriver.exe *32"); + Runtime.getRuntime().exec("Taskkill /F /IM chrome.exe"); + Runtime.getRuntime().exec("Taskkill /F /IM chrome.exe *32"); + }else{ + throw new RuntimeException("浏览器名称输入不正确!"); + } + } catch (Exception e) { + e.printStackTrace(); + } + + + } + + /** * 初始化chrome的driver + * @throws IOException */ private static void webDriverChromeInit() { + //结束相关进程 + killTasks(); DesiredCapabilities chrome = DesiredCapabilities.chrome(); ChromeOptions options = new ChromeOptions(); options.addArguments("test-type"); chrome.setCapability(ChromeOptions.CAPABILITY, options); + options.setExperimentalOption( "excludeSwitches" , new String[]{ "enable-automation" }); // chrome.setCapability("applicationName", "cherry"); // chrome.setCapability("version", "8.0"); - driver = new ChromeDriver(chrome); + driver = new ChromeDriver(options); + JSWaiter.setDriver(driver); + if (cleanTime == 0) { + Utils.driver.manage().deleteAllCookies(); + JSWaiter.waitUntilJQueryReady(); + cleanTime++; + } String serverAddress = Utils.settings.get("服务器地址").toString(); driver.get(serverAddress); + driver.manage().window().maximize(); } + + + - /** 启动前,先杀掉进程,再打开浏览器 */ - public static void webDriverInit() { -// WindowsUtils.killByName("IEDriverServer.exe *32"); -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("Command line server for the IE Driver.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe *32"); - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM Command line server for the IE Driver.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } + /**启动IE浏览器驱动: 启动前,先杀掉进程,再打开浏览器 */ + public static void webIEDriverInit() { + //结束相关进程 + killTasks(); // System.setProperty("webdriver.ie.driver", // "C:\\IEDriverServer_Win32_3.7.0\\IEDriverServer.exe"); // 解决ie兼容模式设置导致无法启动问题 @@ -291,20 +364,8 @@ logger.debug("selenium 运行模式:LOCAL"); + /** - * 视频录制 - */ - GraphicsConfiguration gconfig = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration(); - screenRecorder = new ScreenRecorder(gconfig, new Format(MediaTypeKey, - MediaType.FILE, MimeTypeKey, MIME_AVI), new Format( - MediaTypeKey, MediaType.VIDEO, EncodingKey, - ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, CompressorNameKey, - ENCODING_AVI_TECHSMITH_SCREEN_CAPTURE, DepthKey, (int) 24, - FrameRateKey, Rational.valueOf(15), QualityKey, 1.0f, - KeyFrameIntervalKey, (int) (15 * 60)), new Format(MediaTypeKey, - MediaType.VIDEO, EncodingKey, "black", FrameRateKey, - Rational.valueOf(30)), null); - /** * 初始化driver */ InternetExplorerOptions s = new InternetExplorerOptions( @@ -313,8 +374,7 @@ String cap = ((InternetExplorerDriver) driver) .getCapabilities().toString(); - // 开始捕获视频 - screenRecorder.start(); + logger.debug("my cap = " + cap); @@ -343,9 +403,26 @@ * */ public static void init() { + // zd5y已经不使用了 initProjectSettings("all"); - webDriverInit(); + //开启视频录制 + initscreenRecorder(); + //修改科室供应室配置 + //modifyTheConfigurationOfTheDepartmentSupplyRoom(); + //开启相关配置项 + setAndWriteConfig(); + + //初始化webDriver + String browser = Utils.settings.get("seleniumBrowserApplicationName").toString(); + if("ie".equals(browser)){ + webIEDriverInit();//如果参数值输入ie,则启动ie驱动 + }else if("chrome".equals(browser)){ + webDriverChromeInit();//如果参数值输入chrome,则启动chrome驱动 + }else{ + throw new RuntimeException("浏览器名称输入不正确!"); + } + } @@ -355,14 +432,26 @@ * @return */ public static String setAndWriteConfigByNameAndValueForAutoTest(String key , Object value){ -// String configFilePath = ConfigUtils.getProjectName() + "/config.js"; + String configFilePath = ConfigUtils.getProjectName() + "/config.js"; //自动化测试运行电脑项目名是“祈福医院”,而实际运行的项目为“广州市十二人民医院”,为了不修改到“祈福医院”的文件,因此将configFilePath写为固定值 - String configFilePath = "gzs12rmyy/config.js"; +// String configFilePath = "gzs12rmyy/config.js"; writeWebConfigInfoForAutoTest(configFilePath , key , value); return null; } + + + /** + * 开启配置项 + */ + private static void setAndWriteConfig(){ + setAndWriteConfigByNameAndValueForAutoTest("enbaleCheckToConfirm", true);//开启清点确认 + setAndWriteConfigByNameAndValueForAutoTest("packingView_autoSelectTousseWhenScanBasket", true);//装配时是否自动勾选该篮筐下的第一个包 + } + + + /** * 将配置项写进config.js文件 * @param configFilePath * @param key Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Login.java =================================================================== diff -u -r28118 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Login.java (.../Login.java) (revision 28118) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Login.java (.../Login.java) (revision 33420) @@ -320,16 +320,7 @@ @After public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Wash.java =================================================================== diff -u -r26427 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Wash.java (.../Wash.java) (revision 26427) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Wash.java (.../Wash.java) (revision 33420) @@ -588,17 +588,7 @@ public void after() { JSWaiter.waitUntilJQueryReady(); Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); - + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Recyle.java =================================================================== diff -u -r28514 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Recyle.java (.../Recyle.java) (revision 28514) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Recyle.java (.../Recyle.java) (revision 33420) @@ -1603,10 +1603,12 @@ Utils.settings.get("服务器地址").toString() + "/disinfectsystem/touchScreen/recycle/expressRecycleForTouchScreen.jsp?resolution=1980", 15); - WebElement element = Utils.tryFind(By.id("tousseItemTable")); + Actions actions = new Actions(Utils.driver); + WebElement element = Utils.retryingFind(By.id("tousseItemTable")) ; if (Utils.isFind(element)) { - element.sendKeys(Utils.settings.getJSONObject("二级供应室清洗篮筐1") - .getString("条码") + "\n"); + //快速回收页面的控件无法直接输入篮筐条码,需要用鼠标事件进行输入 + actions.moveToElement(element).sendKeys(Utils.settings.getJSONObject("二级供应室清洗篮筐1") + .getString("条码") + "\n").perform(); dialogWindowClose(); if (Utils.isFind(Utils.retryingFind(By.id("allIntoBasket")))) { Utils.retryingFindAndClick(By.id("allIntoBasket")); @@ -1617,8 +1619,9 @@ Utils.jsClick(addButton); } } - Utils.retryingFindAndClick(By.className("btn-e")); - JSWaiter.waitUntilJQueryReady(); + //“保存”按钮不可见,改为采用js点击 + String js = "document.querySelector('.btn-e').click();"; + ((JavascriptExecutor)Utils.driver).executeScript(js); } Utils.driver.navigate().back(); } catch (Exception e) { @@ -1699,31 +1702,20 @@ .sendKeys( Utils.settings.getJSONObject("临床科室") .getString("条码") + "\n").perform(); - // Utils.retryingFindAndSendKeys(By.id("awaitForRecycleTable"), - // Utils.settings.getJSONObject("临床科室").getString("条码") + "\n"); WebElement element = Utils.tryFind(By.id("tousseItemTable")); - // WebElement element = - // Utils.retryingFind(By.id("tousseItemTable")); if (element == null) { Utils.retryingFindClickFirstCellOfTable(By .id("awaitForRecycleTable")); waitUrlChange(); } -// this.scanRecycleUserBarcode(); - // Utils.changeCustomWindow(); - // String currentWindowHandle = Utils.driver.getWindowHandle(); - // Utils.driver.switchTo().window(currentWindowHandle); Utils.switchToDefaultContent(); // 获得当前窗口 String mainWindow = Utils.driver.getWindowHandle(); // 直接调用webElement的click,避免js打开模态窗口后代码阻塞的问题 if (Utils.isFind(Utils.retryingFind(By.id("customIntoBasketDiv")))) { -// Utils.retryingFindAndClickBySeleniumAPI(By -// .id("customIntoBasketDiv")); - //retryingFindAndClickBySeleniumAPI点击div没反应,避免点击没反应,现采用js执行onclick的方法 WebElement customIntoBasketDiv = Utils.driver.findElement(By.id("customIntoBasketDiv")) ; String onclickScript = customIntoBasketDiv.getAttribute("onclick"); @@ -1776,8 +1768,10 @@ } - Utils.retryingFindAndClickBySeleniumAPI(By.className("btn-e")); - + //“确认”按钮不可见,改为采用js点击 + String js = "document.querySelector('.btn-e').click();"; + ((JavascriptExecutor)Utils.driver).executeScript(js); + Utils.waitForWindowAmountEquals(1, 20000); // 从自定义入筐的窗口切换回主窗口 @@ -1828,21 +1822,8 @@ logger.info(windowID); JSWaiter.waitUntilJQueryReady(); Utils.driver.quit(); -// WindowsUtils.killByName("conhost.exe"); -// WindowsUtils.killByName("IEDriverServer.exe *32"); -// WindowsUtils.killByName("iexplore.exe"); -// // TODO:暂时用下面语句杀掉IE进程,解决IE8,win7运行后装配界面没有关闭的问题 -// WindowsUtils.killByName("iexplore.exe *32"); - - try { - Runtime.getRuntime().exec("Taskkill /F /IM conhost.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe *32"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } + //结束相关进程 + Utils.killTasks(); assemble.isAlertPresent(); continue; } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/TestDemo.java =================================================================== diff -u -r26428 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/TestDemo.java (.../TestDemo.java) (revision 26428) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/TestDemo.java (.../TestDemo.java) (revision 33420) @@ -20,16 +20,8 @@ public static ScreenRecorder screenRecorder; public static void main(String[] args) throws IOException, AWTException { - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe *32"); - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM Command line server for the IE Driver.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } + //结束相关进程 + Utils.killTasks(); System.setProperty("webdriver.ie.driver","C:/yuandongxiao/tools/selenium/3.141.59/IEDriverServer_Win32_3.141.59/IEDriverServer.exe"); Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/GdsyApplyTest.java =================================================================== diff -u -r26347 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/GdsyApplyTest.java (.../GdsyApplyTest.java) (revision 26347) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/apply/GdsyApplyTest.java (.../GdsyApplyTest.java) (revision 33420) @@ -183,14 +183,7 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Recall.java =================================================================== diff -u -r26347 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Recall.java (.../Recall.java) (revision 26347) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Recall.java (.../Recall.java) (revision 33420) @@ -158,17 +158,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Materials.java =================================================================== diff -u -r26347 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Materials.java (.../Materials.java) (revision 26347) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Materials.java (.../Materials.java) (revision 33420) @@ -462,16 +462,7 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Review.java =================================================================== diff -u -r26575 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Review.java (.../Review.java) (revision 26575) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Review.java (.../Review.java) (revision 33420) @@ -370,16 +370,7 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Apply.java =================================================================== diff -u -r26427 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Apply.java (.../Apply.java) (revision 26427) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Apply.java (.../Apply.java) (revision 33420) @@ -60,6 +60,28 @@ } /** + * 申请外部代理灭菌单 + */ + public void apply_external_agent_sterilization(){ + Login login = new Login(); + login.login_oneSupplyRoom();//一级供应室登录 + Utils.retryingFindAndClick(By.id("recyclingApplication"));//点击科室申领图标 + Utils.switchToFrame(Utils.retryingFind(By.name("desktopIframe")));//切换frame + Utils.retryingFindAndClick(By.xpath("//button[contains(text(),'申请外部代理灭菌包')]"));//点击申请外部代理灭菌包按钮 + Utils.driver.switchTo().window(Utils.driver.getWindowHandle());//切换到申领窗口 + JSWaiter.waitUntilJQueryReady(); + Utils.retryingFindAndSendKeys(By.id("package1"), Keys.DOWN);//物品名称输入框 + Utils.retryingFindAndClick(By.xpath("//*[contains(text(),'4#压力蒸汽灭菌包')]"));//选择外部代理灭菌包 + Utils.driver.findElement(By.xpath("//*[@id='foreignProxyDisinfectionGrid']//td[7]//img")).click();//灭菌程序下拉按钮 + Utils.retryingFindAndClick(By.xpath("//*[contains(text(),'P01')]"));//选择灭菌程序 + Utils.retryingFindAndClearAndSendKeys(By.id("count1"), "2");//数量 + Utils.retryingFindAndClick(By.xpath("//button[text()='添加']"));//添加 + Utils.retryingFindAndClick(By.xpath("//button[text()='提交']"));//提交 + Utils.retryingFindAndClick(By.xpath("//button[contains(text(),'是')]"));//确认框 + login.login_Out();//退出登录 + } + + /** * 向处理科室二级供应室申请器械包、敷料包、消毒物品 * */ @Test @@ -151,7 +173,10 @@ Utils.retryingFindAndSendKeys( By.cssSelector("input[id='handleDepart-inputEl']"), Keys.DOWN); - + + JSWaiter.waitUntilJQueryReady(); + JSWaiter.waitUntilJSReady(); + Utils.retryingFindAndClick(By .xpath("//div/ul/li[contains(text(), '" + SupplyRoomName + "')]")); @@ -947,18 +972,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/One_use.java =================================================================== diff -u -r26967 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/One_use.java (.../One_use.java) (revision 26967) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/One_use.java (.../One_use.java) (revision 33420) @@ -7,6 +7,7 @@ import java.io.IOException; import java.text.SimpleDateFormat; +import java.util.Calendar; import java.util.Date; import java.util.List; @@ -83,6 +84,12 @@ .getString("名称"); // 要等待物品名称下拉框由disable变成enable后即可以被点击后再进行以下操作 Wait wait = WaitFactory.createDefaultWait(); + //获取当前年份、月份作为批次号进行录入 + Calendar cal = Calendar.getInstance(); + int currentYear = cal.get(Calendar.YEAR);//当前年份 + int expirationYear = cal.get(Calendar.YEAR)+3;//失效年份 + int currentMonth = cal.get(Calendar.MONTH);//当前月份 + if (Utils.isFind(Utils.retryingFind(By.id("name1")))) { for (int i = 6; i < 9; i++) { String x = (int) (Math.random() * 8 + 1) + ""; @@ -91,15 +98,14 @@ Utils.retryingFindAndClick(By .xpath("//div/div/div[contains(text(), '" + name + "')]")); - Utils.retryingFind(By.id("amount1")).clear(); Utils.retryingFindAndSendKeys(By.id("amount1"), i*10 + "\n"); Utils.retryingFindAndSendKeys(By.id("batchNumber1"), - "2017030" + i ); + currentYear+""+currentMonth +"0"+i ); Utils.retryingFind(By.id("expDate1")).clear(); Utils.retryingFindAndSendKeys(By.id("expDate1"), - "2020010" + i + "\n"); + expirationYear+""+currentMonth+"0"+ i + "\n"); Utils.retryingFind(By.id("cost1")).clear(); Utils.retryingFindAndSendKeys(By.id("cost1"), x + "." + x + x + "\n"); @@ -136,10 +142,10 @@ Utils.retryingFindAndSendKeys(By.id("amount1"), i*10 + "\n"); Utils.retryingFindAndSendKeys(By.id("batchNumber1"), - "2017030" + i ); + currentYear+""+currentMonth +"0"+ i ); Utils.retryingFind(By.id("expDate1")).clear(); Utils.retryingFindAndSendKeys(By.id("expDate1"), - "2020010" + i + "\n"); + currentYear+""+currentMonth +"0"+ i + "\n"); Utils.retryingFind(By.id("cost1")).clear(); Utils.retryingFindAndSendKeys(By.id("cost1"), x + "." + x + x + "\n"); @@ -415,17 +421,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/UserRecord.java =================================================================== diff -u -r26582 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/UserRecord.java (.../UserRecord.java) (revision 26582) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/UserRecord.java (.../UserRecord.java) (revision 33420) @@ -160,17 +160,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } private void Waitconfirm() { Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Regular_Monitor.java =================================================================== diff -u -r26818 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Regular_Monitor.java (.../Regular_Monitor.java) (revision 26818) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Regular_Monitor.java (.../Regular_Monitor.java) (revision 33420) @@ -133,17 +133,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } } Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/PackingHistory.java =================================================================== diff -u -r26347 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/PackingHistory.java (.../PackingHistory.java) (revision 26347) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/PackingHistory.java (.../PackingHistory.java) (revision 33420) @@ -105,17 +105,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } /** Index: ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Sign.java =================================================================== diff -u -r26427 -r33420 --- ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Sign.java (.../Sign.java) (revision 26427) +++ ssts-web/src/test/java/test/forgon/disinfectsystem/selenium/Sign.java (.../Sign.java) (revision 33420) @@ -72,17 +72,8 @@ @AfterMethod public void after() { Utils.driver.quit(); - try { - Runtime.getRuntime().exec("Taskkill /F /IM IEDriverServer.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe"); - Runtime.getRuntime().exec("Taskkill /F /IM iexplore.exe *32"); - } catch (IOException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } -// WindowsUtils.killByName("IEDriverServer.exe"); -// WindowsUtils.killByName("iexplore.exe"); -// WindowsUtils.killByName("iexplore.exe *32"); + //结束相关进程 + Utils.killTasks(); } }