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

Modified Test cases to Gradle Test Folder and Created Framework based on POM Design pattern #63

Open
wants to merge 2 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
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ repositories {
}

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'
}

test {
useTestNG()
}
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="FlightBookingTest" />
<class name="HotelBookingTest" />

</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.

33 changes: 33 additions & 0 deletions src/test/java/FlightBookingTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import org.testng.annotations.Test;

import pages.FlightBookingPage;
import supportlibraries.TestBase;

public class FlightBookingTest extends TestBase {

@Test
public void testThatResultsAppearForAOneWayJourney() {
System.out.println("Started to Validate Filght one way trip form");
FlightBookingPage flightBookPage = new FlightBookingPage(scriptHelper);

flightBookPage.clickOneWayTripOption();
flightBookPage.fillFromInput();
flightBookPage.selectFromPlaceDropDownValue();
flightBookPage.fillToInput();
flightBookPage.selectToPlaceDropDownValue();
flightBookPage.selectDepartOnDate();
flightBookPage.searchForOneWayFilght();
// Wait for loading the Summary Page
waitForPageLoad(1000);
// verify that result appears for the provided journey search
Assert.assertTrue(flightBookPage.verifySummaryPageIsDisplayed(), "Filght Results Summary Section is displayed");

}
}
32 changes: 32 additions & 0 deletions src/test/java/HotelBookingTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import supportlibraries.ScriptHelper;
import supportlibraries.TestBase;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
import org.testng.Assert;
import org.testng.annotations.Test;

import pages.HotelBookingPage;

public class HotelBookingTest extends TestBase {

@Test
public void shouldBeAbleToSearchForHotels() {

HotelBookingPage hotelBookingPage = new HotelBookingPage(scriptHelper);

hotelBookingPage.selectHotelLeftNav();
hotelBookingPage.searchForLocality();
// Selecting value from Suggestion drop down
hotelBookingPage.selectLocationSuggestion();
hotelBookingPage.selectFromAndToDateFromPicker();
hotelBookingPage.selectTravellerSection();
// Select Search Button
hotelBookingPage.clickSearchButton();

Assert.assertTrue(hotelBookingPage.verifyHotelResultsPageIsDisplayed(), "Hotel Summary Section is Displayed");
}

}
25 changes: 25 additions & 0 deletions src/test/java/SignInTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;

public class SignInTest {

WebDriver driver = new ChromeDriver();

@Test
public void shouldThrowAnErrorIfSignInDetailsAreMissing() {

driver.findElement(By.linkText("Your trips")).click();
driver.findElement(By.id("SignIn")).click();

driver.findElement(By.id("signInButton")).click();

String errors1 = driver.findElement(By.id("errors1")).getText();
Assert.assertTrue(errors1.contains("There were errors in your submission"));
driver.quit();
}


}
Loading