public void testCreateResearchStaff() throws Exception { selenium.open("/c3pr/pages/personAndOrganization/researchStaff/createResearchStaff"); selenium.waitForPageToLoad("30000"); selenium.click("healthcareSite-input"); selenium.typeKeys("healthcareSite-input", "NC010"); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isElementPresent("//div[@id='healthcareSite-choices']/ul/li/strong")) break; } catch (Exception e) { } Thread.sleep(1000); } selenium.click("//div[@id='healthcareSite-choices']/ul/li/strong"); selenium.click("healthcareSite-input"); selenium.type("firstName", "duke"); selenium.type("lastName", "admin"); selenium.type("assignedIdentifier", "nco#44"); selenium.type("contactMechanisms[0].value", "*****@*****.**"); selenium.click("groups_0"); selenium.click("flow-next"); selenium.waitForPageToLoad("30000"); }
@Test public void testFlightSearch() throws Exception { selenium.open("/"); selenium.click("id=search.type.air"); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isElementPresent("name=ar.rt.leaveSlice.orig.key")) break; } catch (Exception e) { } Thread.sleep(1000); } selenium.click("css=div.button.needsclick"); selenium.type("name=ar.rt.leaveSlice.orig.key", "nyc"); selenium.type("name=ar.rt.leaveSlice.dest.key", "sfo"); selenium.type("name=ar.rt.leaveSlice.date", "07/18/15"); selenium.type("name=ar.rt.returnSlice.date", "07/20/15"); selenium.click("name=search"); selenium.waitForPageToLoad("30000"); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isElementPresent("css=div.matchingResults > h2")) break; } catch (Exception e) { } Thread.sleep(1000); } verifyTrue(selenium.isTextPresent("Matching Results")); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isElementPresent("xpath=//span[@class='price']")) break; } catch (Exception e) { } Thread.sleep(1000); } String price = selenium.getText("xpath=//span[@class='price']"); System.out.println("The lowest price is " + price); }
public String doCommand(String cmd, String args[]) { if (cmd.equals("store")) { cmd += "Expression"; } else if (cmd.equals("assertSelected") || cmd.equals("verifySelected")) { if (args[1].startsWith(INDEX_SPECIFIER)) { cmd += "Index"; args[1] = args[1].substring(INDEX_SPECIFIER.length()); } else if (args[1].startsWith(ID_SPECIFIER)) { cmd += "Id"; args[1] = args[1].substring(ID_SPECIFIER.length()); } else if (args[1].startsWith(LABEL_SPECIFIER)) { cmd += "Label"; args[1] = args[1].substring(LABEL_SPECIFIER.length()); } else if (args[1].startsWith(VALUE_SPECIFIER)) { cmd += "Value"; args[1] = args[1].substring(VALUE_SPECIFIER.length()); } else { cmd += "Label"; } } else if (cmd.endsWith("ErrorOnNext") || cmd.endsWith("FailureOnNext")) { expectError = true; return "OK"; } else if (cmd.equals("echo")) { return "OK," + args[0]; } else if (cmd.equals("pause")) { try { Thread.sleep(Integer.parseInt(args[0])); return "OK"; } catch (InterruptedException e) { return "ERROR: pause interrupted"; } } try { String result = super.doCommand(cmd, args); if (expectError) { throw new SeleniumException("ERROR: Error expected"); } else { return result; } } catch (SeleniumException e) { if (expectError) { expectError = false; return "OK"; } else { throw e; } } }
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); } }
public void test_SVP_EGCupload_FLV() throws Exception { { try { setUp(); Utility_Functions utilityFunction = new Utility_Functions(); // Global variables file name String str_path = "Global_variables.xml"; String local_path = "SVP_EGCupload_FLV.xml"; // Variable for the domain name String VAR_DomSocial = utilityFunction.GetValue(str_path, "VAR_DomSocial"); // Variable for the user name String VAR_USR = utilityFunction.GetValue(str_path, "VAR_USR"); // Variable for the Password String VAR_PWD = utilityFunction.GetValue(str_path, "VAR_PWD"); String VAR_MED_WAIT = utilityFunction.GetValue(str_path, "VAR_MED_WAIT"); // Variable for EGC user's email id String VAR_userEmailID = utilityFunction.GetValue(local_path, "VAR_userEmailID"); // Variable for EGC user's password String VAR_userPassword = utilityFunction.GetValue(local_path, "VAR_userPassword"); // Variable for EGC user's First Name String VAR_userFirstName = utilityFunction.GetValue(local_path, "VAR_userFirstName"); // Variable for EGC user's Last Name String VAR_userLastName = utilityFunction.GetValue(local_path, "VAR_userLastName"); // Variable for Streaming Media Name String VAR_streamingMedia = utilityFunction.GetValue(local_path, "VAR_streamingMedia"); // Variable for Streaming Media type String VAR_streamingMediaType = utilityFunction.GetValue(local_path, "VAR_streamingMediaType"); // Variable for Master VOD Name String VAR_MasterVOD = utilityFunction.GetValue(local_path, "VAR_MasterVOD"); // Variable for channel Name String VAR_ChannelName = utilityFunction.GetValue(local_path, "VAR_ChannelName"); // Variable for Program Name Created from SVP by EGC user String VAR_EGCprogramName = utilityFunction.GetValue(local_path, "VAR_EGCprogramName"); // Variable for Streaming Media uploaded by EGC user from SVP String VAR_streamingMediaEGC = utilityFunction.GetValue(local_path, "VAR_streamingMediaEGC"); // Variable for Social Viewer Portal String Var_Columbia_vpURL = utilityFunction.GetValue(str_path, "Var_Columbia_vpURL"); // Variable for framework path String Var_frameWork_Path = utilityFunction.GetValue(str_path, "Var_frameWork_Path"); // Variable for asx file String Var_asxLink = utilityFunction.GetValue(str_path, "Var_asxLink"); // Reusable action for Login to VCC Login.test_login(selenium, VAR_USR, VAR_PWD, VAR_DomSocial); // Reusable action for create User CreateUser.test_Create_User( selenium, VAR_userFirstName, VAR_userLastName, VAR_userEmailID, VAR_userPassword); // Reusable action to upload streaming media (flv) Upload_Media.Upload_streamingMedia(selenium, VAR_streamingMedia, VAR_streamingMediaType); // Reusable action for creating the on-demand program Create_Program.test_Create_vodProgram(selenium, VAR_MasterVOD, VAR_streamingMedia); if (!selenium.isTextPresent(VAR_MasterVOD)) { // Search the new created Live program selenium.click(EnvObjectMap_Rep.LNK_Search_Program); // provide program name in Search field selenium.type(EnvObjectMap_Rep.SelectType_Search_Program, VAR_MasterVOD); // click Search button selenium.click(EnvObjectMap_Rep.Btn_Search_Program); // wait for loading the page selenium.waitForPageToLoad(VAR_MED_WAIT); } selenium.click("link=" + VAR_MasterVOD); // wait selenium.waitForPageToLoad(VAR_MED_WAIT); // select the master program checkbox selenium.click(EnvObjectMap_Rep.chk_masterProgram); // wait utilityFunction.waitForChangesToReflect(); selenium.click(EnvObjectMap_Rep.Btn_Finish_Program); // wait selenium.waitForPageToLoad(VAR_MED_WAIT); // Reusable action for EGC enabled channel Create_EGCchannel.test_Create_EGCchannel( selenium, VAR_ChannelName, VAR_MasterVOD, VAR_userEmailID); // variable for social viewer portal url String SVP_url = Var_Columbia_vpURL + VAR_DomSocial + "/home.vp"; // navigate to social viewer portal selenium.open(SVP_url); selenium.waitForPageToLoad(VAR_MED_WAIT); // select the time zone if (selenium.isElementPresent(EnvObjectMap_Rep.drp_selectTimeZoneCVP)) { selenium.select( EnvObjectMap_Rep.drp_selectTimeZoneCVP, EnvObjectMap_Rep.drp_selectTimeZone_valueCVP); selenium.click(EnvObjectMap_Rep.btn_selectTimeZoneCVP); selenium.waitForPageToLoad(VAR_MED_WAIT); } selenium.selectWindow("Qumu Program Browser Home"); selenium.windowMaximize(); utilityFunction.waitForChangesToReflect(); utilityFunction.waitForChangesToReflect(); // Login to Social Viewer portal as EGC user Login.LoginSVP(selenium, VAR_userEmailID, VAR_userPassword); // wait utilityFunction.waitForChangesToReflect(); utilityFunction.waitForChangesToReflect(); // Create a program containing WMV file Upload_EGCprogramSVP.test_Upload_EGCprogramSVP( selenium, VAR_EGCprogramName, VAR_ChannelName, VAR_streamingMediaEGC); // wait utilityFunction.waitForChangesToReflect(); utilityFunction.waitForChangesToReflect(); // check whether the program has been created on SVP for (int second = 0; ; second++) { if (second >= 600) fail("timeout"); try { if (selenium.isElementPresent("link=" + VAR_EGCprogramName)) assertTrue( "SVP_EGCupload_FLV", "Social VP: Ensure that Program is successfully created using the FLV file from SVP EGC portal.", date, selenium.isTextPresent(VAR_EGCprogramName)); selenium.open(SVP_url + "?debug=true"); selenium.waitForPageToLoad("60000"); break; } catch (Exception e) { } Thread.sleep(1000); } // wait utilityFunction.waitForChangesToReflect(); // click on All videos link selenium.click(EnvObjectMap_Rep.LNK_AllVideos); utilityFunction.waitForChangesToReflect(); // input the search term selenium.type(EnvObjectMap_Rep.TBX_SearchSVP, VAR_EGCprogramName); // wait utilityFunction.waitForChangesToReflect(); // Set focus on the search textbox selenium.typeKeys(EnvObjectMap_Rep.TBX_SearchSVP, "t"); // select the icon to perform search selenium.click(EnvObjectMap_Rep.ICN_SearchBoxArrowlinkSVP); // Wait utilityFunction.waitForChangesToReflect(); // Click the vod file in search results for (int i = 1; i < 50; i++) { String str_var = selenium.getText(MessageFormat.format(EnvObjectMap_Rep.LST_Searchresult, i)); System.out.println(str_var); if (str_var.equals(VAR_EGCprogramName)) { selenium.click(MessageFormat.format(EnvObjectMap_Rep.LST_Searchresult, i)); break; } } // Click the vod file in search results // selenium.click(EnvObjectMap_Rep.LST_Searchresult); // Wait utilityFunction.waitForChangesToReflect(); utilityFunction.waitForChangesToReflect(); // Capture the screenshot at the specified path String screenShot_locPath = Var_frameWork_Path + "\\commonfiles\\" + VAR_EGCprogramName + ".jpg"; // Capture the screen shot of the live program selenium.captureScreenshot(screenShot_locPath); // Wait utilityFunction.waitForChangesToReflect(); String contentlink = selenium.getText(Var_asxLink); // wait utilityFunction.waitForChangesToReflect(); String contentlink_final = StringUtils.substringAfter(contentlink, "Loading content from"); contentlink_final = contentlink_final.trim(); System.out.println("exact:" + contentlink_final + "&playerType=silverlightembed"); selenium.click("link=exact:" + contentlink_final); utilityFunction.waitForChangesToReflect(); // Generate the asx file String htmlsource = selenium.getHtmlSource(); System.out.println(htmlsource); // To verify the asx file assertTrue( "SVP_EGCupload_FLV", "Verify that asx file for on-demand program with FLV file is generated successfully.", date, utilityFunction.assertTextContains(htmlsource, VAR_EGCprogramName)); // Verify that the stream is displayed correct in the asx file assertTrue( "SVP_EGCupload_FLV", "Social VP: Ensure that FLV file is uploaded from EGC portal and correctly displayed in asx file.", date, utilityFunction.assertTextContains(htmlsource, VAR_EGCprogramName)); utilityFunction = null; } catch (Exception e) { e.printStackTrace(); } finally { selenium.close(); selenium.stop(); } } }
@Test public void test_0B_slogin() throws Exception { selenium.open("https://www.google.com/"); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isTextPresent("A faster way to browse the web")) break; } catch (Exception e) { } Thread.sleep(1000); } Thread.sleep(5000); selenium.open("/"); Thread.sleep(5000); selenium.click("id=login_button"); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if ("Remember this selection:".equals(selenium.getText("//p[4]/label"))) break; } catch (Exception e) { } Thread.sleep(1000); } selenium.select("id=providerId", "label=Google"); selenium.uncheck("id=keepidp"); selenium.click("id=wayflogonbutton"); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isTextPresent("for some information from your Google Account.")) break; } catch (Exception e) { } Thread.sleep(1000); } selenium.type("id=Email", "U_S_E_R-N_A_M_E"); selenium.type("id=Passwd", "P_A_S_S-W_O_R_D"); Thread.sleep(1000); selenium.click("id=PersistentCookie"); selenium.click("id=signIn"); selenium.waitForPageToLoad("30000"); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isTextPresent("Showing 1 to")) break; } catch (Exception e) { } Thread.sleep(1000); } selenium.selectWindow("null"); selenium.click("id=logout_link"); selenium.waitForPageToLoad("30000"); for (int second = 0; ; second++) { if (second >= 60) fail("timeout"); try { if (selenium.isTextPresent("Getting Started")) break; } catch (Exception e) { } Thread.sleep(1000); } Thread.sleep(5000); }
public void test_SVP_Sm_vpv_018_LiveSurveySummary_Report() throws Exception { { try { setUp(); Utility_Functions utilityFunction = new Utility_Functions(); String str_path = "Global_variables.xml"; // local variable file name String local_path = "SVP_LiveProgramSurveySummary_Report.xml"; // String VAR_MED_WAIT = utilityFunction.GetValue(str_path ,"VAR_MED_WAIT"); String VAR_DomSocial = utilityFunction.GetValue(str_path, "VAR_DomSocial"); // Variable for the user name String VAR_USR = utilityFunction.GetValue(str_path, "VAR_USR"); // Variable for the Password String VAR_PWD = utilityFunction.GetValue(str_path, "VAR_PWD"); // Encoder Name String VAR_Encodername = utilityFunction.GetValue(local_path, "VAR_Encodername"); // Variable for Live program name String Var_LiveProgramName = utilityFunction.GetValue(local_path, "Var_LiveProgramName"); // Variable for the archive of Live program String Var_LiveProgramArchive = utilityFunction.GetValue(local_path, "Var_LiveProgramArchive"); // Variable for the Framework path String Var_frameWork_Path = utilityFunction.GetValue(str_path, "Var_frameWork_Path"); // variable for media net name String VAR_MedianetName = utilityFunction.GetValue(local_path, "VAR_medianetName"); // Variable for Encoder profile name String VAR_EncoderProfileName = utilityFunction.GetValue(local_path, "VAR_EncoderProfileName"); // Variable for viewer portal String Var_Columbia_vpURL = utilityFunction.GetValue(str_path, "Var_Columbia_vpURL"); // Variable for the Survey Name String VAR_SurveyName = utilityFunction.GetValue(local_path, "SurveyName"); // Variable for Poll name String VAR_PollName = utilityFunction.GetValue(local_path, "PollName"); // Variable for the Question Name String VAR_QuestionName = utilityFunction.GetValue(local_path, "QuestionName"); // Variable for the Question Explanation String VAR_QuestionExp = utilityFunction.GetValue(local_path, "QuestionExp"); // Variable for the Question Type String VAR_QuestionType = utilityFunction.GetValue(local_path, "QuestionType"); // Variable for the slide display name String VAR_SlideDisplayName = utilityFunction.GetValue(local_path, "VAR_SlideDisplayName"); // Reusable action for Login to VCC Login.test_login(selenium, VAR_USR, VAR_PWD, VAR_DomSocial); // Reusable action to add survey // Upload_Media.Add_Survey(selenium, VAR_PollName, VAR_QuestionName, VAR_QuestionExp, // VAR_QuestionType); // Reusable to create a live program Create_Program.test_create_LiveProg( selenium, Var_LiveProgramName, VAR_Encodername, VAR_EncoderProfileName, VAR_SlideDisplayName, VAR_PollName, VAR_SurveyName, VAR_MedianetName); // Launch the LBC Launch_LBC.test_LaunchLBC( selenium, "Sm_vpv_018", Var_LiveProgramName, Var_LiveProgramArchive); // wait // selenium.waitForPageToLoad("30000"); selenium.selectWindow("null"); utilityFunction.waitForChangesToReflect(); // Launch the viewer portal video selenium.openWindow(Var_Columbia_vpURL + VAR_DomSocial + "/home.vp?debug=true", "SVP"); // Select the viewer portal selenium.selectWindow("SVP"); selenium.windowMaximize(); utilityFunction.waitForElementToVisible(selenium, EnvObjectMap_Rep.LNK_AllVideos, 300); // selenium.setTimeout("90000"); // utilityFunction.waitForChangesToReflect(); // click the Live program from all videos selenium.click(EnvObjectMap_Rep.LNK_AllVideos); utilityFunction.waitForChangesToReflect(); utilityFunction.waitForChangesToReflect(); selenium.type( EnvObjectMap_Rep.TBX_SearchSVP, utilityFunction.GetValue(local_path, "Var_LiveProgramName")); utilityFunction.waitForChangesToReflect(); // Set focus on the search textbox selenium.typeKeys(EnvObjectMap_Rep.TBX_SearchSVP, "t"); // select the icon to perform search selenium.click(EnvObjectMap_Rep.ICN_SearchBoxArrowlinkSVP); // Wait utilityFunction.waitForChangesToReflect(); // select the Live program from all Videos in search results for (int i = 1; i < 50; i++) { String str_var = selenium.getText(MessageFormat.format(EnvObjectMap_Rep.LST_Searchresult, i)); System.out.println(str_var); if (str_var.equals(Var_LiveProgramName)) { selenium.click(MessageFormat.format(EnvObjectMap_Rep.LST_Searchresult, i)); break; } } // Wait utilityFunction.waitForChangesToReflect(); // variable for path where to save the screenshot String screenShot_locPath = Var_frameWork_Path + "\\commonfiles\\" + Var_LiveProgramName + ".jpg"; // Capture the screen shot of the live program selenium.captureScreenshot(screenShot_locPath); // Wait // utilityFunction.waitForChangesToReflect(); // select the LBC window for (String windowName : selenium.getAllWindowNames()) { if (windowName.indexOf(EnvObjectMap_Rep.Select_LBC) != -1) { selenium.selectWindow(windowName); } } // Click on Broadcast control tab selenium.click(EnvObjectMap_Rep.tab_broadcastControlLBC); // wait utilityFunction.waitForChangesToReflect(); // Stop the broadcast selenium.click(EnvObjectMap_Rep.btn_stopBroadcast); utilityFunction.waitForChangesToReflect(); selenium.close(); // Select the parent window selenium.selectWindow("null"); // wait // utilityFunction.waitForChangesToReflect(); // select SVP window selenium.selectWindow("Qumu Program Browser Home"); // wait utilityFunction.waitForChangesToReflect(); // Verify that survey is available for (int second = 0; ; second++) { if (second >= 600) fail("timeout"); try { if (selenium.isElementPresent(EnvObjectMap_Rep.LNK_SurveyWindow)) assertTrue( "Sm_vpv_018", "Verify that Survey is displayed successfully on SVP after the broadcast is stopped on LBC.", date, selenium.isElementPresent(EnvObjectMap_Rep.LNK_SurveyWindow)); break; } catch (Exception e) { } Thread.sleep(1000); } selenium.click(EnvObjectMap_Rep.CHK_SurveyWindow); selenium.click(EnvObjectMap_Rep.btn_SubmitSurveyanswer); utilityFunction.waitForChangesToReflect(); selenium.selectWindow("null"); // Click 'Reporting' menu selenium.click(EnvObjectMap_Rep.lnk_reporting); // Click 'Reports' link selenium.click(EnvObjectMap_Rep.lnk_reports); // wait selenium.waitForPageToLoad("30000"); // Select Report name selenium.click(EnvObjectMap_Rep.radio_LiveProgramSurveySummary); // Click 'Next' button selenium.click(EnvObjectMap_Rep.btn_reportNext); // wait selenium.waitForPageToLoad("30000"); // select Survey as the option selenium.select(EnvObjectMap_Rep.drp_SelectPollorSurvey, EnvObjectMap_Rep.txt_Survey); utilityFunction.waitForChangesToReflect(); selenium.select("input_programId", "label=" + Var_LiveProgramName); // wait utilityFunction.waitForChangesToReflect(); // click the Run report button selenium.click(EnvObjectMap_Rep.btn_runReport); // wait selenium.waitForPageToLoad("30000"); // verify that 'Content Storage' report is generated assertTrue( "Sm_vpv_018", "Social VP: Ensure that 'Live Program Survey Summary' report is generated.", date, selenium.isTextPresent("Live Program Poll/Survey Summary Report")); assertTrue( "Sm_vpv_018", "Social VP: Ensure that correct Live program is displayed on 'Live Program Survey Summary' report.", date, selenium.isTextPresent(Var_LiveProgramName)); selenium.close(); // stop selenium utilityFunction = null; } catch (Exception e) { e.printStackTrace(); } finally { selenium.close(); selenium.stop(); } } }