Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
page-object-model-exercise
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Philippe Fonzin
page-object-model-exercise
Commits
c93eae4d
Commit
c93eae4d
authored
Apr 14, 2021
by
Philippe Fonzin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
login user
parent
133dcbc2
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
296 additions
and
0 deletions
+296
-0
uiDesigner.xml
.idea/uiDesigner.xml
+124
-0
vcs.xml
.idea/vcs.xml
+6
-0
pom.xml
pom.xml
+38
-0
application.properties
src/main/resources/application.properties
+3
-0
AccountSettings.java
src/test/java/com/test/AccountSettings.java
+27
-0
Home.java
src/test/java/com/test/Home.java
+17
-0
Login.java
src/test/java/com/test/Login.java
+50
-0
SafewayTest.java
src/test/java/com/test/SafewayTest.java
+28
-0
application.properties
target/classes/application.properties
+3
-0
AccountSettings.class
target/test-classes/com/test/AccountSettings.class
+0
-0
Home.class
target/test-classes/com/test/Home.class
+0
-0
Login.class
target/test-classes/com/test/Login.class
+0
-0
SafewayTest.class
target/test-classes/com/test/SafewayTest.class
+0
-0
No files found.
.idea/uiDesigner.xml
0 → 100644
View file @
c93eae4d
<?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
.idea/vcs.xml
0 → 100644
View file @
c93eae4d
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"VcsDirectoryMappings"
>
<mapping
directory=
"$PROJECT_DIR$"
vcs=
"Git"
/>
</component>
</project>
\ No newline at end of file
pom.xml
View file @
c93eae4d
...
...
@@ -13,4 +13,42 @@
<maven.compiler.target>
8
</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>
org.seleniumhq.selenium
</groupId>
<artifactId>
selenium-java
</artifactId>
<version>
3.141.59
</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
<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.junit.vintage
</groupId>
<artifactId>
junit-vintage-engine
</artifactId>
<version>
5.7.0
</version>
</dependency>
<dependency>
<groupId>
org.testng
</groupId>
<artifactId>
testng
</artifactId>
<version>
6.8
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
src/main/resources/application.properties
0 → 100644
View file @
c93eae4d
username
=
"vkrijegccvsknuvnpv@miucce.com";
password
=
"12345678";
url
=
"http://safeway.com";
src/test/java/com/test/AccountSettings.java
0 → 100644
View file @
c93eae4d
package
com
.
test
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.support.FindBy
;
import
org.openqa.selenium.support.How
;
public
class
AccountSettings
{
public
AccountSettings
(
WebDriver
driver
)
{
this
.
driver
=
driver
;
}
WebDriver
driver
;
@FindBy
(
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/span[2]"
)
WebElement
accountButton
;
@FindBy
(
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"
)
WebElement
accountSettingsButton
;
@FindBy
(
xpath
=
"/html/body/div[1]/div[2]/main/div/div/div[2]/div/div[1]/div[1]/div/input"
)
WebElement
firstName
;
@FindBy
(
xpath
=
"/html/body/div[1]/div[2]/main/div/div/div[2]/div/div[1]/div[2]/div/input"
)
WebElement
lastName
;
}
src/test/java/com/test/Home.java
0 → 100644
View file @
c93eae4d
package
com
.
test
;
import
org.openqa.selenium.WebDriver
;
public
class
Home
{
WebDriver
driver
;
public
Home
(
WebDriver
driver
)
{
this
.
driver
=
driver
;
}
public
void
goHome
(
String
url
)
throws
Exception
{
driver
.
get
(
url
);
}
}
src/test/java/com/test/Login.java
0 → 100644
View file @
c93eae4d
package
com
.
test
;
import
org.openqa.selenium.By
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
java.util.concurrent.TimeUnit
;
public
class
Login
{
WebDriver
driver
;
WebElement
linkSignIn
;
WebElement
homeHeaderSignIn
;
WebElement
inputUsername
;
WebElement
inputPassword
;
WebElement
buttonSubmit
;
public
Login
(
WebDriver
driver
)
{
this
.
driver
=
driver
;
}
public
WebElement
getHomeHeaderSignIn
()
{
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/span[1]"
));
}
public
WebElement
getLinkSignIn
()
{
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
WebElement
getInputUsername
()
{
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
getInputPassword
()
{
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
getButtonSubmit
()
{
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
login
(
String
username
,
String
password
)
{
getHomeHeaderSignIn
().
click
();
getLinkSignIn
().
click
();
driver
.
manage
().
timeouts
().
implicitlyWait
(
5
,
TimeUnit
.
SECONDS
);
getInputUsername
().
sendKeys
(
username
);
getInputPassword
().
sendKeys
(
password
);
getButtonSubmit
().
click
();
}
}
src/test/java/com/test/SafewayTest.java
0 → 100644
View file @
c93eae4d
package
com
.
test
;
import
org.junit.jupiter.api.Test
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.chrome.ChromeDriver
;
import
java.util.concurrent.TimeUnit
;
public
class
SafewayTest
{
private
String
username
=
"vkrijegccvsknuvnpv@miucce.com"
;
private
String
password
=
"12345678"
;
@Test
public
void
login
()
throws
Exception
{
System
.
setProperty
(
"webdriver.chrome.driver"
,
"/Users/philippefonzin/Downloads/chromedriver"
);
WebDriver
driver
=
new
ChromeDriver
();
Home
home
=
new
Home
(
driver
);
Login
login
=
new
Login
(
driver
);
// Navigate to home page
home
.
goHome
(
"http://safeway.com"
);
driver
.
manage
().
timeouts
().
implicitlyWait
(
2
,
TimeUnit
.
SECONDS
);
// Login to account
login
.
login
(
username
,
password
);
}
}
target/classes/application.properties
0 → 100644
View file @
c93eae4d
username
=
"vkrijegccvsknuvnpv@miucce.com";
password
=
"12345678";
url
=
"http://safeway.com";
target/test-classes/com/test/AccountSettings.class
0 → 100644
View file @
c93eae4d
File added
target/test-classes/com/test/Home.class
0 → 100644
View file @
c93eae4d
File added
target/test-classes/com/test/Login.class
0 → 100644
View file @
c93eae4d
File added
target/test-classes/com/test/SafewayTest.class
0 → 100644
View file @
c93eae4d
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment