Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Committing assignment #73

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added Drivers/chromedriver
Binary file not shown.
File renamed without changes.
File renamed without changes.
Binary file added Resources/DataProvider.xls
Binary file not shown.
Binary file removed chromedriver
Binary file not shown.
16 changes: 16 additions & 0 deletions config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
environment=https://www.cleartrip.com/
platformname=desktop
//browser=chrome or mozilla or notrequired
browser=chrome
//os=windows or mac
os=mac
resultsdir=Reports
shareddirectory=Drivers
reportfilename=Test_Status.html
[email protected]
replyto=noreply
[email protected]
//[email protected]
reportpassword=password
resources=Resources
dataproviderpath=DataProvider.xls
24 changes: 22 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.testvagrant.codingRound</groupId>
<artifactId>codoingRound</artifactId>
<artifactId>codingRound</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>compile</scope>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
Expand All @@ -24,5 +24,25 @@
<version>6.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>com.relevantcodes</groupId>
<artifactId>extentreports</artifactId>
<version>2.41.2</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>smtp</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'codoingRound'
rootProject.name = 'codingRound'

89 changes: 0 additions & 89 deletions src/main/java/FlightBookingTest.java

This file was deleted.

53 changes: 0 additions & 53 deletions src/main/java/HotelBookingTest.java

This file was deleted.

51 changes: 0 additions & 51 deletions src/main/java/SignInTest.java

This file was deleted.

79 changes: 79 additions & 0 deletions src/main/java/codingRound/cleartrip/FlightBooking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package codingRound.cleartrip;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import com.relevantcodes.extentreports.ExtentTest;

import codingRound.commonLib.CommonFunctionsLib;
import codingRound.utility.Configurations;

public class FlightBooking {

@FindBy(id="OneWay")
public static WebElement onewayRadiobtn;

@FindBy(id="FromTag")
public static WebElement fromTag;

@FindBy(id="ToTag")
public static WebElement toTag;

@FindBy(xpath="//input[@class='keyValue span span24 required arabicChars ui-autocomplete-input']")
public static WebElement fromInput;

@FindBy(xpath="//input[@id='ToTag' and @class='keyValue span span24 required arabicChars ui-autocomplete-input']")
public static WebElement toInput;
@FindBy(id="ui-id-1")
public static WebElement originOptions;

@FindBy(id="ui-id-2")
public static WebElement destinationOptions;

@FindBy(xpath="//*[@id='ui-datepicker-div']/div[1]/table/tbody/tr[3]/td[7]/a")
public static WebElement datePickerEle;

@FindBy(id="SearchBtn")
public static WebElement searchBtn;

@FindBy(className="searchSummary")
public static WebElement searchSummary;

public WebDriver driver;
public ExtentTest logger;

public FlightBooking(WebDriver driver, ExtentTest logger) {
this.driver = driver;
this.logger = logger;
PageFactory.initElements(driver, this);

}
public void flightBooking(Object[][] bookingDetails,Configurations testConfig, CommonFunctionsLib common) {
String from=bookingDetails[0][0].toString();
String to=bookingDetails[0][1].toString();
onewayRadiobtn.click();
common.sendingKeys(fromTag, from, driver);
common.waitForPageLoaded(driver, logger);
common.checkPresenceOfElement(fromInput, driver);
originOptions.click();
//common.waitForPageLoaded(driver, logger);
common.sendingKeys(toTag, to, driver);
common.checkPresenceOfElement(destinationOptions, driver);

//select the first item from the destination auto complete list

destinationOptions.click();
datePickerEle.click();
searchBtn.click();

common.waitForPageLoaded(driver, logger);
//verify that result appears for the provided journey search

}

public void isResultAppeared(Configurations testConfig, CommonFunctionsLib common) {
if(common.checkPresenceOfElement(searchSummary, driver))
common.softAssert("Verify the search result"," search summary should be present","Search summary is displayed", true, logger);
}
}
47 changes: 47 additions & 0 deletions src/main/java/codingRound/cleartrip/HotelBooking.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package codingRound.cleartrip;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.Select;

import com.relevantcodes.extentreports.ExtentTest;

import codingRound.commonLib.CommonFunctionsLib;
import codingRound.utility.Configurations;

public class HotelBooking {

@FindBy(linkText = "Hotels")
private WebElement hotelLink;

@FindBy(id = "Tags")
private WebElement localityTextBox;

@FindBy(id = "SearchHotelsButton")
private WebElement searchButton;

@FindBy(id = "travellersOnhome")
private WebElement travellerSelection;
public WebDriver driver;
public ExtentTest logger;

public HotelBooking(WebDriver driver, ExtentTest logger) {
this.driver = driver;
this.logger = logger;
PageFactory.initElements(driver, this);

}
public void hotelBooking(Configurations testConfig, CommonFunctionsLib common) {
hotelLink.click();
common.waitForPageLoaded(driver, logger);
localityTextBox.click();
common.sendingKeys(localityTextBox, "Indiranagar, Bangalore", driver);

new Select(travellerSelection).selectByVisibleText("1 room, 2 adults");
searchButton.click();

}

}
Loading