Blame | Last modification | View Log | RSS feed
package com;import java.io.BufferedWriter;import java.io.File;import java.io.IOException;import com.thoughtworks.selenium.*;import com.unitedinternet.portal.selenium.utils.logging.HtmlResultFormatter;import com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor;import com.unitedinternet.portal.selenium.utils.logging.LoggingDefaultSelenium;import com.unitedinternet.portal.selenium.utils.logging.LoggingResultsFormatter;import com.unitedinternet.portal.selenium.utils.logging.LoggingSelenium;import com.unitedinternet.portal.selenium.utils.logging.LoggingUtils;//import static com.unitedinternet.portal.selenium.utils.logging.LoggingAssert.assertEquals;//import static com.unitedinternet.portal.selenium.utils.logging.LoggingAssert.assertTrue;import org.junit.After;import org.junit.Before;import org.junit.Test;//import org.openqa.selenium.server.SeleniumServer;//import java.util.regex.Pattern;public class Test_return extends SeleneseTestBase {BufferedWriter loggingWriter;protected LoggingSelenium selenium;final String resultbasePath = "/opt/seleniumTests/results/doa";//final String resultbasePath = "/opt/seleniumTests/results";final String resultHtmlFileName = resultbasePath + "/" + "resultdoa.html";final String resultEncoding = "UTF-8";final String screenshotpath="screenshot";final String screenshotresultPath=new File(resultbasePath+"/"+screenshotpath).getAbsolutePath();@Beforepublic void setUp() throws Exception {if (!new File(screenshotresultPath).exists()) {new File(screenshotresultPath).mkdirs();}loggingWriter = LoggingUtils.createWriter(resultHtmlFileName, resultEncoding , true);LoggingResultsFormatter htmlFormatter =new HtmlResultFormatter(loggingWriter, resultEncoding);htmlFormatter.setScreenShotBaseUri(resultbasePath+"/"+screenshotpath+"/"); // this is for linking to the screenshotshtmlFormatter.setAutomaticScreenshotPath(screenshotresultPath);// wrap HttpCommandProcessor from remote-controlLoggingCommandProcessor myProcessor =new LoggingCommandProcessor(new HttpCommandProcessor("localhost", 4444, "*firefox", "http://saholic:shop2020@www.shop2020.in:8080"), htmlFormatter);//new LoggingCommandProcessor(new HttpCommandProcessor("localhost", 4444, "*firefox", "http://saholic.com/"), htmlFormatter);selenium = new LoggingDefaultSelenium(myProcessor);myProcessor.setExcludedCommands(new String[] {});selenium.start();}@Test(expected=AssertionError.class)public void testdashboardorder() throws Exception {String Orderid="136743";selenium.setContext("testdashboardorder()");selenium.setTimeout("60000");selenium.open("/dashboard");selenium.windowMaximize();selenium.type("css=input.gwt-TextBox","ys5admin");selenium.type("css=input.gwt-PasswordTextBox","1grim@ce");selenium.click("css=button.gwt-Button");Thread.sleep(15000);selenium.click("link=Search");Thread.sleep(10000);selenium.type("css=input.gwt-TextBox",Orderid);selenium.click("css=button.gwt-Button");Thread.sleep(10000);selenium.click("css=input[type='checkbox']");Thread.sleep(10000);selenium.click("xpath=(//button[@type='button'])[11]");Thread.sleep(10000);selenium.select("css=select.gwt-ListBox","label=Delhivery");selenium.click("xpath=(//button[@type='button'])[22]");Thread.sleep(10000);selenium.isTextPresent("Order pickup request successful");selenium.click("css=div.dialogMiddleCenterInner.dialogContent > button.gwt-Button");Thread.sleep(10000);selenium.click("xpath=(//button[@type='button'])[12]");Thread.sleep(10000);selenium.select("css=select.gwt-ListBox","label=Delhivery");selenium.type("css=input.gwt-TextBox", "123456789");selenium.click("xpath=(//button[@type='button'])[22]");Thread.sleep(5000);selenium.click("css=button.gwt-Button");selenium.click("link=Search");Thread.sleep(10000);selenium.type("css=input.gwt-TextBox",Orderid);selenium.click("css=button.gwt-Button");Thread.sleep(10000);selenium.click("css=input[type='checkbox']");Thread.sleep(10000);selenium.click("xpath=(//button[@type='button'])[5]");Thread.sleep(5000);selenium.click("css=td > table > tbody > tr > td > button.gwt-Button");Thread.sleep(5000);selenium.isTextPresent("Return acceptance successful");selenium.click("css=div.dialogMiddleCenterInner.dialogContent > button.gwt-Button");Thread.sleep(10000);selenium.click("xpath=(//button[@type='button'])[9]");Thread.sleep(5000);selenium.isTextPresent("Is the RETURN product usable?");selenium.click("css=div.dialogMiddleCenterInner.dialogContent > table > tbody > tr > td > button.gwt-Button");Thread.sleep(5000);selenium.isTextPresent("RETURN validation successful");selenium.click("css=button.gwt-Button");Thread.sleep(5000);selenium.click("link=Search");Thread.sleep(10000);selenium.type("css=input.gwt-TextBox",Orderid);selenium.click("css=button.gwt-Button");Thread.sleep(10000);selenium.click("css=input[type='checkbox']");Thread.sleep(10000);selenium.click("xpath=(//button[@type='button'])[16]");Thread.sleep(10000);selenium.type("xpath=(//input[@type='text'])[10]","xyz reason");selenium.click("xpath=(//button[@type='button'])[22]");Thread.sleep(10000);selenium.isTextPresent("Order " +Orderid+ " was refunded");selenium.click("css=div.dialogMiddleCenterInner.dialogContent > button.gwt-Button");Thread.sleep(5000);}@Afterpublic void tearDown() throws Exception {selenium.stop();//stopSeleniumServer();try {if (null != loggingWriter) {loggingWriter.close();}} catch (IOException e) {System.out.println("IO exception");}}}