| 8614 |
kshitij.so |
1 |
package com;
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
import java.io.BufferedWriter;
|
|
|
5 |
import java.io.File;
|
|
|
6 |
import java.io.IOException;
|
|
|
7 |
|
|
|
8 |
import com.thoughtworks.selenium.*;
|
|
|
9 |
import com.unitedinternet.portal.selenium.utils.logging.HtmlResultFormatter;
|
|
|
10 |
import com.unitedinternet.portal.selenium.utils.logging.LoggingCommandProcessor;
|
|
|
11 |
import com.unitedinternet.portal.selenium.utils.logging.LoggingDefaultSelenium;
|
|
|
12 |
import com.unitedinternet.portal.selenium.utils.logging.LoggingResultsFormatter;
|
|
|
13 |
import com.unitedinternet.portal.selenium.utils.logging.LoggingSelenium;
|
|
|
14 |
import com.unitedinternet.portal.selenium.utils.logging.LoggingUtils;
|
|
|
15 |
//import static com.unitedinternet.portal.selenium.utils.logging.LoggingAssert.assertEquals;
|
|
|
16 |
//import static com.unitedinternet.portal.selenium.utils.logging.LoggingAssert.assertTrue;
|
|
|
17 |
import org.junit.After;
|
|
|
18 |
import org.junit.Before;
|
|
|
19 |
import org.junit.Test;
|
|
|
20 |
//import org.openqa.selenium.server.SeleniumServer;
|
|
|
21 |
|
|
|
22 |
//import java.util.regex.Pattern;
|
|
|
23 |
|
|
|
24 |
public class Test_return extends SeleneseTestBase {
|
|
|
25 |
|
|
|
26 |
|
|
|
27 |
BufferedWriter loggingWriter;
|
|
|
28 |
protected LoggingSelenium selenium;
|
|
|
29 |
final String resultbasePath = "/opt/seleniumTests/results/doa";
|
|
|
30 |
//final String resultbasePath = "/opt/seleniumTests/results";
|
|
|
31 |
final String resultHtmlFileName = resultbasePath + "/" + "resultdoa.html";
|
|
|
32 |
final String resultEncoding = "UTF-8";
|
|
|
33 |
final String screenshotpath="screenshot";
|
|
|
34 |
final String screenshotresultPath=new File(resultbasePath+"/"+screenshotpath).getAbsolutePath();
|
|
|
35 |
@Before
|
|
|
36 |
public void setUp() throws Exception {
|
|
|
37 |
if (!new File(screenshotresultPath).exists()) {
|
|
|
38 |
new File(screenshotresultPath).mkdirs();
|
|
|
39 |
}
|
|
|
40 |
loggingWriter = LoggingUtils.createWriter(resultHtmlFileName, resultEncoding , true);
|
|
|
41 |
LoggingResultsFormatter htmlFormatter =
|
|
|
42 |
new HtmlResultFormatter(loggingWriter, resultEncoding);
|
|
|
43 |
htmlFormatter.setScreenShotBaseUri(resultbasePath+"/"+screenshotpath+"/"); // this is for linking to the screenshots
|
|
|
44 |
htmlFormatter.setAutomaticScreenshotPath(screenshotresultPath);
|
|
|
45 |
// wrap HttpCommandProcessor from remote-control
|
|
|
46 |
LoggingCommandProcessor myProcessor =
|
|
|
47 |
new LoggingCommandProcessor(new HttpCommandProcessor("localhost", 4444, "*firefox", "http://saholic:shop2020@www.shop2020.in:8080"), htmlFormatter);
|
|
|
48 |
//new LoggingCommandProcessor(new HttpCommandProcessor("localhost", 4444, "*firefox", "http://saholic.com/"), htmlFormatter);
|
|
|
49 |
selenium = new LoggingDefaultSelenium(myProcessor);
|
|
|
50 |
myProcessor.setExcludedCommands(new String[] {});
|
|
|
51 |
selenium.start();
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
@Test(expected=AssertionError.class)
|
|
|
55 |
public void testdashboardorder() throws Exception {
|
|
|
56 |
String Orderid="136743";
|
|
|
57 |
selenium.setContext("testdashboardorder()");
|
|
|
58 |
selenium.setTimeout("60000");
|
|
|
59 |
selenium.open("/dashboard");
|
|
|
60 |
selenium.windowMaximize();
|
|
|
61 |
selenium.type("css=input.gwt-TextBox","ys5admin");
|
|
|
62 |
selenium.type("css=input.gwt-PasswordTextBox","1grim@ce");
|
|
|
63 |
selenium.click("css=button.gwt-Button");
|
|
|
64 |
Thread.sleep(15000);
|
|
|
65 |
selenium.click("link=Search");
|
|
|
66 |
Thread.sleep(10000);
|
|
|
67 |
selenium.type("css=input.gwt-TextBox",Orderid);
|
|
|
68 |
selenium.click("css=button.gwt-Button");
|
|
|
69 |
Thread.sleep(10000);
|
|
|
70 |
selenium.click("css=input[type='checkbox']");
|
|
|
71 |
Thread.sleep(10000);
|
|
|
72 |
selenium.click("xpath=(//button[@type='button'])[11]");
|
|
|
73 |
Thread.sleep(10000);
|
|
|
74 |
selenium.select("css=select.gwt-ListBox","label=Delhivery");
|
|
|
75 |
selenium.click("xpath=(//button[@type='button'])[22]");
|
|
|
76 |
Thread.sleep(10000);
|
|
|
77 |
selenium.isTextPresent("Order pickup request successful");
|
|
|
78 |
selenium.click("css=div.dialogMiddleCenterInner.dialogContent > button.gwt-Button");
|
|
|
79 |
Thread.sleep(10000);
|
|
|
80 |
selenium.click("xpath=(//button[@type='button'])[12]");
|
|
|
81 |
Thread.sleep(10000);
|
|
|
82 |
selenium.select("css=select.gwt-ListBox","label=Delhivery");
|
|
|
83 |
selenium.type("css=input.gwt-TextBox", "123456789");
|
|
|
84 |
selenium.click("xpath=(//button[@type='button'])[22]");
|
|
|
85 |
Thread.sleep(5000);
|
|
|
86 |
selenium.click("css=button.gwt-Button");
|
|
|
87 |
selenium.click("link=Search");
|
|
|
88 |
Thread.sleep(10000);
|
|
|
89 |
selenium.type("css=input.gwt-TextBox",Orderid);
|
|
|
90 |
selenium.click("css=button.gwt-Button");
|
|
|
91 |
Thread.sleep(10000);
|
|
|
92 |
selenium.click("css=input[type='checkbox']");
|
|
|
93 |
Thread.sleep(10000);
|
|
|
94 |
selenium.click("xpath=(//button[@type='button'])[5]");
|
|
|
95 |
Thread.sleep(5000);
|
|
|
96 |
selenium.click("css=td > table > tbody > tr > td > button.gwt-Button");
|
|
|
97 |
Thread.sleep(5000);
|
|
|
98 |
selenium.isTextPresent("Return acceptance successful");
|
|
|
99 |
selenium.click("css=div.dialogMiddleCenterInner.dialogContent > button.gwt-Button");
|
|
|
100 |
Thread.sleep(10000);
|
|
|
101 |
selenium.click("xpath=(//button[@type='button'])[9]");
|
|
|
102 |
Thread.sleep(5000);
|
|
|
103 |
selenium.isTextPresent("Is the RETURN product usable?");
|
|
|
104 |
selenium.click("css=div.dialogMiddleCenterInner.dialogContent > table > tbody > tr > td > button.gwt-Button");
|
|
|
105 |
Thread.sleep(5000);
|
|
|
106 |
selenium.isTextPresent("RETURN validation successful");
|
|
|
107 |
selenium.click("css=button.gwt-Button");
|
|
|
108 |
Thread.sleep(5000);
|
|
|
109 |
selenium.click("link=Search");
|
|
|
110 |
Thread.sleep(10000);
|
|
|
111 |
selenium.type("css=input.gwt-TextBox",Orderid);
|
|
|
112 |
selenium.click("css=button.gwt-Button");
|
|
|
113 |
Thread.sleep(10000);
|
|
|
114 |
selenium.click("css=input[type='checkbox']");
|
|
|
115 |
Thread.sleep(10000);
|
|
|
116 |
selenium.click("xpath=(//button[@type='button'])[16]");
|
|
|
117 |
Thread.sleep(10000);
|
|
|
118 |
selenium.type("xpath=(//input[@type='text'])[10]","xyz reason");
|
|
|
119 |
selenium.click("xpath=(//button[@type='button'])[22]");
|
|
|
120 |
Thread.sleep(10000);
|
|
|
121 |
selenium.isTextPresent("Order " +Orderid+ " was refunded");
|
|
|
122 |
selenium.click("css=div.dialogMiddleCenterInner.dialogContent > button.gwt-Button");
|
|
|
123 |
Thread.sleep(5000);
|
|
|
124 |
|
|
|
125 |
|
|
|
126 |
}
|
|
|
127 |
@After
|
|
|
128 |
public void tearDown() throws Exception {
|
|
|
129 |
selenium.stop();
|
|
|
130 |
//stopSeleniumServer();
|
|
|
131 |
try {
|
|
|
132 |
if (null != loggingWriter) {
|
|
|
133 |
loggingWriter.close();
|
|
|
134 |
}
|
|
|
135 |
} catch (IOException e) {
|
|
|
136 |
System.out.println("IO exception");
|
|
|
137 |
}
|
|
|
138 |
}
|
|
|
139 |
}
|
|
|
140 |
|
|
|
141 |
|
|
|
142 |
|