-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f56e72c
Showing
63 changed files
with
6,890 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="optional" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="test" value="true"/> | ||
<attribute name="optional" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" path="Resources"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>AutomationTestingOrangeHrm</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/main/java=UTF-8 | ||
encoding//src/test/java=UTF-8 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore | ||
org.eclipse.jdt.core.compiler.release=disabled | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
username=Admin | ||
password=admin123 | ||
url=https://opensource-demo.orangehrmlive.com/web/index.php/auth/login | ||
browser=edge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<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>AutomationTestingOrangeHrm</groupId> | ||
<artifactId>AutomationTestingOrangeHrm</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
|
||
<name>AutomationTestingOrangeHrm</name> | ||
<url>http://maven.apache.org</url> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.seleniumhq.selenium</groupId> | ||
<artifactId>selenium-java</artifactId> | ||
<version>4.25.0</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.github.bonigarcia</groupId> | ||
<artifactId>webdrivermanager</artifactId> | ||
<version>5.9.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testng</groupId> | ||
<artifactId>testng</artifactId> | ||
<version>7.10.2</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.poi</groupId> | ||
<artifactId>poi</artifactId> | ||
<version>4.1.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.poi</groupId> | ||
<artifactId>poi-ooxml</artifactId> | ||
<version>4.1.2</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.aventstack</groupId> | ||
<artifactId>extentreports</artifactId> | ||
<version>4.0.9</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.6</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>1.2.17</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>1.2.3</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.logging.log4j</groupId> | ||
<artifactId>log4j-core</artifactId> | ||
<version>2.17.1</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>1.2.3</version> <!-- or the latest version --> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.7.32</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>1.2.6</version> | ||
</dependency> | ||
|
||
|
||
|
||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.org.base; | ||
|
||
import com.org.pages.LoginPage; | ||
import com.org.pages.HomePage; | ||
import com.org.pages.AdminPage; | ||
import com.org.util.ConfigReader; | ||
import io.github.bonigarcia.wdm.WebDriverManager; | ||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.chrome.ChromeDriver; | ||
import org.openqa.selenium.edge.EdgeDriver; | ||
import org.testng.annotations.AfterClass; | ||
import org.testng.annotations.BeforeClass; | ||
|
||
public class Base { | ||
protected WebDriver driver; | ||
protected ConfigReader configReader; | ||
protected LoginPage loginPage; | ||
protected HomePage homePage; | ||
protected AdminPage adminPage; | ||
|
||
@BeforeClass | ||
public void setUp() { | ||
configReader = new ConfigReader(); | ||
String browser = configReader.getBrowser(); | ||
|
||
if (browser.equalsIgnoreCase("chrome")) { | ||
WebDriverManager.chromedriver().setup(); | ||
driver = new ChromeDriver(); | ||
} else if (browser.equalsIgnoreCase("edge")) { | ||
WebDriverManager.edgedriver().setup(); | ||
driver = new EdgeDriver(); | ||
} | ||
|
||
driver.manage().window().maximize(); | ||
driver.get(configReader.getUrl()); | ||
|
||
loginPage = new LoginPage(driver); | ||
homePage = new HomePage(driver); | ||
adminPage = new AdminPage(driver); | ||
} | ||
|
||
public void login() { | ||
loginPage.enterUsername(configReader.getUsername()); | ||
loginPage.enterPassword(configReader.getPassword()); | ||
loginPage.clickLogin(); | ||
} | ||
|
||
@AfterClass | ||
public void tearDown() { | ||
if (driver != null) { | ||
driver.quit(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.org.pages; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
import java.time.Duration; | ||
|
||
public class AdminPage { | ||
private WebDriver driver; | ||
private WebDriverWait wait; | ||
|
||
@FindBy(xpath = "//h6[@class='oxd-text oxd-text--h6 oxd-topbar-header-breadcrumb-module']") | ||
private WebElement adminHeader; | ||
|
||
@FindBy(xpath = "//li[@class='oxd-topbar-body-nav-tab --parent --visited']//span[@class='oxd-topbar-body-nav-tab-item']") | ||
private WebElement userManagementHeader; | ||
|
||
@FindBy(xpath = "//label[ .='User Role']") | ||
private WebElement rolesHeader; | ||
|
||
@FindBy(xpath = "//i[@class='oxd-icon bi-plus oxd-button-icon']") | ||
private WebElement addUserButton; | ||
|
||
@FindBy(xpath = "//button[@class='oxd-icon-button oxd-table-cell-action-space']") | ||
private WebElement deleteUserButton; | ||
|
||
public AdminPage(WebDriver driver) { | ||
this.driver = driver; | ||
this.wait = new WebDriverWait(driver, Duration.ofSeconds(10)); | ||
PageFactory.initElements(driver, this); | ||
} | ||
|
||
public boolean isAdminHeaderDisplayed() { | ||
return wait.until(ExpectedConditions.visibilityOf(adminHeader)).isDisplayed(); | ||
} | ||
|
||
public boolean isUserManagementHeaderDisplayed() { | ||
return wait.until(ExpectedConditions.visibilityOf(userManagementHeader)).isDisplayed(); | ||
} | ||
|
||
public boolean isRolesHeaderDisplayed() { | ||
return wait.until(ExpectedConditions.visibilityOf(rolesHeader)).isDisplayed(); | ||
} | ||
|
||
public void clickAddUser() { | ||
wait.until(ExpectedConditions.elementToBeClickable(addUserButton)).click(); | ||
} | ||
|
||
public void clickDeleteUser() { | ||
wait.until(ExpectedConditions.elementToBeClickable(deleteUserButton)).click(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.org.pages; | ||
|
||
import org.openqa.selenium.WebDriver; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
import org.openqa.selenium.support.PageFactory; | ||
import org.openqa.selenium.support.ui.ExpectedConditions; | ||
import org.openqa.selenium.support.ui.WebDriverWait; | ||
|
||
import java.time.Duration; | ||
|
||
public class HomePage { | ||
private WebDriver driver; | ||
private WebDriverWait wait; | ||
|
||
@FindBy(xpath = "//h6[contains(text(), 'Welcome')]") | ||
private WebElement welcomeMessage; | ||
|
||
@FindBy(xpath = "//a[contains(@href, '/admin')]") | ||
private WebElement adminMenu; | ||
|
||
public HomePage(WebDriver driver) { | ||
this.driver = driver; | ||
this.wait = new WebDriverWait(driver, Duration.ofSeconds(10)); | ||
PageFactory.initElements(driver, this); | ||
} | ||
|
||
public boolean isWelcomeMessageDisplayed() { | ||
return wait.until(ExpectedConditions.visibilityOf(welcomeMessage)).isDisplayed(); | ||
} | ||
|
||
public void clickAdminMenu() { | ||
wait.until(ExpectedConditions.elementToBeClickable(adminMenu)).click(); | ||
} | ||
|
||
public String getWelcomeMessageText() { | ||
return welcomeMessage.getText(); | ||
} | ||
|
||
public boolean isAdminMenuEnabled() { | ||
return wait.until(ExpectedConditions.elementToBeClickable(adminMenu)).isEnabled(); | ||
} | ||
} |
Oops, something went wrong.