Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
POM_page_factory_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
Shaphen Pangburn
POM_page_factory_exercise
Commits
0cbbb44c
Commit
0cbbb44c
authored
Apr 13, 2021
by
Shaphen Pangburn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add SetWebDriver class with basic logic to assign we driver data
parent
f95b394a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
5 deletions
+31
-5
PropertyValues.java
...ava/com/nisum/pompagefactory/practice/PropertyValues.java
+1
-0
SetWebDriver.java
.../java/com/nisum/pompagefactory/practice/SetWebDriver.java
+24
-0
AccountSettingsPage.java
...um/pompagefactory/practice/pages/AccountSettingsPage.java
+1
-1
TestConfirmAccountDetails.java
...pagefactory/practice/tests/TestConfirmAccountDetails.java
+5
-4
No files found.
src/main/java/com/nisum/pompagefactory/practice/PropertyValues.java
View file @
0cbbb44c
...
...
@@ -34,6 +34,7 @@ public class PropertyValues {
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"Exception: "
+
e
);
}
finally
{
assert
inputStream
!=
null
;
inputStream
.
close
();
}
...
...
src/main/java/com/nisum/pompagefactory/practice/SetWebDriver.java
0 → 100644
View file @
0cbbb44c
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
();
}
}
src/main/java/com/nisum/pompagefactory/practice/pages/AccountSettingsPage.java
View file @
0cbbb44c
...
...
@@ -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
;
...
...
src/test/java/com/nisum/pompagefactory/practice/tests/TestConfirmAccountDetails.java
View file @
0cbbb44c
...
...
@@ -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
);
// Navigat
e to account s
ettings
// Navigat
ion to Account S
ettings
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"
));
...
...
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