forked from Zakaria/ZenProject
fix: adding Jenkinsfile
This commit is contained in:
parent
72f873c8d8
commit
df67108c10
@ -8,7 +8,7 @@
|
|||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_23" default="true" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" project-jdk-name="openjdk-23" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
13
Jenkinsfile
vendored
Normal file
13
Jenkinsfile
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
// This runs the Maven test phase
|
||||||
|
sh 'mvn test'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@
|
|||||||
<a href="#"><span class="badge badge-primary">Zenful</span></a>
|
<a href="#"><span class="badge badge-primary">Zenful</span></a>
|
||||||
</li>
|
</li>
|
||||||
<li class="m-r-10">
|
<li class="m-r-10">
|
||||||
<a href="#"><span class="badge badge-primary">Sep 27, 2024 10:13:21 AM</span></a>
|
<a href="#"><span class="badge badge-primary">Sep 28, 2024 04:50:12 PM</span></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -81,7 +81,7 @@
|
|||||||
<div class="test-detail">
|
<div class="test-detail">
|
||||||
<p class="name">Test msg</p>
|
<p class="name">Test msg</p>
|
||||||
<p class="text-sm">
|
<p class="text-sm">
|
||||||
<span>10:13:26 AM</span> / <span>00:00:00:000</span>
|
<span>4:50:15 PM</span> / <span>00:00:00:000</span>
|
||||||
<span class="badge pass-bg log float-right">Pass</span>
|
<span class="badge pass-bg log float-right">Pass</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -90,8 +90,8 @@
|
|||||||
<div class="p-v-10">
|
<div class="p-v-10">
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<h5 class="test-status text-pass">Test msg</h5>
|
<h5 class="test-status text-pass">Test msg</h5>
|
||||||
<span class='badge badge-success'>09.27.2024 10:13:26 AM</span>
|
<span class='badge badge-success'>09.28.2024 4:50:15 PM</span>
|
||||||
<span class='badge badge-danger'>09.27.2024 10:13:26 AM</span>
|
<span class='badge badge-danger'>09.28.2024 4:50:15 PM</span>
|
||||||
<span class='badge badge-default'>00:00:00:000</span>
|
<span class='badge badge-default'>00:00:00:000</span>
|
||||||
· <span class='uri-anchor badge badge-default'>#test-id=1</span>
|
· <span class='uri-anchor badge badge-default'>#test-id=1</span>
|
||||||
<span title='Skip to the next failed step' class='badge badge-danger pointer float-right ne ml-1'><i class="fa fa-fast-forward"></i></span>
|
<span title='Skip to the next failed step' class='badge badge-danger pointer float-right ne ml-1'><i class="fa fa-fast-forward"></i></span>
|
||||||
@ -115,13 +115,13 @@
|
|||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="card"><div class="card-body">
|
<div class="card"><div class="card-body">
|
||||||
<p class="m-b-0">Started</p>
|
<p class="m-b-0">Started</p>
|
||||||
<h3>Sep 27, 2024 10:13:21 AM</h3>
|
<h3>Sep 28, 2024 04:50:12 PM</h3>
|
||||||
</div></div>
|
</div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<div class="card"><div class="card-body">
|
<div class="card"><div class="card-body">
|
||||||
<p class="m-b-0">Ended</p>
|
<p class="m-b-0">Ended</p>
|
||||||
<h3>Sep 27, 2024 10:13:26 AM</h3>
|
<h3>Sep 28, 2024 04:50:15 PM</h3>
|
||||||
</div></div>
|
</div></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
@ -182,7 +182,7 @@ var timeline = {
|
|||||||
<thead><tr class="bg-gray"><th>Name</th><th>Value</th></tr></thead>
|
<thead><tr class="bg-gray"><th>Name</th><th>Value</th></tr></thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Test Done By: </td>
|
<td>Tester ID: </td>
|
||||||
<td>Sami</td>
|
<td>Sami</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
package zacksolutions.base;
|
package zacksolutions.base;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
@ -7,23 +8,24 @@ import com.aventstack.extentreports.reporter.ExtentSparkReporter;
|
|||||||
import com.aventstack.extentreports.ExtentReports;
|
import com.aventstack.extentreports.ExtentReports;
|
||||||
import org.openqa.selenium.WebDriver;
|
import org.openqa.selenium.WebDriver;
|
||||||
import org.openqa.selenium.chrome.ChromeDriver;
|
import org.openqa.selenium.chrome.ChromeDriver;
|
||||||
|
import org.openqa.selenium.chrome.ChromeOptions;
|
||||||
import org.openqa.selenium.firefox.FirefoxDriver;
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||||
|
|
||||||
public class Initialization {
|
public class Initialization {
|
||||||
//let's set up our variables
|
// let's set up our variables
|
||||||
|
|
||||||
public static WebDriver driver;
|
public static WebDriver driver;
|
||||||
public static Properties prop;
|
public static Properties prop;
|
||||||
public static ExtentReports extent;
|
public static ExtentReports extent;
|
||||||
public static ExtentTest test;
|
public static ExtentTest test;
|
||||||
|
|
||||||
|
|
||||||
public Initialization() {
|
public Initialization() {
|
||||||
// let's use the config.properties file to set up our global variables...
|
// let's use the config.properties file to set up our global variables...
|
||||||
try {
|
try {
|
||||||
|
|
||||||
prop = new Properties();
|
prop = new Properties();
|
||||||
FileInputStream fis = new FileInputStream(System.getProperty("user.dir") + "/src/main/java/zacksolutions/config/config.properties");
|
FileInputStream fis = new FileInputStream(
|
||||||
|
System.getProperty("user.dir") + "/src/main/java/zacksolutions/config/config.properties");
|
||||||
prop.load(fis);
|
prop.load(fis);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -34,7 +36,7 @@ public class Initialization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void BrowserInit() {
|
public void BrowserInit() {
|
||||||
//our EXTENTREPORTS SETUP!
|
// our EXTENTREPORTS SETUP!
|
||||||
|
|
||||||
String path = System.getProperty("user.dir") + "/reports/index.html";
|
String path = System.getProperty("user.dir") + "/reports/index.html";
|
||||||
ExtentSparkReporter spark = new ExtentSparkReporter(path);
|
ExtentSparkReporter spark = new ExtentSparkReporter(path);
|
||||||
@ -44,20 +46,25 @@ public class Initialization {
|
|||||||
extent.attachReporter(spark);
|
extent.attachReporter(spark);
|
||||||
extent.setSystemInfo("Tester ID: ", "Sami");
|
extent.setSystemInfo("Tester ID: ", "Sami");
|
||||||
|
|
||||||
//conditioning our WebDriver with an if statement
|
// conditioning our WebDriver with an if statement
|
||||||
String browsername = prop.getProperty("browserC");
|
String browsername = prop.getProperty("browserC");
|
||||||
|
|
||||||
//launching FireFox
|
// launching FireFox
|
||||||
if (browsername.equalsIgnoreCase("firefox")) {
|
if (browsername.equalsIgnoreCase("firefox")) {
|
||||||
System.setProperty("web-driver.gecko.driver","user.dir" + "/drivers/geckodriver");
|
// System.setProperty("web-driver.gecko.driver","user.dir" +
|
||||||
driver = new FirefoxDriver();
|
// "/drivers/geckodriver");
|
||||||
|
// driver = new FirefoxDriver();
|
||||||
driver.get(prop.getProperty("url"));
|
driver.get(prop.getProperty("url"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//launching Chrome
|
// launching Chrome
|
||||||
if (browsername.equalsIgnoreCase("chrome")) {
|
if (browsername.equalsIgnoreCase("chrome")) {
|
||||||
System.setProperty("web-driver.gecko.driver", "user.dir" + "/drivers/chromedriver");
|
// System.setProperty("web-driver.gecko.driver", "user.dir" +
|
||||||
driver = new ChromeDriver();
|
// "/drivers/chromedriver");
|
||||||
|
// driver = new ChromeDriver();
|
||||||
|
ChromeOptions options = new ChromeOptions();
|
||||||
|
options.addArguments("--headless");
|
||||||
|
driver = new ChromeDriver(options);
|
||||||
driver.get(prop.getProperty("url"));
|
driver.get(prop.getProperty("url"));
|
||||||
}
|
}
|
||||||
driver.manage().window().maximize();
|
driver.manage().window().maximize();
|
||||||
|
|||||||
@ -7,27 +7,30 @@ import org.testng.annotations.Test;
|
|||||||
import zacksolutions.base.Initialization;
|
import zacksolutions.base.Initialization;
|
||||||
import zacksolutions.pages.HomePage;
|
import zacksolutions.pages.HomePage;
|
||||||
|
|
||||||
|
|
||||||
public class HomePageTest extends Initialization {
|
public class HomePageTest extends Initialization {
|
||||||
|
|
||||||
HomePage homePage;
|
HomePage homePage;
|
||||||
public HomePageTest(){
|
|
||||||
super();
|
public HomePageTest() {
|
||||||
}
|
super();
|
||||||
@BeforeTest
|
}
|
||||||
public void setUp(){
|
|
||||||
BrowserInit();
|
@BeforeTest
|
||||||
homePage = new HomePage();
|
public void setUp() {
|
||||||
}
|
BrowserInit();
|
||||||
@Test
|
homePage = new HomePage();
|
||||||
public void TextTest() throws InterruptedException {
|
}
|
||||||
HomePage hp = new HomePage();
|
|
||||||
hp.insertText();
|
@Test
|
||||||
hp.textConfirmation();
|
public void TextTest() throws InterruptedException {
|
||||||
Assert.assertEquals(hp.textConfirmation(), "4 8 15 16 23 42");
|
HomePage hp = new HomePage();
|
||||||
}
|
hp.insertText();
|
||||||
@AfterTest
|
hp.textConfirmation();
|
||||||
public void tearDown(){
|
Assert.assertEquals(hp.textConfirmation(), "4 8 15 16 23 42");
|
||||||
driver.close();
|
}
|
||||||
}
|
|
||||||
|
@AfterTest
|
||||||
|
public void tearDown() {
|
||||||
|
driver.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user