Skip to content

Commit 5078f40

Browse files
authored
Merge pull request #38 from mindstix-labs/dev_manojs
Mail notifications for test output
2 parents 8fd32d2 + 04b978d commit 5078f40

File tree

24 files changed

+467
-72
lines changed

24 files changed

+467
-72
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright (c) 2017 Mindstix Inc.
3+
*/
4+
package com.mindstix.cb.data;
5+
6+
import java.util.List;
7+
8+
/**
9+
* Represents Report
10+
*
11+
* @author Mindstix
12+
*/
13+
public class Report {
14+
private List<ReportData> reportData;
15+
16+
/**
17+
* @return the reportData
18+
*/
19+
public List<ReportData> getReport() {
20+
return reportData;
21+
}
22+
23+
/**
24+
* @param reportData
25+
* the reportData to set
26+
*/
27+
public void setReport(List<ReportData> reportData) {
28+
this.reportData = reportData;
29+
}
30+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Copyright (c) 2017 Mindstix Inc.
3+
*/
4+
package com.mindstix.cb.data;
5+
6+
import java.util.List;
7+
8+
/**
9+
* Represents the report data
10+
*
11+
* @author Mindstix
12+
*/
13+
public class ReportData {
14+
private String scenario;
15+
private List<String> allProductID;
16+
private String testResult;
17+
18+
public String getTestResult() {
19+
return testResult;
20+
}
21+
22+
public void setTestResult(String testResult) {
23+
this.testResult = testResult;
24+
}
25+
26+
/**
27+
* @return the scenario
28+
*/
29+
public String getScenario() {
30+
return scenario;
31+
}
32+
33+
/**
34+
* @param scenario
35+
* the scenario to set
36+
*/
37+
public void setScenario(String scenario) {
38+
this.scenario = scenario;
39+
}
40+
41+
/**
42+
* @return the allProductID
43+
*/
44+
public List<String> getAllProductID() {
45+
return allProductID;
46+
}
47+
48+
/**
49+
* @param allProductID
50+
* the allProductID to set
51+
*/
52+
public void setAllProductID(List<String> allProductID) {
53+
this.allProductID = allProductID;
54+
}
55+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2017 Mindstix Inc.
3+
*/
4+
package com.mindstix.cb.data;
5+
6+
/**
7+
* This class represents report header
8+
*
9+
* @author Mindstix
10+
*/
11+
public class ReportHeader {
12+
private String date;
13+
14+
/**
15+
* @param date
16+
*/
17+
public ReportHeader(String date) {
18+
this.date = date;
19+
}
20+
21+
/**
22+
* @return the date
23+
*/
24+
public String getDate() {
25+
return date;
26+
}
27+
}

src/main/java/com/mindstix/cb/data/Signature.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@
1313
public class Signature {
1414

1515
private List<SignatureCoordinates> signatures;
16-
17-
public List<SignatureCoordinates> getSignatures(){
16+
17+
public List<SignatureCoordinates> getSignatures() {
1818
return signatures;
1919
}
20-
20+
2121
public void setSignatures(List<SignatureCoordinates> signatures) {
2222
this.signatures = signatures;
2323
}

src/main/java/com/mindstix/cb/data/SignatureCoordinates.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ public class SignatureCoordinates {
1515

1616
private String signatureID;
1717
private List<Point> coordinates;
18-
18+
1919
public String getSignatureID() {
2020
return this.signatureID;
2121
}
22-
22+
2323
public void setSignatureID(String signtureID) {
2424
this.signatureID = signtureID;
2525
}
26-
27-
public List<Point> getCoordinates(){
26+
27+
public List<Point> getCoordinates() {
2828
return coordinates;
2929
}
30-
30+
3131
public void setCoordinates(List<Point> coordinates) {
3232
this.coordinates = coordinates;
3333
}

src/main/java/com/mindstix/cb/page/BasePage.java

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public Boolean isOnPage(String requiredURL) {
7878
*
7979
* @param webElementKey
8080
* -The XPath which must Present on Web Page
81-
* @return WebElement element -Will Return WebElement which is present on Web
82-
* Page with Mentioned XPath
81+
* @return WebElement element -Will Return WebElement which is present on
82+
* Web Page with Mentioned XPath
8383
*/
8484
public WebElement getElementByXPath(String webElementKey) {
8585
stopWatch = new StopWatch();
@@ -96,12 +96,13 @@ public WebElement getElementByXPath(String webElementKey) {
9696
}
9797

9898
/**
99-
* To get WebElement by specifying CSS Selector of Element Present on Web Page
99+
* To get WebElement by specifying CSS Selector of Element Present on Web
100+
* Page
100101
*
101102
* @param webElementKey
102103
* -The CSS Selector which must Present on Web Page
103-
* @return WebElement element -Will Return WebElement which is present on Web
104-
* Page with Mentioned CssSelector
104+
* @return WebElement element -Will Return WebElement which is present on
105+
* Web Page with Mentioned CssSelector
105106
*/
106107
public WebElement getElementByCSS(String webElementKey) {
107108
stopWatch = new StopWatch();
@@ -118,15 +119,15 @@ public WebElement getElementByCSS(String webElementKey) {
118119
}
119120

120121
/**
121-
* To get WebElement by specifying prefix of selector and key of cssSelctor of
122-
* Element Present on Web Page
122+
* To get WebElement by specifying prefix of selector and key of cssSelctor
123+
* of Element Present on Web Page
123124
*
124125
* @param webElementKey
125126
* -The key of CSS Selector which must be Present on Web Page
126127
* @param prefix
127128
* -The prefix of cssSelector
128-
* @return WebElement element -Will Return WebElement which is present on Web
129-
* Page with Mentioned CssSelector
129+
* @return WebElement element -Will Return WebElement which is present on
130+
* Web Page with Mentioned CssSelector
130131
*/
131132
public WebElement getElementByCSS(String prefix, String webElementKey) {
132133
stopWatch = new StopWatch();
@@ -144,8 +145,7 @@ public WebElement getElementByCSS(String prefix, int index, String suffix) {
144145
stopWatch = new StopWatch();
145146
stopWatch.start();
146147
WebDriverWait webDriverWait = new WebDriverWait(webDriver, 30);
147-
webDriverWait.until(ExpectedConditions
148-
.visibilityOfElementLocated(By.cssSelector(getSelectors(prefix) + index + getSelectors(suffix))));
148+
webDriverWait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(getSelectors(prefix) + index + getSelectors(suffix))));
149149
WebElement element = webDriver.findElement(By.cssSelector(getSelectors(prefix) + index + getSelectors(suffix)));
150150
LOGGER.info("Located Web Element");
151151
jScriptExecutor = (JavascriptExecutor) webDriver;
@@ -156,8 +156,8 @@ public WebElement getElementByCSS(String prefix, int index, String suffix) {
156156
}
157157

158158
/**
159-
* Method to get Array of WebElement by specifying XPath of Elements Present on
160-
* Web Page
159+
* Method to get Array of WebElement by specifying XPath of Elements Present
160+
* on Web Page
161161
*
162162
* @param webElementKey
163163
* -XPath of Elements Present on Web Page
@@ -200,8 +200,7 @@ public List<WebElement> getArrayOfElementByCSS(String webElementKey) {
200200
WebDriverWait webDriverWait = new WebDriverWait(webDriver, 30);
201201
webDriverWait.ignoring(NoSuchElementException.class);
202202
webDriverWait.ignoring(TimeoutException.class);
203-
webDriverWait
204-
.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(getSelectors(webElementKey))));
203+
webDriverWait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(getSelectors(webElementKey))));
205204
dropDownList = webDriver.findElements(By.cssSelector(getSelectors(webElementKey)));
206205
stopWatch.stop();
207206
LOGGER.info("Time taken to load element is {} Milliseconds", stopWatch.getTime());
@@ -232,8 +231,7 @@ public List<WebElement> getArrayOfElementByCSS(String suffix, String webElementK
232231
WebDriverWait webDriverWait = new WebDriverWait(webDriver, 30);
233232
webDriverWait.ignoring(NoSuchElementException.class);
234233
webDriverWait.ignoring(TimeoutException.class);
235-
webDriverWait.until(ExpectedConditions
236-
.visibilityOfElementLocated(By.cssSelector(suffix + getSelectors(webElementKey))));
234+
webDriverWait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(suffix + getSelectors(webElementKey))));
237235
dropDownList = webDriver.findElements(By.cssSelector(suffix + getSelectors(webElementKey)));
238236
stopWatch.stop();
239237
LOGGER.info(suffix + getSelectors(webElementKey));
@@ -262,8 +260,8 @@ public String getCurrentURL() {
262260
*
263261
* @param webElementKey
264262
* -The LinkText of element which is Present on Web Page
265-
* @return WebElement element -Will Return WebElement which is present on Web
266-
* Page with Mentioned LinkText
263+
* @return WebElement element -Will Return WebElement which is present on
264+
* Web Page with Mentioned LinkText
267265
*/
268266
public WebElement getElementByLink(String webElementKey) {
269267
stopWatch = new StopWatch();
@@ -417,6 +415,15 @@ public void selectValueInDropDownByVisibleText(WebElement webElement, String val
417415
webElementSelect.selectByVisibleText(value);
418416
}
419417

418+
/**
419+
* Used to draw a signature on canvas
420+
*
421+
* @param webElementKey
422+
* Selector key for canvas element
423+
* @param signatureID
424+
* Signature ID mentioned in YML file to get the coordinates to
425+
* draw signature
426+
*/
420427
public void drawOnCanvas(String webElementKey, String signatureID) {
421428
List<Point> points = PropertiesUtility.getSignatureCoordinates(signatureID);
422429
WebElement canvas = getElementByCSS(webElementKey);
@@ -428,6 +435,12 @@ public void drawOnCanvas(String webElementKey, String signatureID) {
428435
drawAction.release().perform();
429436
}
430437

438+
/**
439+
* Used to get Doller value by excluding $ sign
440+
*
441+
* @param webElementKey
442+
* @return floating value
443+
*/
431444
public float getDollerAmountByCSS(String webElementKey) {
432445
float amount;
433446
webElementKey = getElementByCSS(webElementKey).getText();
@@ -437,6 +450,13 @@ public float getDollerAmountByCSS(String webElementKey) {
437450
return amount;
438451
}
439452

453+
/**
454+
* Used to compare two float values
455+
*
456+
* @param n1
457+
* @param n2
458+
* @return
459+
*/
440460
public boolean isEqual(float n1, float n2) {
441461
return Math.abs(n1 - n2) < 0.0001;
442462
}

src/main/java/com/mindstix/cb/page/ContactUs.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,4 @@ public class ContactUs extends BasePage {
1616
public ContactUs(WebDriver webDriver) {
1717
super(webDriver);
1818
}
19-
2019
}

src/main/java/com/mindstix/cb/page/HomePage.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import org.openqa.selenium.WebElement;
88

99
/**
10-
* Represents Automation Practice Home Page
11-
* <li>automationpractice.com/index.php</li>
10+
* Represents Automation Practice Home Page <li>automationpractice.com/index.php
11+
* </li>
1212
*
1313
* @author Mindstix
1414
*/
@@ -45,5 +45,4 @@ public Search clickOnSearchButton() {
4545
scrollAndClick(searchButton);
4646
return new Search(webDriver);
4747
}
48-
4948
}

src/main/java/com/mindstix/cb/page/LogIn.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import org.openqa.selenium.WebElement;
88

99
/**
10-
* Represents Log In Page
11-
* <li>automationpractice.com/index.php?controller=authentication&back=my-account</li>
10+
* Represents Log In Page <li>
11+
* automationpractice.com/index.php?controller=authentication&back=my-account</li>
1212
*
1313
* @author Mindstix
1414
*/
@@ -84,5 +84,4 @@ public MyAccount registerUser(String emailAddress, String password) {
8484
scrollAndClick(registerButton);
8585
return new MyAccount(webDriver);
8686
}
87-
8887
}

src/main/java/com/mindstix/cb/page/MyAccount.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
import org.openqa.selenium.WebDriver;
77

88
/**
9-
* Represents My Account Page
10-
* <li>automationpractice.com/index.php?controller=my-account</li>
9+
* Represents My Account Page <li>
10+
* automationpractice.com/index.php?controller=my-account</li>
1111
*
1212
* @author Mindstix
1313
*/
@@ -16,5 +16,4 @@ public class MyAccount extends BasePage {
1616
public MyAccount(WebDriver webDriver) {
1717
super(webDriver);
1818
}
19-
2019
}

0 commit comments

Comments
 (0)