Commit ce74d36f authored by Darrick Yong's avatar Darrick Yong

clean up code

parent 7f187fca
...@@ -14,7 +14,6 @@ public class LoginPage { ...@@ -14,7 +14,6 @@ public class LoginPage {
this.driver = driver; this.driver = driver;
} }
public WebElement getNameInput() { public WebElement getNameInput() {
return driver.findElement(By.xpath("//input[@name='userId']")); return driver.findElement(By.xpath("//input[@name='userId']"));
} }
...@@ -31,10 +30,6 @@ public class LoginPage { ...@@ -31,10 +30,6 @@ public class LoginPage {
return new WebDriverWait(this.driver, 5 ); return new WebDriverWait(this.driver, 5 );
} }
// public void navigate(String url) {
// this.driver.get(url);
// }
public void login(String username, String password) { public void login(String username, String password) {
getWaiter().until(ExpectedConditions.visibilityOfElementLocated(By.id("btnSignIn"))); getWaiter().until(ExpectedConditions.visibilityOfElementLocated(By.id("btnSignIn")));
...@@ -42,5 +37,6 @@ public class LoginPage { ...@@ -42,5 +37,6 @@ public class LoginPage {
getNameInput().sendKeys(username); getNameInput().sendKeys(username);
getPassInput().sendKeys(password); getPassInput().sendKeys(password);
getSubmitBtn().click(); getSubmitBtn().click();
} }
} }
...@@ -23,4 +23,8 @@ public class RightNavBar { ...@@ -23,4 +23,8 @@ public class RightNavBar {
signInLink.click(); signInLink.click();
} }
public void openAccountSettings() {
accountSettingsLink.click();
}
} }
package helpers;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
......
import helpers.GetAccountProperties;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait; import org.openqa.selenium.support.ui.WebDriverWait;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
public class TestSafeway { public class TestSafeway {
Map<String, String> props = new GetAccountProperties().getProps(); Map<String, String> props = new GetAccountProperties().getProps();
...@@ -20,7 +19,6 @@ public class TestSafeway { ...@@ -20,7 +19,6 @@ public class TestSafeway {
public TestSafeway() throws IOException { public TestSafeway() throws IOException {
} }
private static String getOS() { private static String getOS() {
return System.getProperty("os.name"); return System.getProperty("os.name");
} }
...@@ -28,7 +26,6 @@ public class TestSafeway { ...@@ -28,7 +26,6 @@ public class TestSafeway {
@Test @Test
public void testSafewayLogin() { public void testSafewayLogin() {
if (getOS().startsWith("Mac OS")) { if (getOS().startsWith("Mac OS")) {
System.out.println("mac");
System.setProperty("webdriver.chrome.driver", "src/main/resources/chromedriver"); System.setProperty("webdriver.chrome.driver", "src/main/resources/chromedriver");
} }
...@@ -47,18 +44,12 @@ public class TestSafeway { ...@@ -47,18 +44,12 @@ public class TestSafeway {
waiter.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Account"))); waiter.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Account")));
homePage.openRightNav(); homePage.openRightNav();
rightNavBar.accountSettingsLink.click(); rightNavBar.openAccountSettings();
waiter.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Account Settings"))); waiter.until(ExpectedConditions.visibilityOfElementLocated(By.linkText("Account Settings")));
AccountSettingsPage accountSettingsPage = new AccountSettingsPage(driver); AccountSettingsPage accountSettingsPage = new AccountSettingsPage(driver);
accountSettingsPage.confirmLogin(firstName, lastName, email); accountSettingsPage.confirmLogin(firstName, lastName, email);
} }
} }
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