-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Latif Hajiry
committed
Sep 4, 2024
1 parent
704b1ad
commit 8af36a2
Showing
9 changed files
with
135 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/test/java/moneylion/steps_definition/CareerPageSteps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,44 @@ | ||
package moneylion.steps_definition; | ||
|
||
import io.cucumber.java.en.And; | ||
import io.cucumber.java.en.Then; | ||
import moneylion.pages.BasePage; | ||
import moneylion.pages.CareerPage; | ||
import moneylion.pages.HomePage; | ||
import moneylion.utils.ConfigManager; | ||
import moneylion.utils.PageObjectManager; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.openqa.selenium.By; | ||
|
||
public class CareerPageSteps extends BasePage { | ||
private PageObjectManager pageObjectManager; | ||
private CareerPage careerPage; | ||
|
||
public CareerPageSteps() { | ||
pageObjectManager = new PageObjectManager(); | ||
careerPage = pageObjectManager.careerPage(); | ||
} | ||
|
||
@Then("I should redirected to MoneyLion's careers page") | ||
public void iShouldRedirectedToCareerPage() { | ||
careerPage.verifyCareerPageUrl(); | ||
} | ||
|
||
@And("^I should be able to see '([^\']*)' displayed next to '([^\']*)'$") | ||
public void iShouldBeAbleToSeeElementDisplayedNextToElement(String element1, String element2) throws NoSuchFieldException, IllegalAccessException { | ||
By firstElement = getLocatorByName(element1, careerPage); | ||
By secondElement = getLocatorByName(element2, careerPage); | ||
|
||
Assertions.assertTrue(careerPage.careerPageElementDisplayed(firstElement), element1 + "i s not displayed"); ; | ||
Assertions.assertTrue(careerPage.careerPageElementDisplayed(secondElement), element2 + "i s not displayed"); ; | ||
} | ||
|
||
@And("^I should be able to see '([^\']*)' displayed next to '([^\']*)' according to coordinate$") | ||
public void iShouldBeAbleToSeeElementDisplayedNextToElementUsingCoordinate(String element1, String element2) throws NoSuchFieldException, IllegalAccessException { | ||
By firstElement = getLocatorByName(element1, careerPage); | ||
By secondElement = getLocatorByName(element2, careerPage); | ||
|
||
boolean isSibling = careerPage.isNextToElement(firstElement, secondElement); | ||
Assertions.assertTrue(isSibling, element1 + "is not a sibling of element" + element2); | ||
} | ||
} |
40 changes: 24 additions & 16 deletions
40
src/test/java/moneylion/steps_definition/HomePageSteps.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
package moneylion.steps_definition; | ||
|
||
import io.cucumber.java.en.And; | ||
import io.cucumber.java.en.Given; | ||
import io.cucumber.java.en.When; | ||
import moneylion.pages.BasePage; | ||
import moneylion.pages.CareerPage; | ||
import moneylion.pages.HomePage; | ||
import moneylion.utils.ConfigManager; | ||
import moneylion.utils.PageObjectManager; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.openqa.selenium.WebElement; | ||
|
||
import static java.lang.Thread.sleep; | ||
|
||
public class HomePageSteps extends BasePage { | ||
private HomePage homePage = new HomePage(); | ||
private CareerPage careerPage = new CareerPage(); | ||
@Given("I visit url") | ||
public void iVisitUrl() { | ||
driver.get(ConfigManager.getProperty("url")); | ||
} | ||
private PageObjectManager pageObjectManager; | ||
private HomePage homePage; | ||
|
||
@When("I click a button") | ||
public void iClickAButton() throws InterruptedException { | ||
homePage.waitAndClickCareerPage(); | ||
// Thread.sleep(10000); | ||
boolean isUrlOk = careerPage.checkCareerPageUrl(); | ||
Assertions.assertTrue(isUrlOk, "the url does not match"); | ||
public HomePageSteps() { | ||
pageObjectManager = new PageObjectManager(); | ||
homePage = pageObjectManager.homePage(); | ||
} | ||
|
||
boolean viewRolesButtonDisplayed = careerPage.isOpenRolesButtonDisplayed(); | ||
Assertions.assertTrue(viewRolesButtonDisplayed, "view open roles button is not displayed"); | ||
@Given("I am a new customer") | ||
public void iAmANewCustomer() { | ||
System.out.println("I am a new customer executed"); | ||
} | ||
@And("I access the MoneyLion website") | ||
public void iAccessWebsite() { | ||
driver.get(ConfigManager.getProperty("url")); | ||
} | ||
|
||
boolean isNextToElement = careerPage.isNextToElement(); | ||
Assertions.assertTrue(isNextToElement, "The coordinate of elementA is not within elementB"); | ||
@When("^I hover on '([^\']*)' and click on '([^\']*)' at the bottom of the webpage$") | ||
public void iHoverAndClickOnButtonAtTheBottomOfTheWebPage(String element1, String element2) { | ||
WebElement elementToHover = homePage.findHomePageElementWithText(element1, 10); | ||
homePage.hoverToHomePageElement(elementToHover); | ||
|
||
WebElement elementToClick = homePage.findHomePageElementWithText(element2,10); | ||
// homePage.hoverToHomePageElement(elementToClick); | ||
homePage.clickHomePageElement(elementToClick); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
package moneylion.utils; | ||
|
||
import moneylion.pages.CareerPage; | ||
import moneylion.pages.HomePage; | ||
|
||
public class PageObjectManager { | ||
|
||
public HomePage homePage() {return new HomePage();} | ||
public CareerPage careerPage() {return new CareerPage();} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
Feature:Test | ||
Feature: Moneylion Test | ||
|
||
@test | ||
Scenario: Test Feature | ||
Given I visit url | ||
When I click a button | ||
|
||
@test2 | ||
Scenario: Test Feature2 | ||
Given I visit url | ||
When I click a button | ||
Scenario: Verify when accessing career page | ||
Given I am a new customer | ||
When I access the MoneyLion website | ||
And I hover on 'About us' and click on 'Careers' at the bottom of the webpage | ||
Then I should redirected to MoneyLion's careers page | ||
And I should be able to see 'whereWeWorkSiblingElement' displayed next to 'cityGridContainerSiblingElement' | ||
And I should be able to see 'whereWeWorkText' displayed next to 'cityGridContainer' according to coordinate |