Skip to content
94 changes: 94 additions & 0 deletions src/test/java/com/easybusticket/pages/FleetTypePage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.easybusticket.pages;

import com.easybusticket.utilities.Driver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.Select;

public class FleetTypePage extends BasePage{

public FleetTypePage() {
PageFactory.initElements(Driver.get("stage"), this);
}


@FindBy(xpath = "//[@class='btn btn-sm btn--primary box--shadow1 text--small addBtn']")
public WebElement fleetTypeaddNewButton;

@FindBy(xpath = "//input[@placeholder='Enter Fleet Name']")
public WebElement fleetTypeTextBoxName;

@FindBy(xpath = "//select[@name='seat_layout']")
public WebElement fleetTypeTextBoxSeatLayout;

@FindBy(xpath = "//input[@placeholder='Enter Number of Deck']")
public WebElement fleetTypeTextBoxNumberOfDeck;

@FindBy(xpath = "//input[@placeholder='Enter Number of Deck']")
public WebElement fleetTypeTextBoxSeatOfDeck;

@FindBy(xpath = "//span[@class='select2-selection select2-selection--multiple']")
public WebElement fleetTypeTextBoxFacilities;

@FindBy(xpath = "//button[.='Save']")
public WebElement fleetTypeTextBoxButtonSave;

@FindBy(xpath = "//i[@class='la la-pen']")
public WebElement penIcon;

@FindBy(xpath = "//span[.='Wifi']")
public WebElement FleetTypeTextBoxFacilitiesWifi;

@FindBy(xpath = "//span[.='Water']")
public WebElement FleetTypeTextBoxFacilitiesWater;

@FindBy(xpath = "//span[.='Tea & Coffee']")
public WebElement FleetTypeTextBoxFacilitiesTeaCoffee;

@FindBy(xpath = "//span[.='Pillow']")
public WebElement FleetTypeTextBoxFacilitiesPillow;

@FindBy(xpath = "//option[@value='Select an option']")
public WebElement firstDropdownOption;

@FindBy(xpath = "//button[.='Update']")
public WebElement updateButton;


//=======================================================================================================//

public void addFleetType () {

waitAndClick(fleetTypeaddNewButton);
waitAndClick(fleetTypeTextBoxName);

fleetTypeTextBoxName.sendKeys(faker.name().name());
waitAndClick(fleetTypeTextBoxSeatLayout);

waitAndClick(firstDropdownOption);

waitAndClick(fleetTypeTextBoxNumberOfDeck);
fleetTypeTextBoxNumberOfDeck.sendKeys("1");

waitAndClick(fleetTypeTextBoxSeatOfDeck);
fleetTypeTextBoxSeatOfDeck.sendKeys(faker.numerify("##"));

waitAndClick(fleetTypeTextBoxButtonSave);

}


public void updateFleetType(){

waitAndClick(penIcon);
waitAndClick(fleetTypeTextBoxName);
fleetTypeTextBoxName.clear();
fleetTypeTextBoxName.sendKeys("Urfa Cesur");
waitAndClick(updateButton);



}

}
22 changes: 12 additions & 10 deletions src/test/java/com/easybusticket/pages/SeatLayoutsPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public SeatLayoutsPage() {
@FindBy(xpath = "//i[@class='fa fa-fw fa-plus']")
public WebElement addNewButton;

@FindBy(xpath = "(//input[@placeholder='2 x 3'])[1]")
@FindBy(xpath = "(//input[@name='layout'])[1]")
public WebElement layoutTextBox;

@FindBy(xpath = "//button[.='Save']")
Expand All @@ -26,7 +26,7 @@ public SeatLayoutsPage() {
@FindBy(xpath = "//i[@class='la la-pen']")
public WebElement penIcon;

@FindBy(xpath = "(//input[@placeholder='2 x 3'])[2]")
@FindBy(xpath = "(//input[@name='layout'])[2]")
public WebElement layoutTextBoxUpdate;

@FindBy(xpath = "//i[@class='las la-trash']")
Expand All @@ -43,26 +43,20 @@ public SeatLayoutsPage() {
public void addSeatLayouts() {

waitAndClick(addNewButton);
softAssert.assertTrue(layoutTextBox.isDisplayed());
softAssert.assertAll();
waitAndClick(layoutTextBox);

String fakeLayout = faker.numerify("##");
layoutTextBox.sendKeys(fakeLayout);
waitAndClick(layoutTextBox);
layoutTextBox.sendKeys(faker.numerify("##"));
waitAndClick(saveButton);

}



public void updateLayout(){

waitAndClick(penIcon);
waitAndClick(layoutTextBoxUpdate);

layoutTextBoxUpdate.clear();
layoutTextBoxUpdate.sendKeys(faker.numerify("##"));

waitAndClick(updateButton);

}
Expand All @@ -72,6 +66,14 @@ public void deleteLayout(){
waitAndClick(deleteIcon);
waitAndClick(deleteButton);

}

public void titleCheckTest() {

String expectedTitle = "Add Seat Layout";
String actualTitle = Driver.get(env).getTitle();
softAssert.assertEquals(actualTitle, expectedTitle);
softAssert.assertAll();

}

Expand Down
140 changes: 140 additions & 0 deletions src/test/java/com/easybusticket/pages/UserDashboard.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
package com.easybusticket.pages;

import com.easybusticket.utilities.Driver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;

/**
* @author Ismail Koembe
*/
public class UserDashboard extends BasePage {
public UserDashboard(){
PageFactory.initElements(Driver.get("stage"),this);
}

// Button of dashboard
@FindBy(xpath = "//a[text()='Dashboard']")
public WebElement dashboardButton;

// Booking dropdown menu
@FindBy(xpath = "//a[text()='Booking']")
public WebElement dropDownBooking;

// Buy ticket option
@FindBy(xpath = "//a[text()='Buy Ticket']" )
public WebElement buyTicketOption;

// Booking history option
@FindBy(xpath = "//a[text()='Booking History']")
public WebElement bookingHistory;

// Support Request dropdown menu
@FindBy(xpath = "//a[text()='Support Request']")
public WebElement dropDownSupportRequest;

// Create New option
@FindBy(xpath = "//a[text()='Create New']")
public WebElement createNewOption;

// Requests option
@FindBy(xpath = "//a[text()='Requests']")
public WebElement requestsOption;

// Profile dropdown
@FindBy(xpath = "(//a[text()='Profile'])[1]")
public WebElement dropDownProfile;


// Profile option
@FindBy(xpath = "(//a[text()='Profile'])[2]")
public WebElement profileOption;

// Change Password option
@FindBy(xpath = "//a[text()='Change Password']")
public WebElement changePasswordOption;

// Logout option
@FindBy(xpath = "//a[text()='Logout']")
public WebElement logoutOption;

// Buy tickets button
@FindBy(xpath = "//*[@*='cmn--btn btn--sm']")
public WebElement buyTicketsButton;

// Icon Phone
@FindBy(xpath = "//*[@*='las la-phone']")
public WebElement iconPhone;

// Phone link
@FindBy(xpath = "(//a[@href='tel:+1 (603) 624-1800'])[1]")
public WebElement linkPhone;

// Icon email
@FindBy(xpath = "//*[@*='las la-envelope-open']")
public WebElement iconEmail;

// Email link
@FindBy(xpath = "(//a[@href='mailto:info@easybusticket.com'])[1]")
public WebElement linkEmail;

// Logo Easy Bus Ticket
@FindBy(xpath = "(//*[@*='logo'])[1]")
public WebElement logoEasyBusTicket;

// Link Easy bus ticket logo link-homepage link
@FindBy(xpath ="//a[@href='https://easybusticket.com']" )
public WebElement linkHomepage;

// Dashboard label
@FindBy(xpath = "(//*[@class='title'])[1]")
public WebElement titleDashboard;

// Total Booked Ticket label
@FindBy(xpath = "//p[text()='Total Booked Ticket']")
public WebElement labelTotalBookedTicket;

// Total booked ticket number
@FindBy(xpath = "(//h3[@class='title'])[1]")
public WebElement numberOfTotalBookedTicket;

// Total Rejected Ticket label
@FindBy(xpath = "//p[text()='Total Rejected Ticket']")
public WebElement labelTotalRejectedTicket;

// Total Rejected ticket number
@FindBy(xpath = "(//h3[@class='title'])[2]")
public WebElement numberOfTotalRejectedTicket;

// Total Pending Ticket label
@FindBy(xpath = "//p[text()='Total Pending Ticket']")
public WebElement labelTotalPendingTicket;

// Total Rejected ticket number
@FindBy(xpath = "(//h3[@class='title'])[3]")
public WebElement numberOfTotalPendingTicket;

// Ticket No1
@FindBy(xpath = "(//*[@class='ticket-no'])[1]")
public WebElement ticketNo1;

// Action button 1
@FindBy(xpath = "(//*[@class='action-button-wrapper'])[1]")
public WebElement actionButton;


public UserLoginPage logout(){

waitAndClick(dropDownProfile);
waitAndClick(logoutOption);
String expectedTitle ="Easy Bus Ticket - Sign In";
String actualTitle = Driver.get(env).getTitle();
softAssert.assertEquals(actualTitle, expectedTitle);
softAssert.assertAll();
return new UserLoginPage();



}

}
34 changes: 34 additions & 0 deletions src/test/java/com/easybusticket/tests/FleetType_US_31.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package com.easybusticket.tests;

import com.easybusticket.pages.AdminDashboardPage;
import com.easybusticket.pages.AdminPage;
import com.easybusticket.pages.FleetTypePage;
import org.testng.annotations.Test;

public class FleetType_US_31 extends BaseTestAdmin {

@Test
public void ManageFleets() {
AdminDashboardPage adminDashboardPage = new AdminPage().adminLogin();
ManageFleets();
}

@Test
public void AddNewFleetType(){
ManageFleets();

FleetTypePage fleetTypePage = new FleetTypePage();
fleetTypePage.addFleetType();

}

@Test
public void UpdateFleetType(){
ManageFleets();

FleetTypePage fleetTypePage = new FleetTypePage();
fleetTypePage.updateFleetType();
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public void ManageFleets() {
}

@Test

public void LayoutCreat(){

//calling ManageFleets test above ---- precondition (on kosul)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.testng.annotations.Test;

@Slf4j
public class PageSearchInAdminDashboard_US33 extends BaseTestAdmin{
public class PageSearchInAdminDashboard_US33 extends BaseTestAdmin{

@DataProvider(name="pages")
public Object[][] getPages() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.easybusticket.tests;

import com.easybusticket.pages.HomePage;
import com.easybusticket.pages.ProfilePage;
import com.easybusticket.pages.UserLoginPage;
import org.testng.annotations.Test;

public class ProfileSettingsUpdate_US_17 extends BaseTest {

@Test
public void LoginPage() throws InterruptedException {

// navigate to the login page
UserLoginPage userLoginPage = new HomePage().clickToSignIn();

ProfilePage profilePage = new ProfilePage();

userLoginPage.login();

profilePage.profileSetting();

profilePage.titleCheckTest();

profilePage.updateProfileSettings();

}
}