Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ yarn-error.log*

# temp office files
~$*
/.metadata/
15 changes: 15 additions & 0 deletions test/selenium/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/target/
# Ignore properties file
config.properties

# Ignore Extent Reports folder
/extent-reports/

# Ignore Logs folder
/logs/
/test-output/

# Ignore IDE specific files
**/.classpath
**/.project
**/.settings/
Empty file added test/selenium/.mvn/jvm.config
Empty file.
Empty file added test/selenium/.mvn/maven.config
Empty file.
Binary file added test/selenium/Drivers/IEDriverServer.exe
Binary file not shown.
Binary file added test/selenium/Drivers/chromedriver.exe
Binary file not shown.
47 changes: 47 additions & 0 deletions test/selenium/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Selenium Testing

Instructions on how to install and run selenium tests

Environment Setup - Eclipse IDE

`Step 1` Download JDK 21

`Step 2` Download the Eclipse IDE

`Step 3` On the Eclipse marketplace, install the TestNG for Eclipse plugin

# Selenium Test Automation Project

## 🚀 Setup Instructions

1. **Clone the repository**

git clone < repo - url >

cd < project-folder >

2. cp config.sample.properties config.properties # Mac/Linux
copy config.sample.properties config.properties # Windows

3. Open config.properties and update values for:

username / password → your login credentials

Any other settings as per your environment

4. Run Tests

From Eclipse: Right-click your TestNG runner → Run As → TestNG Suite

5. Reports & Logs

Extent Reports: /extent-reports/

Logs: /logs/

TestNG default: /test-output/

Note: config.properties, logs, extent-reports and test-output are ignored from Git.
Each developer must maintain their own local config.properties file.
Run tests from testng in order to generate reports
Delete application test will work if we have any organization linked .
16 changes: 16 additions & 0 deletions test/selenium/TestNG.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
<suite name="TestNgSuite">
<listeners>
<listener class-name="ExtentReport.TestListener"/>
</listeners>
<test name="Test1" preserve-order="true">
<classes>
<class name="ca.bc.gov.educ.ccof.selenium.TestCases.ValidLogin" />
<class name="ca.bc.gov.educ.ccof.selenium.TestCases.DeleteApplication" />
</classes>
</test>
</suite>



14 changes: 14 additions & 0 deletions test/selenium/config.sample.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#########################
# Sample Config File
# Copy this file as config.properties
# and update values as per your local setup
#########################

qa_crm_url=https://mychildcareservicestest.crm3.dynamics.com/main.aspx?appid=80ab5cd2-70bd-4542-baff-9aa920090967&pagetype=dashboard&id=dd6fd3f1-1e2d-ed11-9db0-000d3af4f2d7&type=system&_canOverride=true

uat_crm_url=https://mychildcareservicesuat.crm3.dynamics.com/main.aspx?appid=12eb8357-7190-481b-8a91-239b4bb12b2b&forceUCI=1&pagetype=entitylist&etn=account&viewid=5daf8291-112d-ed11-9db0-000d3af4f2d7&viewType=1039

crm_username=
crm_password=

browser=chrome
Empty file added test/selenium/log4j.properties
Empty file.
184 changes: 184 additions & 0 deletions test/selenium/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<?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>com.selenium</groupId>
<artifactId>selenium-automation</artifactId>
<version>0.0.1-SNAPSHOT</version>

<name>Selenium Automation Framework</name>
<url>http://www.example.com</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit</groupId>
<artifactId>junit-bom</artifactId>
<version>5.11.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<!-- Optionally: parameterized tests support -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.34.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.11.0</version>
<scope>test</scope>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.4.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.4.1</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.aventstack/extentreports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.1.2</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.13</version>
</dependency>

<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.5.2</version>
</dependency>

<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>6.1.0</version>
</dependency>

<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.28</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.9</version>
</dependency>

<!-- ExtentReports -->
<dependency>
<groupId>com.aventstack</groupId>
<artifactId>extentreports</artifactId>
<version>5.0.9</version>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
</dependency>
<dependency>

<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.20.0</version>
</dependency>



</dependencies>

<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.3.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.12.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.6.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
16 changes: 16 additions & 0 deletions test/selenium/src/main/java/ExtentReport/ExtentManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package ExtentReport;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.reporter.ExtentSparkReporter;

public class ExtentManager {
public static final ExtentReports extentReports = new ExtentReports();
public synchronized static ExtentReports createExtentReports() {
ExtentSparkReporter reporter = new ExtentSparkReporter("./extent-reports/extent-report.html");
reporter.config().setReportName("Extent Report");
extentReports.attachReporter(reporter);
extentReports.setSystemInfo("Project Name", "CCOF");
extentReports.setSystemInfo("Author", "QA");
return extentReports;
}
}
21 changes: 21 additions & 0 deletions test/selenium/src/main/java/ExtentReport/ExtentTestManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ExtentReport;

import java.util.HashMap;
import java.util.Map;

import com.aventstack.extentreports.ExtentReports;
import com.aventstack.extentreports.ExtentTest;

public class ExtentTestManager {
static Map<Integer, ExtentTest> extentTestMap = new HashMap<>();
static ExtentReports extent = ExtentManager.createExtentReports();

public static synchronized ExtentTest getTest() {
return extentTestMap.get((int) Thread.currentThread().getId());
}
public static synchronized ExtentTest startTest(String testName, String desc) {
ExtentTest test = extent.createTest(testName, desc);
extentTestMap.put((int) Thread.currentThread().getId(), test);
return test;
}
}
30 changes: 30 additions & 0 deletions test/selenium/src/main/java/ExtentReport/Log.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package ExtentReport;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class Log {
//Initialize Log4j instance
private static final Logger Log = LogManager.getLogger(Log.class);
//Info Level Logs
public static void info (String message) {
Log.info(message);
}
//Warn Level Logs
public static void warn (String message) {
Log.warn(message);
}

//Error Level Logs
public static void error (String message) {
Log.error(message);
}
//Fatal Level Logs
public static void fatal (String message) {
Log.fatal(message);
}
//Debug Level Logs
public static void debug (String message) {
Log.debug(message);
}
}
Loading