Commit ce74d36f authored by Darrick Yong's avatar Darrick Yong

clean up code

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