diff --git a/src/test/java/com/easybusticket/pages/FleetTypePage.java b/src/test/java/com/easybusticket/pages/FleetTypePage.java new file mode 100644 index 00000000..70cccf74 --- /dev/null +++ b/src/test/java/com/easybusticket/pages/FleetTypePage.java @@ -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); + + + + } + +} diff --git a/src/test/java/com/easybusticket/pages/SeatLayoutsPage.java b/src/test/java/com/easybusticket/pages/SeatLayoutsPage.java index e4effc3f..696ac0a5 100644 --- a/src/test/java/com/easybusticket/pages/SeatLayoutsPage.java +++ b/src/test/java/com/easybusticket/pages/SeatLayoutsPage.java @@ -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']") @@ -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']") @@ -43,18 +43,13 @@ 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); @@ -62,7 +57,6 @@ public void updateLayout(){ layoutTextBoxUpdate.clear(); layoutTextBoxUpdate.sendKeys(faker.numerify("##")); - waitAndClick(updateButton); } @@ -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(); } diff --git a/src/test/java/com/easybusticket/pages/UserDashboard.java b/src/test/java/com/easybusticket/pages/UserDashboard.java new file mode 100644 index 00000000..fb072a33 --- /dev/null +++ b/src/test/java/com/easybusticket/pages/UserDashboard.java @@ -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(); + + + + } + +} diff --git a/src/test/java/com/easybusticket/tests/FleetType_US_31.java b/src/test/java/com/easybusticket/tests/FleetType_US_31.java new file mode 100644 index 00000000..0017d243 --- /dev/null +++ b/src/test/java/com/easybusticket/tests/FleetType_US_31.java @@ -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(); + } + + +} \ No newline at end of file diff --git a/src/test/java/com/easybusticket/tests/ManageFleets_US_31.java b/src/test/java/com/easybusticket/tests/ManageFleets_US_31.java index c2240f6e..a8c5ff93 100644 --- a/src/test/java/com/easybusticket/tests/ManageFleets_US_31.java +++ b/src/test/java/com/easybusticket/tests/ManageFleets_US_31.java @@ -16,6 +16,7 @@ public void ManageFleets() { } @Test + public void LayoutCreat(){ //calling ManageFleets test above ---- precondition (on kosul) diff --git a/src/test/java/com/easybusticket/tests/PageSearchInAdminDashboard_US33.java b/src/test/java/com/easybusticket/tests/PageSearchInAdminDashboard_US33.java index 3068dbed..9a76fc78 100644 --- a/src/test/java/com/easybusticket/tests/PageSearchInAdminDashboard_US33.java +++ b/src/test/java/com/easybusticket/tests/PageSearchInAdminDashboard_US33.java @@ -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() { diff --git a/src/test/java/com/easybusticket/tests/ProfileSettingsUpdate_US_17.java b/src/test/java/com/easybusticket/tests/ProfileSettingsUpdate_US_17.java new file mode 100644 index 00000000..48e0a301 --- /dev/null +++ b/src/test/java/com/easybusticket/tests/ProfileSettingsUpdate_US_17.java @@ -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(); + + } +} \ No newline at end of file