Commit 1ef3cc75 authored by Kevin Kaminski's avatar Kevin Kaminski

Add finished project

parents
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="SeleniumObjectFactory" />
</profile>
</annotationProcessing>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_15" project-jdk-name="openjdk-16" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4" />
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>SeleniumObjectFactory</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
import com.nisum.test.pages.AccountSettings;
import com.nisum.test.pages.Home;
import com.nisum.test.pages.Login;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class SeleniumApp {
public static void main(String[] args) {}
}
package com.nisum.test.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.concurrent.TimeUnit;
public class AccountSettings {
WebDriver driver;
public AccountSettings(WebDriver driver) {
this.driver = driver;
}
public WebElement getMenuBtn() {
return driver.findElement(By
.xpath("/html/body/div[1]/div/div/div[1]/div/div/div/div[3]/div[2]/div[1]/div/div/div[3]/ul/li[1]/a"));
}
public WebElement getAccountSettingsBtn() {
return driver.findElement(By
.xpath("/html/body/div[1]/div/div/div[1]/div/div/div/div[3]/div[2]/div[1]/div/div/div[3]/ul/div/div[2]/div[1]/ul/li[4]/a"));
}
public WebElement getAccountFirstName() {
return driver.findElement(By
.xpath("/html/body/div[1]/div[2]/main/div/div/div[2]/div/div[1]/div[1]/div/input"));
}
public WebElement getAccountLastName() {
return driver.findElement(By
.xpath("/html/body/div[1]/div[2]/main/div/div/div[2]/div/div[1]/div[2]/div/input"));
}
public WebElement getAccountPhoneNumber() {
return driver.findElement(By
.xpath("/html/body/div[1]/div[2]/main/div/div/div[2]/div/div[5]/div/div[1]/input"));
}
public void navigateAccountSettings() {
WebElement menu;
try {
getMenuBtn().click();
}
catch(org.openqa.selenium.StaleElementReferenceException ex)
{
getMenuBtn().click();
}
getAccountSettingsBtn().click();
}
}
package com.nisum.test.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import java.util.concurrent.TimeUnit;
public class Home {
WebDriver driver;
public Home(WebDriver driver) {
this.driver = driver;
}
public WebElement getLnkSignIn() {
return driver.findElement(By
.xpath("/html/body/div[1]/div/div/div[1]/div/div/div/div[3]/div[2]/div[1]/div/div/div[3]/ul/li[1]/a"));
}
public WebElement getSignInBtn() {
return driver.findElement(By
.xpath("/html/body/div[1]/div/div/div[1]/div/div/div/div[3]/div[2]/div[1]/div/div/div[3]/ul/div/div[2]/div[1]/div[1]/div[1]/a"));
}
public void navigateSignIn() {
getLnkSignIn().click();
getSignInBtn().click();
}
public void navigateHome(String url) {
driver.get(url);
}
}
package com.nisum.test.pages;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
public class Login {
WebDriver driver;
public Login(WebDriver driver) {
this.driver = driver;
}
public WebElement getInpUserName() {
return driver.findElement(By
.xpath("/html/body/div[1]/div/div/div[3]/div/div/div/div[1]/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/form/div[1]/input"));
}
public WebElement getInpPassword() {
return driver.findElement(By
.xpath("/html/body/div[1]/div/div/div[3]/div/div/div/div[1]/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/form/div[2]/div/input"));
}
public WebElement getBtnSubmit() {
return driver.findElement(By
.xpath("/html/body/div[1]/div/div/div[3]/div/div/div/div[1]/div[2]/div[2]/div/div/div/div/div[2]/div/div/div[2]/form/div[5]/div[1]/input"));
}
public void navigateHome(String url) {
driver.get(url);
}
public void login(String username, String password) {
getInpUserName().sendKeys(username);
getInpPassword().sendKeys(password);
getBtnSubmit().click();
}
}
package com.nisum.test.pages;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.*;
public class LoginPF {
WebDriver driver;
@FindBy(how = How.XPATH, using = "//[text()=com.nisum.pages.Login']")
WebElement lnkSignIn;
@FindBy(xpath="//input[@name='username']")
WebElement inpUserName;
@FindAll({
@FindBy(id="pass"),
@FindBy(name="pwd"),
@FindBy(xpath="//input[@name='pwd']")
})
WebElement inpPassword;
@FindBys({
@FindBy(id="Submit"),
@FindBy(name="Login")
})
WebElement btnSubmit;
public LoginPF(WebDriver driver) {
this.driver = driver;
PageFactory.initElements(this.driver, this);
}
public void login(String username, String password) {
inpUserName.sendKeys(username);
inpPassword.sendKeys(password);
btnSubmit.click();
}
}
homeUrl = "https://www.safeway.com";
username = "vkrijegccvsknuvnpv@miucce.com";
password = "12345678";
firstName = "Nisum";
lastName = "TestAcct";
phoneNumber = "3141592635";
\ No newline at end of file
package com.nisum.test;
import com.nisum.test.pages.AccountSettings;
import com.nisum.test.pages.Home;
import com.nisum.test.pages.Login;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
public class AccountSettingsTest {
@Test
public void testUserInfo() {
final String homeUrl = "https://www.safeway.com";
final String username = "vkrijegccvsknuvnpv@miucce.com";
final String password = "12345678";
final String firstName = "Nisum";
final String lastName = "TestAcct";
final String phoneNumber = "3141592635";
WebDriver driver = new ChromeDriver();
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
Home home = new Home(driver);
Login login = new Login(driver);
AccountSettings accountSettings = new AccountSettings(driver);
home.navigateHome(homeUrl);
home.navigateSignIn();
login.login(username, password);
accountSettings.navigateAccountSettings();
String accountFirstName = driver.findElement(By
.xpath("//*[@id='input-firstName']")).getAttribute("value");
String accountLastName = driver.findElement(By
.xpath("//*[@id='input-lastName']")).getAttribute("value");
String accountPhoneNumber = driver.findElement(By
.xpath("//*[@id='phoneNumber']")).getAttribute("value");
Assert.assertEquals(firstName, accountSettings.getAccountFirstName().getAttribute("value"));
Assert.assertEquals(lastName, accountSettings.getAccountLastName().getAttribute("value"));
Assert.assertEquals(phoneNumber, accountSettings.getAccountPhoneNumber().getAttribute("value"));
driver.quit();
}
}
homeUrl = "https://www.safeway.com";
username = "vkrijegccvsknuvnpv@miucce.com";
password = "12345678";
firstName = "Nisum";
lastName = "TestAcct";
phoneNumber = "3141592635";
\ No newline at end of file
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