
pages.nopcommerce.homepage.HomePage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of AUTOTESTIMATIC-JAVA Show documentation
Show all versions of AUTOTESTIMATIC-JAVA Show documentation
An open-source Selenium Java-based Test automation Framework that allows you to perform multiple actions
to test a web application's functionality, behaviour, which provides easy to use syntax,
and easy to set up environment according to the needed requirements for testing
package pages.nopcommerce.homepage;
import driverfactory.webdriver.WebDriver;
import io.qameta.allure.Step;
import org.openqa.selenium.By;
import pages.nopcommerce.ContactUsPage;
import pages.nopcommerce.LoginPage;
import pages.nopcommerce.MyAccountPage;
import pages.nopcommerce.registrationpage.UserRegistrationPage;
public class HomePage{
private final WebDriver driver;
By registerLink = By.linkText("Register");
By loginLink = By.linkText("Log in");
By contactUsLink = By.linkText("Contact us");
By currencyDropDownList = By.id("customerCurrency");
By computersMenu = By.linkText("Computers");
By notebooksMenu = By.linkText("Notebooks");
By myAccountLink = By.linkText("My account");
public HomePage(WebDriver driver) {
this.driver = driver;
}
@Step("HomePage should be loaded successfully")
public HomePage checkThatHomePageIsLoadedSuccessfully(){
driver.assertThat().element(loginLink).isDisplayed();
return this;
}
@Step("Given user clicks on Registration page link")
public UserRegistrationPage openRegistrationPage()
{
driver.element().click(registerLink);
return new UserRegistrationPage(driver);
}
@Step("When user clicks on Login Link")
public LoginPage openLoginPage()
{
driver.element().click(loginLink);
return new LoginPage(driver);
}
@Step("Given user opened Contact us link")
public ContactUsPage openContactUsPage()
{
driver.browser().scrollToBottom();
driver.element().click(contactUsLink);
return new ContactUsPage(driver);
}
@Step("When user clicks on My Account link")
public MyAccountPage openMyAccountPage()
{
driver.element().click(myAccountLink);
return new MyAccountPage(driver);
}
public void changeCurrency(int index)
{
driver.element().selectItemByIndex(currencyDropDownList, index);
}
public void selectNotebookMenu()
{
driver.element().hoverOnItem(computersMenu).hoverOnItem(notebooksMenu);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy