Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1a3f540
Delete src/test/resources/docker/grafanaAndInfluxDb directory
adityaMishraQA Jul 12, 2025
7339fbb
Delete src/test/resources/docker/elasticSearchAndKibana directory
adityaMishraQA Jul 12, 2025
2e43252
Adding scroll to element feature
adityaMishraQA Jul 13, 2025
805b60e
Suace Demo Test Cases
adityaMishraQA Aug 25, 2025
edffbf8
Merge pull request #1 from adityaMishraQA/featureBranch
adityaMishraQA Aug 25, 2025
227b3d7
New Test Cases
adityaMishraQA Nov 18, 2025
eaafb4b
cargoRunner Features
adityaMishraQA Nov 24, 2025
43a34ac
Merge pull request #2 from adityaMishraQA/featureBranch
adityaMishraQA Nov 24, 2025
0a4ddcb
rebasing from upstream branch
adityaMishraQA Nov 24, 2025
1978b8c
Merge pull request #4 from adityaMishraQA/featureBranch
adityaMishraQA Nov 24, 2025
acf16aa
rebasing from upstream branch
adityaMishraQA Nov 24, 2025
1152f0f
adding chrome as default browser
adityaMishraQA Nov 24, 2025
074bd93
Merge pull request #5 from adityaMishraQA/featureBranch
adityaMishraQA Nov 24, 2025
03533e0
adding maven complier version
adityaMishraQA Nov 24, 2025
8134b6d
Merge pull request #6 from adityaMishraQA/featureBranch
adityaMishraQA Nov 24, 2025
8001471
adding non headless
adityaMishraQA Nov 24, 2025
6367376
Merge pull request #7 from adityaMishraQA/featureBranch
adityaMishraQA Nov 24, 2025
4b73187
Test cases Cargo
adityaMishraQA Nov 26, 2025
f9b9d89
adding parallel true for dataprovidder
adityaMishraQA Nov 26, 2025
6b3c57f
using object array to pass data
adityaMishraQA Nov 27, 2025
dc563cf
milestone all field test
adityaMishraQA Nov 27, 2025
fe37de5
File.septrator
adityaMishraQA Nov 28, 2025
61dab27
Merge pull request #8 from adityaMishraQA/featureBranch
adityaMishraQA Nov 28, 2025
f9cfa73
adding headless as true
adityaMishraQA Nov 28, 2025
1c3dc76
Merge pull request #9 from adityaMishraQA/featureBranch
adityaMishraQA Nov 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,16 @@
<version>${lombok.version}</version> <!-- Replace with the latest version -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.4.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.4.1</version>
</dependency>
<dependency>
<groupId>com.influxdb</groupId>
<artifactId>influxdb-client-java</artifactId>
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/com/asismisr/codeUtils/CommonUtilis.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.asismisr.codeUtils;

import java.security.SecureRandom;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDate;
Expand All @@ -12,6 +13,8 @@
import java.util.Date;

public class CommonUtilis {
private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
private static final SecureRandom random = new SecureRandom();

/**
* This method will return the date in the specified format w.r.t to the current date
Expand Down Expand Up @@ -112,7 +115,6 @@ public static String getCurrentDateTimeInSpecifiedFormat(String targetFormat) {
return "Invalid date-time format: " + e.getMessage();
}
}

/**
* Get current time as Instant converted from local system time zone.
*
Expand All @@ -124,4 +126,13 @@ public static Instant getCurrentLocalTimeInstant() {
return localDateTime.atZone(systemZone).toInstant();
}

public static String randomString(int length) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

write method comment and desciption

StringBuilder sb = new StringBuilder(length);
for (int i = 0; i < length; i++) {
int index = random.nextInt(CHARACTERS.length());
sb.append(CHARACTERS.charAt(index));
}
return sb.toString();
}

}
10 changes: 5 additions & 5 deletions src/main/java/com/asismisr/configs/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public static void initializeProperties(){

// load the default properties
properties = loadProperties();

// overriding the default properties
for(String key : properties.stringPropertyNames()){
if(System.getProperties().containsKey(key)){
Expand All @@ -50,10 +49,11 @@ public static void initializeProperties(){
* @return property value
*/
public static String getTestProperty(String key){
String value = properties.getProperty(key);
if(Objects.isNull(value))
throw new ResourceNotFoundExceptions("Value for {} not found in default.properties file for"+ key);
return value;

if(Objects.isNull(properties.getProperty(key))) {
throw new ResourceNotFoundExceptions("Value for not found in default.properties file for"+ key);
}
return properties.getProperty(key);
}

public static Properties loadProperties(){
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/com/asismisr/constants/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,34 @@ private Constants(){
public static final String SELENIUM_GRID_HUB_HOST = "selenium.grid.hubHost";
public static final String BROWSER = "browser";
public static final String FLIGHT_RESERVATION_URL = "flightregervation.url";
public static final String SAUCEDEMO_URL="saucedemo.url";
public static final String VENDOR_PORTAL_URL = "vendorportal.url";
public static final String ERROR_MSG_BROWSER_NOT_SUPPORT = "Browser type not supported";
public static final String TRUE = "true";
public static final String HEADLESS_MODE_FLAG = "browser.headless";
public static final String ELASTIC_REALTIME_EXECUTION_REPORT = "elastic.realtime.execution.report";
public static final String INFLUX_REALTIME_EXECUTION_REPORT = "influxDb.realtime.execution.report";
public static final String LOGIN_USERNAME="saucedemo.username";
public static final String LOGIN_PASSWORD="saucedemo.password";
public static final String LOGIN_BUTTON_ATTRIBUTE="Login";
public static final String PRODUCTPAGE_TITLE="saucedemo.productPageTitle";
public static final String ITEM_NAME="saucedemo.itemName";
public static final String YOURCART_TITLE="saucedemo.yourcartPageTitle";
public static final String CHECKOUT_TITLE="saucedemo.checkoutPageTitle";
public static final String PRICETOTAL_TEXT="saucedemo.priceTotalText";
public static final String CARGORUNNER_URL="cargo.website";
public static final String CARGORUNNER_USERNAME="cargo.username";
public static final String CARGORUNNER_PASSWORD="cargo.password";
public static final String CARGORUNNER_NAVIGATING_URL="cargo.workflowurl";
public static final String CARGORUNNER_FILLING_TASKNAME="cargo.taskName";
public static final String CARGORUNNER_FILLING_TASKCODE="cargo.taskCode";
public static final String CARGORUNNER_FILLING_WORKFLOWTYPE="cargo.workflowType";
public static final String CARGORUNNER_FILLING_EDITEDNAME="cargo.editedName";
public static final String CARGORUNNER_FILLING_EDITEDCODE="cargo.editedCode";
public static final String CARGORUNNER_FILLING_EDITEDWORKTYPE="cargo.editedWorkType";
public static final String CARGORUNNER_TITLE_WF="cargo.workflowPageTitle";



public static final Long LONG_TEN = 10L;
}
1 change: 1 addition & 0 deletions src/main/java/com/asismisr/drivermanagement/Driver.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static void initDriver() {
driver = getLocalWebdriver();
}
DriverManager.setWebDriverThreadLocal(driver);
DriverManager.getWebDriverFromThreadLocal().manage().window().maximize();
}

//TODO: need to add support for headless for remote web driver/selenium hub execution too
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ public class ExplicitWaitImplementation {
* @param waitStrategyEnums
* @return
*/
public static WebElement explicitWaitByStrategy(By by, WaitStrategyEnums waitStrategyEnums){
public static WebElement explicitWaitByStrategy(By by, WaitStrategyEnums waitStrategyEnums, long timeDuration){

WebElement webElement;
webElement = switch(waitStrategyEnums){
case CLICKABLE -> new WebDriverWait(DriverManager.getWebDriverFromThreadLocal(), Duration.ofSeconds(Constants.LONG_TEN))
case CLICKABLE -> new WebDriverWait(DriverManager.getWebDriverFromThreadLocal(), Duration.ofSeconds(timeDuration))
.until(ExpectedConditions.elementToBeClickable(by));
case VISIBLE -> new WebDriverWait(DriverManager.getWebDriverFromThreadLocal(), Duration.ofSeconds(Constants.LONG_TEN))
case VISIBLE -> new WebDriverWait(DriverManager.getWebDriverFromThreadLocal(), Duration.ofSeconds(timeDuration))
.until(ExpectedConditions.visibilityOfElementLocated(by));
case ISPRESENT -> new WebDriverWait(DriverManager.getWebDriverFromThreadLocal(), Duration.ofSeconds(Constants.LONG_TEN))
case ISPRESENT -> new WebDriverWait(DriverManager.getWebDriverFromThreadLocal(), Duration.ofSeconds(timeDuration))
.until(ExpectedConditions.presenceOfElementLocated(by));
default -> throw new IllegalStateException("Unexpected value: " + waitStrategyEnums);
};
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/asismisr/listeners/RetryListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
public class RetryListener implements IRetryAnalyzer {

private int count = 0;
private static final int MAX_RETRY_COUNT = 1; // set the maximum number of retries here
private static final int MAX_RETRY_COUNT = 0; // set the maximum number of retries here

/**
* this method will enable test case to re-run in case the test case fails.
Expand Down
136 changes: 125 additions & 11 deletions src/main/java/com/asismisr/pages/BasePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,138 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.Duration;
import java.util.HashMap;
import java.util.List;


public class BasePage {

private static final Logger log = LoggerFactory.getLogger(BasePage.class);

protected void goToUrl(String url){
// todo: make this protected
public void goToUrl(String url){
DriverManager.getWebDriverFromThreadLocal().get(url);
ExtentReportLogger.info("URL launched:"+url);
log.info("Navigating to URL: {}", url);
}

protected void navigatingURL(String url)
{
DriverManager.getWebDriverFromThreadLocal().navigate().to(url);
ExtentReportLogger.info("navigated to:"+url);
log.info("Navigating to URL: {}", url);
}

protected String xPathEditor(String xpath,String nameOfField)
{
return String.format(xpath,nameOfField);
}

protected void clickElement(By by){
DriverManager.getWebDriverFromThreadLocal().findElement(by).click();
ExtentReportLogger.info("Element Clicked:"+ by.toString());
log.info("{} Element Clicked", by.toString());
}

protected String getElementText(String element){
ExtentReportLogger.info("Element text:"+ element.toString());
log.info("{} Element text", element.toString());
return DriverManager.getWebDriverFromThreadLocal().findElement(By.xpath(element)).getText();
}

protected WebElement findElementsXpath(String input)
{
ExtentReportLogger.info("Element found:"+input);
log.info("Element found: {}",input);
return DriverManager.getWebDriverFromThreadLocal().findElement(By.xpath(input));
}

protected void clickOnElement(String element)
{
DriverManager.getWebDriverFromThreadLocal().findElement(By.xpath(element)).click();
ExtentReportLogger.info("Element clicked:"+element);
log.info("Element clicked: {}",element);
}

protected WebElement clickOnElementToSendText(String element)
{
ExtentReportLogger.info("Sending Text:"+element);
log.info("Sending Text: {}",element);
return DriverManager.getWebDriverFromThreadLocal().findElement(By.xpath(element));
}
protected WebElement clickOnElementusingIdToSendText(String element)
{
ExtentReportLogger.info("Sending Text:"+element);
log.info("Sending Text: {}",element);
return DriverManager.getWebDriverFromThreadLocal().findElement(By.id(element));
}

protected WebElement waitingForElementsToLoad(WebElement element,long seconds)
{
WebDriverWait wait=new WebDriverWait(DriverManager.getWebDriverFromThreadLocal(),Duration.ofSeconds(seconds));
return wait.until(ExpectedConditions.visibilityOf(element));

}

protected boolean isElementDisplayed(String element)
{
ExtentReportLogger.info("Element located:"+element);
log.info("Element located: {}",element);
return DriverManager.getWebDriverFromThreadLocal().findElement(By.xpath(element)).isDisplayed();
}
protected boolean isElementEnabled(String element)
{
ExtentReportLogger.info("Element located:"+element);
log.info("Element located: {}",element);
return DriverManager.getWebDriverFromThreadLocal().findElement(By.xpath(element)).isEnabled();
}

protected void scrollToElement(By by)
{
Actions actions=new Actions(DriverManager.getWebDriverFromThreadLocal());
WebElement element=DriverManager.getWebDriverFromThreadLocal().findElement(by);
actions.scrollToElement(element).perform();
ExtentReportLogger.info("Element Scrolled:"+ by.toString());
log.info("{} Element Scrolled", by.toString());
}

protected void sendElement(By by, String textToField){
DriverManager.getWebDriverFromThreadLocal().findElement(by).sendKeys(textToField);
ExtentReportLogger.info(by.toString()+" Text Entered is "+ textToField);
log.info("{} Text Entered is {}", by.toString(), textToField);
}

protected void sendElement(String xpathString, String textToField){
DriverManager.getWebDriverFromThreadLocal().findElement(By.xpath(xpathString)).sendKeys(textToField);
ExtentReportLogger.info(xpathString+" Text Entered is "+ textToField);
log.info("{} Text Entered is {}", xpathString, textToField);
}

protected boolean isElementVisible(By by){
return new WebDriverWait(DriverManager.getWebDriverFromThreadLocal(), Duration.ofSeconds(10))
.until(webElement -> webElement.findElement(by).isDisplayed());
}



protected String getPageURL()
{
String pageURL=DriverManager.getWebDriverFromThreadLocal().getCurrentUrl();
ExtentReportLogger.info(" URL returned is "+ pageURL);
log.info("{} URL returned is {}", pageURL);
return pageURL;
}



protected String getText(By by){
String textFetchedFromUi = DriverManager.getWebDriverFromThreadLocal().findElement(by).getText();
ExtentReportLogger.info("text fetched from Ui:"+ textFetchedFromUi);
Expand Down Expand Up @@ -79,8 +175,8 @@ protected void clickWebElement(WebElement webElement){
* @param by by
* @param waitStrategyEnums can be VISIBLE,CLICKABLE,ISPRESENT;
*/
protected void clickElementWithWait(By by, WaitStrategyEnums waitStrategyEnums){
ExplicitWaitImplementation.explicitWaitByStrategy(by, waitStrategyEnums).click();
protected void clickElementWithWait(By by, WaitStrategyEnums waitStrategyEnums,long durationInSecond){
ExplicitWaitImplementation.explicitWaitByStrategy(by, waitStrategyEnums,durationInSecond).click();
ExtentReportLogger.info("Element Clicked:"+by.toString());
log.info("{} Element Clicked", by.toString());
}
Expand All @@ -90,18 +186,36 @@ protected void clickElementWithWait(By by, WaitStrategyEnums waitStrategyEnums){
* @param by by
* @param waitStrategyEnums can be VISIBLE,CLICKABLE,ISPRESENT;
*/
protected void sendElementWithWait(By by, String textToField, WaitStrategyEnums waitStrategyEnums){
ExplicitWaitImplementation.explicitWaitByStrategy(by, waitStrategyEnums).sendKeys(textToField);
protected void sendElementWithWait(By by, String textToField, WaitStrategyEnums waitStrategyEnums,long durationInSecond){
ExplicitWaitImplementation.explicitWaitByStrategy(by, waitStrategyEnums,durationInSecond).sendKeys(textToField);
ExtentReportLogger.info(by.toString()+" Text Entered is "+ textToField);
log.info("{} Text Entered is {}", by.toString(), textToField);
}

protected void scrollToElement(By by)
protected WebElement clickElementWithWait(String xpath, WaitStrategyEnums waitStrategyEnums,long durationInSecond){
By by=By.xpath(xpath);
WebElement element=ExplicitWaitImplementation.explicitWaitByStrategy(by, waitStrategyEnums,durationInSecond);
ExtentReportLogger.info("Element Clicked:"+by.toString());
log.info("{} Element Clicked", by.toString());
return element;
}

protected WebElement clearField(String xpath,WaitStrategyEnums waitStrategyEnums,long durationInSecond)
{
Actions actions=new Actions(DriverManager.getWebDriverFromThreadLocal());
WebElement element=DriverManager.getWebDriverFromThreadLocal().findElement(by);
actions.scrollToElement(element).perform();
ExtentReportLogger.info("Element Scrolled:"+ by.toString());
log.info("{} Element Scrolled", by.toString());
By by=By.xpath(xpath);
WebElement element=ExplicitWaitImplementation.explicitWaitByStrategy(by, waitStrategyEnums,durationInSecond);
ExtentReportLogger.info("Field Cleared:"+by.toString());
log.info("{} Field Cleared", by.toString());
return element;

}
protected WebElement findElementWithWait(String xpath, WaitStrategyEnums waitStrategyEnums,long durationInSecond){
By by=By.xpath(xpath);
WebElement element=ExplicitWaitImplementation.explicitWaitByStrategy(by, waitStrategyEnums,durationInSecond);
ExtentReportLogger.info("Element Clicked:"+by.toString());
log.info("{} Element Clicked", by.toString());
return element;
}


}
34 changes: 34 additions & 0 deletions src/main/java/com/asismisr/pages/cargoRunner/LoginPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.asismisr.pages.cargoRunner;

import com.asismisr.pages.BasePage;

public class LoginPage extends BasePage {
private final String LOGINXPATH="//input[@id='username']";
private final String PASSWORDXPATH="//input[@id='password']";
private final String LOGINBUTTON="//input[@value='Sign In']";


public void goToWebsite(String url)
{
goToUrl(url);
}


public void enteringLoginDetails(String username,String password)
{
clickOnElementToSendText(LOGINXPATH).sendKeys(username);
clickOnElementToSendText(PASSWORDXPATH).sendKeys(password);
}

public void clickOnSigninButton()
{
clickOnElement(LOGINBUTTON);
}

public boolean isSigninButtonEnable()
{
return findElementsXpath(LOGINBUTTON).isEnabled();
}


}
Loading