package test_4_1; import org.testng.annotations.Test; import org.testng.annotations.BeforeMethod; import org.testng.AssertJUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; import test_4_1.tools.Utils; /** * @author cherry 2017-01-18 * */ /*** 中山大学附属第一医院临床科室申请器械包、敷料包、消毒物品、一次性物品、外来器械、自定义器械、借物 ***/ public class Zsyy { @BeforeMethod public void before() { try { Utils.DateTime(); Login login = new Login(); login.init(); login.login_clinicNoWarnig(); Thread.sleep(500); Utils.driver.findElement(By.id("recyclingApplication")).click(); Thread.sleep(500); Apply apply = new Apply(); System.out.println("中山大学附属第一医院临床科室向一级供应室申请自定义器械包"); apply.apply_custom(); Thread.sleep(500); System.out.println("中山大学附属第一医院临床科室向一级供应室申请消毒物品"); apply.apply_sterilize(); Thread.sleep(500); System.out.println("中山大学附属第一医院临床科室向一级供应室申请器械包、敷料包"); apply.apply_set(); Thread.sleep(500); System.out.println("中山大学附属第一医院临床科室向一级供应室申请一次性物品"); apply.apply_oneuse(); Thread.sleep(500); System.out.println("中山大学附属第一医院临床科室向一级供应室申请外来器械"); WebElement frame = Utils.driver.findElement(By .id("iframe_recyclingApplication")); Utils.driver.switchTo().frame(frame); Utils.driver.findElement( By.xpath("//button[contains(text(), '申请外来器械')]")).click(); apply.apply_foreignSet(); Thread.sleep(500); frame = Utils.driver.findElement(By .id("iframe_recyclingApplication")); Utils.driver.switchTo().frame(frame); Utils.driver.findElement( By.xpath("//button[contains(text(), '申请外来器械')]")).click(); apply.apply_foreignSetInformation(); Thread.sleep(500); System.out.println("中山大学附属第一医院临床科室向一级供应室申请借物"); frame = Utils.driver.findElement(By .id("iframe_recyclingApplication")); Utils.driver.switchTo().frame(frame); Utils.driver.findElement( By.xpath("//button[contains(text(), '借物')]")).click(); String currentwindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(currentwindowhandle); apply.apply_borrow(); apply.after(); } catch (Exception e) { e.printStackTrace(); AssertJUnit.fail(e.getMessage()); } } /*** 中山大学附属第一医院供应室流程 ***/ @Test public void all() { try { /*** 一级供应室回收 ***/ Utils.DateTime(); Recyle recyle = new Recyle(); recyle.init(); Thread.sleep(1000); System.out.println("一级供应室回收带标识牌的回收单"); recyle.recyle_recyleSignboardAndDropAndScrap(); recyle.after(); recyle.init(); System.out.println("一级供应室回收单确认"); recyle.recyle_confirm(); Thread.sleep(1000); System.out.println("一级供应室回收自定义器械"); WebElement bodyElement = Utils.driver.findElement(By .tagName("body")); // 输入临床科室条码,只显示临床科室的申请单 bodyElement.sendKeys(Utils.settings.getJSONObject("临床科室") .getString("条码") + "\n"); Thread.sleep(1000); Utils.retryingFindClickFirstCellOfTable(By .id("awaitForRecycleTable")); recyle.recyle_customSet(); Thread.sleep(1000); System.out.println("一级供应室回收申请单"); recyle.recyle_oneSupplyRoomSignboard(); recyle.after(); recyle.init(); System.out.println("一级供应室自定义回收外来器械"); bodyElement = Utils.driver.findElement(By.tagName("body")); bodyElement.sendKeys(Utils.settings.getJSONObject("临床科室") .getString("条码") + "\n"); Thread.sleep(2000); Utils.retryingFindClickFirstCellOfTable(By .id("awaitForRecycleTable")); Thread.sleep(1000); recyle.recyle_customSet(); // recyle.after(); // recyle.init(); System.out.println("一级供应室回收外来器械"); recyle.recyle_Foreign_edit(); System.out.println("一级供应室回收消毒物品"); Thread.sleep(1000); // 输入临床科室条码,只显示临床科室的申请单 bodyElement = Utils.driver.findElement(By.tagName("body")); bodyElement.sendKeys(Utils.settings.getJSONObject("临床科室") .getString("条码") + "\n"); Thread.sleep(1000); System.out.println("一级供应室回收自定义器械包"); recyle.recyle_customSet(); recyle.after(); /*** 一级供应室清洗 ***/ Utils.DateTime(); Wash wash = new Wash(); wash.init(); System.out.println("一级供应室清洗"); wash.wash_oneSupplyRoom(); Utils.driver.switchTo().defaultContent(); Utils.driver.findElement( By.xpath("//span[contains(text(), '个人桌面')]")).click(); System.out.println("一级供应室材料入库用于补充丢失、报损"); /*** 材料入库报损丢失的材料 ***/ Utils.DateTime(); Materials_Godown_Entry entry = new Materials_Godown_Entry(); entry.Materials_Godown_Entry_choice(); /*** 一级供应室拆包装配外来器械 ***/ Utils.DateTime(); Assemble assemble = new Assemble(); System.out.println("一级供应室拆包装配外来器械"); assemble.assemble_unpackForgein(); Utils.driver.switchTo().defaultContent(); Thread.sleep(1000); WebElement frame = Utils.driver .findElement(By.id("iframe_packing")); Utils.driver.switchTo().frame(frame); /*** 一级供应室装配器械包 ***/ System.out.println("一级供应室装配器械包 "); assemble.assemble_success1(); Thread.sleep(1000); assemble.after(); /*** 一级供应室补充装配带标识牌的器械包 ***/ assemble.init(); System.out.println("一级供应室补充装配带标识牌的器械包"); // assemble.assemble_SignboardAndDropAndScrap(); Thread.sleep(1000); /*** 一级供应室装配敷料包 ***/ System.out.println("一级供应室装配敷料包"); assemble.assemble_dressing(); Thread.sleep(1000); Utils.driver.switchTo().defaultContent(); Utils.driver.findElement( By.xpath("//span[contains(text(), '个人桌面')]")).click(); Thread.sleep(1000); Actions moveover = new Actions(Utils.driver); moveover.moveToElement( Utils.driver.findElement(By.id("reviewPacking"))).perform(); Thread.sleep(1000); Utils.driver.findElement( By.linkText(Utils.settings.getJSONObject("一级供应室装配组") .getString("名称1"))).click(); frame = Utils.driver.findElement(By.id("iframe_reviewPacking")); Utils.driver.switchTo().frame(frame); Review review = new Review(); Utils.DateTime(); /*** 一级供应室审核器械包 ***/ System.out.println("一级供应室审核器械包"); review.Review_single(); Thread.sleep(1000); /*** 一级供应室自定义装配 ***/ System.out.println("一级供应室自定义装配"); assemble.assemble_custom(); Thread.sleep(1000); Utils.driver.navigate().refresh(); String currentwindowhandle = Utils.driver.getWindowHandle(); Utils.driver.switchTo().window(currentwindowhandle); Utils.tryToCloseWarningWindow(); moveover = new Actions(Utils.driver); moveover.moveToElement(Utils.driver.findElement(By.id("packing"))) .perform(); Thread.sleep(1000); Utils.driver.findElement( By.linkText(Utils.settings.getJSONObject("一级供应室装配组") .getString("名称3"))).click(); Thread.sleep(1000); frame = Utils.driver.findElement(By.id("iframe_packing")); Utils.driver.switchTo().frame(frame); Thread.sleep(1000); /*** 一级供应室装配消毒物品 ***/ System.out.println("一级供应室装配消毒物品"); assemble.assemble_success1(); /*** 外部代理灭菌 ***/ Utils.DateTime(); Disinfection disinfection = new Disinfection(); System.out.println("外部代理灭菌"); disinfection.disinfection_agent_outside(); } catch (Exception e) { e.printStackTrace(); AssertJUnit.fail(e.getMessage()); } } }