Commit 0cbbb44c authored by Shaphen Pangburn's avatar Shaphen Pangburn

Add SetWebDriver class with basic logic to assign we driver data

parent f95b394a
......@@ -34,6 +34,7 @@ public class PropertyValues {
} catch (Exception e) {
System.out.println("Exception: " + e);
} finally {
assert inputStream != null;
inputStream.close();
}
......
package com.nisum.pompagefactory.practice;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class SetWebDriver {
WebDriver driver;
public SetWebDriver(String type) {
switch (type){
case "chrome":
System.setProperty("webdriver.chrome.driver", "/Users/spangburn/drivers/chromedriver");
case "firefox":
// code
case "Safari":
// code
default:
System.out.println("Could not find WebDriver");
}
this.driver = new ChromeDriver();
}
}
......@@ -12,7 +12,7 @@ import java.util.concurrent.TimeUnit;
public class AccountSettingsPage {
WebDriver driver;
@FindBy(xpath = "//*[@id=\"input-firstName\"]")
@FindBy(xpath = "//*[@id='input-firstName']")
public WebElement accountFirstName;
@FindBy(xpath = "//*[@id=\"input-lastName\"]")
public WebElement accountLastName;
......
......@@ -27,23 +27,24 @@ public class TestConfirmAccountDetails {
String lastName = props.get(1);
String phoneNumber = props.get(4);
// SetWebDriver driver = new SetWebDriver("chrome");
System.setProperty("webdriver.chrome.driver", "/Users/spangburn/drivers/chromedriver");
WebDriver driver = new ChromeDriver();
WebDriverWait wait = new WebDriverWait(driver, 5);
// Home
// Home Navigation to Login
HomePage home = new HomePage(driver, "https://www.safeway.com/", true);
home.navigateToLogin();
// Login
// Login Action Call
LoginPage loginPage = new LoginPage(driver, "https://www.safeway.com/", false);
loginPage.loginUser(email, password);
// Navigate to account settings
// Navigation to Account Settings
AccountSettingsPage accountSettingsPage = new AccountSettingsPage(driver);
accountSettingsPage.goToAccountSettings();
// Assert Information is correct
// Assert Information Matches Application Properties
wait.until(ExpectedConditions.elementToBeClickable(accountSettingsPage.accountFirstName));
Assertions.assertEquals(firstName, accountSettingsPage.accountFirstName.getAttribute("value"));
Assertions.assertEquals(lastName, accountSettingsPage.accountLastName.getAttribute("value"));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment