package PageComponents;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.How;
import org.openqa.selenium.support.PageFactory;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

public class HomePagePF {
    WebDriver driver;
    WebDriverWait wdw;

    @FindBy(how = How.PARTIAL_LINK_TEXT, using = "Sign In / Up")
    WebElement expandLoginOptionsButton;

    public HomePagePF(WebDriver driver) {
        this.driver = driver;
        this.wdw = new WebDriverWait(this.driver, 1);
        PageFactory.initElements(driver, this);
    }

    public void visitSafewayHomepage() {
        driver.get("https://www.safeway.com/");
    }

    public void revealRightSidebar() {
        wdw.until(ExpectedConditions.elementToBeClickable(expandLoginOptionsButton));
        expandLoginOptionsButton.click();
    }

}

