Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SeleniumTraining
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
Qazi Zain
SeleniumTraining
Commits
c369b476
Commit
c369b476
authored
Nov 22, 2024
by
Qazi Zain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nisum Web Automate Task of Cucumber BDD is uploaded
parent
0f45dd3f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
0 deletions
+147
-0
Nisum.feature
src/main/java/NisumWebTest/Cucumber/Nisum.feature
+12
-0
TestRunner.java
src/main/java/NisumWebTest/Cucumber/TestRunner.java
+11
-0
NisumPage.java
src/main/java/NisumWebTest/PageObject/NisumPage.java
+59
-0
StepDefination.java
...main/java/NisumWebTest/StepDefination/StepDefination.java
+30
-0
BaseTest.java
src/main/java/NisumWebTest/Utils/BaseTest.java
+33
-0
Login.feature
src/main/java/POM_Structure_code/Cucumber/Login.feature
+2
-0
No files found.
src/main/java/NisumWebTest/Cucumber/Nisum.feature
0 → 100644
View file @
c369b476
@Navigate
Feature
:
Navigate Functionality
@PositiveScenario
Scenario Outline
:
Validate the links navigate to the correct page
Given
User is Present on nisum Website
When
User click on Global Career and then click on pakistan
Then
User Should see
"<expectedText>"
on Page
Examples
:
|
expectedText
|
|
We're
Hiring
Now!
|
src/main/java/NisumWebTest/Cucumber/TestRunner.java
0 → 100644
View file @
c369b476
package
NisumWebTest
.
Cucumber
;
import
io.cucumber.testng.AbstractTestNGCucumberTests
;
import
io.cucumber.testng.CucumberOptions
;
@CucumberOptions
(
features
=
"src/main/java/NisumWebTest/Cucumber"
,
glue
=
"NisumWebTest.StepDefination"
,
monochrome
=
true
,
plugin
=
{
"html:target/Nisumcucumber.html"
})
public
class
TestRunner
extends
AbstractTestNGCucumberTests
{
}
src/main/java/NisumWebTest/PageObject/NisumPage.java
0 → 100644
View file @
c369b476
package
NisumWebTest
.
PageObject
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.WebElement
;
import
org.openqa.selenium.interactions.Actions
;
import
org.openqa.selenium.support.FindBy
;
import
org.openqa.selenium.support.PageFactory
;
import
org.openqa.selenium.support.ui.ExpectedCondition
;
import
org.openqa.selenium.support.ui.ExpectedConditions
;
import
org.openqa.selenium.support.ui.WebDriverWait
;
import
javax.swing.*
;
import
java.time.Duration
;
public
class
NisumPage
{
WebDriver
obj
;
WebDriverWait
wait
;
public
NisumPage
(
WebDriver
obj
)
{
this
.
obj
=
obj
;
PageFactory
.
initElements
(
obj
,
this
);
wait
=
new
WebDriverWait
(
obj
,
Duration
.
ofSeconds
(
8
));
}
@FindBy
(
xpath
=
"//div[@class='hhs-header-menu custom-menu-primary js-enabled']//*[text()='Global Careers']"
)
WebElement
CareerDropDown
;
@FindBy
(
xpath
=
"(//div[@class='hhs-header-menu custom-menu-primary js-enabled']//*[@href='https://www.nisum.com/careers/careers-pakistan'])[1]"
)
WebElement
PakistanCareer
;
@FindBy
(
xpath
=
"//div[@class='hhs-rich-text wow fadeIn']//h1"
)
WebElement
HiringHeading
;
//---------------------------------------> Action Flow.
public
void
RunFlow
()
{
Actions
mouse
=
new
Actions
(
obj
);
mouse
.
moveToElement
(
CareerDropDown
).
build
().
perform
();
PakistanCareer
.
click
();
}
public
String
PassText
()
{
wait
.
until
(
ExpectedConditions
.
visibilityOf
(
HiringHeading
));
return
HiringHeading
.
getText
();
}
}
src/main/java/NisumWebTest/StepDefination/StepDefination.java
0 → 100644
View file @
c369b476
package
NisumWebTest
.
StepDefination
;
import
NisumWebTest.PageObject.NisumPage
;
import
NisumWebTest.Utils.BaseTest
;
import
io.cucumber.java.en.Given
;
import
io.cucumber.java.en.When
;
import
io.cucumber.java.en.Then
;
import
org.testng.Assert
;
public
class
StepDefination
extends
BaseTest
{
NisumPage
object
;
@Given
(
"User is Present on nisum Website"
)
public
void
user_is_present_on_nisum_website
()
{
setUp
();
// Setup WebDriver and navigate to the site
object
=
new
NisumPage
(
driver
);
// Initialize the page object after WebDriver is set up
}
@When
(
"User click on Global Career and then click on pakistan"
)
public
void
user_click_on_global_career_and_then_click_on_pakistan
()
{
object
.
RunFlow
();
// Perform actions on the page object
}
@Then
(
"User Should see {string} on Page"
)
public
void
user_should_see_we_re_hiring_now_on_page
(
String
expectedText
)
{
Assert
.
assertEquals
(
object
.
PassText
(),
expectedText
);
// Validate the text on the page
}
}
src/main/java/NisumWebTest/Utils/BaseTest.java
0 → 100644
View file @
c369b476
package
NisumWebTest
.
Utils
;
import
org.openqa.selenium.WebDriver
;
import
org.openqa.selenium.firefox.FirefoxDriver
;
import
org.openqa.selenium.support.ui.WebDriverWait
;
import
org.testng.annotations.AfterMethod
;
import
org.testng.annotations.BeforeMethod
;
import
java.time.Duration
;
public
class
BaseTest
{
public
WebDriver
driver
;
@BeforeMethod
public
void
setUp
()
{
driver
=
new
FirefoxDriver
();
driver
.
get
(
"https://www.nisum.com/"
);
}
@AfterMethod
public
void
tearDown
()
{
if
(
driver
!=
null
)
{
driver
.
quit
();
}
}
}
src/main/java/POM_Structure_code/Cucumber/Login.feature
View file @
c369b476
...
...
@@ -12,3 +12,5 @@ Feature: Validating the login Functionality
|
name
|
pass
|
|
zain
|
rahulshettyacademy
|
|
yawar
|
rahulshettyacademy
|
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