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

Changing scripts #65

Open
wants to merge 7 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
40 changes: 23 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
group 'com.testvagrant.codingRound'
version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'maven'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
compile group: 'junit', name: 'junit', version: '4.11'
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.6.0'
compile group: 'org.testng', name: 'testng', version: '6.11'
}
group 'com.testvagrant.codingRound'
version '1.0-SNAPSHOT'

apply plugin: 'java'
apply plugin: 'maven'

sourceCompatibility = 1.8

repositories {
mavenCentral()
}

dependencies {
compile group: 'org.seleniumhq.selenium', name: 'selenium-java', version: '3.6.0'
compile group: 'org.testng', name: 'testng', version: '6.11'
}

test {
useTestNG() {
useDefaultListeners = true
suites 'clearTrip.xml'
}
}
10 changes: 10 additions & 0 deletions clearTrip.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Regression Suite" verbose="1">
<test thread-count="1" name="Test">
<classes>
<class name="tests.FlightBookingTest" />
<class name="tests.HotelBookingTest" />
<class name="tests.SignInTest" />
</classes>
</test>
</suite>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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>
Expand Down
4 changes: 2 additions & 2 deletions 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.

84 changes: 84 additions & 0 deletions src/test/java/pages/FlightBookingPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
package pages;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

import supportlibraries.ScriptHelper;

public class FlightBookingPage extends PageBase {

@FindBy(id = "OneWay")
WebElement check_OneWayTrip;

@FindBy(css = "[id='FromTag']")
WebElement input_FromTag;

@FindBy(id = "ToTag")
WebElement input_ToTag;

@FindBy(xpath = "//*[@id='ui-id-1']")
WebElement dropDown_FromLabel;

@FindBy(xpath = "//*[@id='ui-id-2']")
WebElement dropDown_ToLabel;

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

@FindBy(id = "SearchBtn")
WebElement button_SearchFlight;

@FindBy(className = "searchSummary")
WebElement div_SearchSummary;

public String fromPlace = "Bangalore";
public String toPlace = "Delhi";

public FlightBookingPage(ScriptHelper scriptHelper) {
super(scriptHelper);
PageFactory.initElements(driver, this);
}

public void clickOneWayTripOption() {
waitForElement(check_OneWayTrip, 1000);
click(check_OneWayTrip);
}

public void fillFromInput() {
click(input_FromTag);
input_FromTag.sendKeys(fromPlace);
}

public void fillToInput() {
click(input_ToTag);
input_ToTag.sendKeys(toPlace);
}

public void selectFromPlaceDropDownValue() {
//wait for the auto complete options to appear for the origin
waitForElement(dropDown_FromLabel, 30);
selectValueFromOptionsList(dropDown_FromLabel, fromPlace);
}

public void selectToPlaceDropDownValue() {
//wait for the auto complete options to appear for the origin
waitForElement(dropDown_ToLabel, 30);
selectValueFromOptionsList(dropDown_ToLabel, toPlace);
}

public void selectDepartOnDate() {
click(link_PickFromDate);
}

public void searchForOneWayFilght() {
click(button_SearchFlight);
}

public boolean verifySummaryPageIsDisplayed() {
waitForElement(div_SearchSummary, 2000);

return isElementPresent(div_SearchSummary);
}

}
Loading