From c72122fea2c2799709183abce5340770654632e8 Mon Sep 17 00:00:00 2001 From: Sami Date: Sat, 28 Sep 2024 17:24:58 -0400 Subject: [PATCH 1/8] fix: 2 - Updating Jenkinsfile --- Jenkinsfile | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index a8b9e43..d4b72b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,12 +2,35 @@ pipeline { agent any stages { + stage('Checkout') { + steps { + // Checkout code from version control + git 'https://gitea.zacksolutions.dev/Zakaria/ZenProject.git' + } + } + stage('Build') { steps { - // This runs the Maven test phase + // Build your project (if needed) + sh 'mvn clean install' + } + } + + stage('Test') { + steps { + // Install dependencies + sh 'mvn dependency:resolve' + + // Run browser tests sh 'mvn test' } } + + stage('Generate Reports') { + steps { + // Generate and store test reports + sh 'mvn site' + } + } } } - From f0dfc063e10236100c4f28d10d18bf7454d558a6 Mon Sep 17 00:00:00 2001 From: Sami Date: Sat, 28 Sep 2024 17:29:33 -0400 Subject: [PATCH 2/8] fix: 3 - Updating Jenkinsfile --- Jenkinsfile | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d4b72b9..c28d225 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,35 +2,22 @@ pipeline { agent any stages { - stage('Checkout') { + stage('Install Chrome and ChromeDriver') { steps { - // Checkout code from version control - git 'https://gitea.zacksolutions.dev/Zakaria/ZenProject.git' + // Install Chrome and ChromeDriver if necessary (Linux environment) + sh 'sudo apt-get update' + sh 'sudo apt-get install -y google-chrome-stable' + sh 'wget https://chromedriver.storage.googleapis.com/$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip' + sh 'unzip chromedriver_linux64.zip' + sh 'sudo mv chromedriver /usr/local/bin/' } } - - stage('Build') { + stage('Run Tests') { steps { - // Build your project (if needed) - sh 'mvn clean install' - } - } - - stage('Test') { - steps { - // Install dependencies - sh 'mvn dependency:resolve' - - // Run browser tests + // Run the tests in a headless Chrome environment sh 'mvn test' } } - - stage('Generate Reports') { - steps { - // Generate and store test reports - sh 'mvn site' - } - } } } + From 54fbd3e32618e8106bebc9a9e9a5e7ec7ff3e1b9 Mon Sep 17 00:00:00 2001 From: Sami Date: Sat, 28 Sep 2024 18:32:03 -0400 Subject: [PATCH 3/8] fix: 4 - Updating Jenkinsfile --- Jenkinsfile | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index c28d225..d4b72b9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,22 +2,35 @@ pipeline { agent any stages { - stage('Install Chrome and ChromeDriver') { + stage('Checkout') { steps { - // Install Chrome and ChromeDriver if necessary (Linux environment) - sh 'sudo apt-get update' - sh 'sudo apt-get install -y google-chrome-stable' - sh 'wget https://chromedriver.storage.googleapis.com/$(curl -s https://chromedriver.storage.googleapis.com/LATEST_RELEASE)/chromedriver_linux64.zip' - sh 'unzip chromedriver_linux64.zip' - sh 'sudo mv chromedriver /usr/local/bin/' + // Checkout code from version control + git 'https://gitea.zacksolutions.dev/Zakaria/ZenProject.git' } } - stage('Run Tests') { + + stage('Build') { steps { - // Run the tests in a headless Chrome environment + // Build your project (if needed) + sh 'mvn clean install' + } + } + + stage('Test') { + steps { + // Install dependencies + sh 'mvn dependency:resolve' + + // Run browser tests sh 'mvn test' } } + + stage('Generate Reports') { + steps { + // Generate and store test reports + sh 'mvn site' + } + } } } - From d730a1357dc0460fdce5019be5eee72cbbbc86f0 Mon Sep 17 00:00:00 2001 From: Sami Date: Sat, 28 Sep 2024 19:02:18 -0400 Subject: [PATCH 4/8] fix: 4 - Updating Jenkinsfile --- Jenkinsfile | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d4b72b9..708e6ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -2,35 +2,11 @@ pipeline { agent any stages { - stage('Checkout') { - steps { - // Checkout code from version control - git 'https://gitea.zacksolutions.dev/Zakaria/ZenProject.git' - } - } - stage('Build') { steps { - // Build your project (if needed) - sh 'mvn clean install' - } - } - - stage('Test') { - steps { - // Install dependencies - sh 'mvn dependency:resolve' - - // Run browser tests + // This runs the Maven test phase sh 'mvn test' } } - - stage('Generate Reports') { - steps { - // Generate and store test reports - sh 'mvn site' - } - } } } From a92c917c97fdd1917d18cb15c40f563cac170f2d Mon Sep 17 00:00:00 2001 From: Sami Date: Sun, 29 Sep 2024 00:49:39 -0400 Subject: [PATCH 5/8] fix: 6 - Updating Jenkinsfile --- reports/index.html | 12 ++++++------ src/main/java/zacksolutions/base/Initialization.java | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/reports/index.html b/reports/index.html index 4f8ff7f..67ecae2 100644 --- a/reports/index.html +++ b/reports/index.html @@ -35,7 +35,7 @@ Zenful
  • -Sep 28, 2024 04:50:12 PM +Sep 29, 2024 12:45:26 AM
  • @@ -81,7 +81,7 @@

    Test msg

    - 4:50:15 PM / 00:00:00:000 + 12:45:29 AM / 00:00:00:000 Pass

    @@ -90,8 +90,8 @@
    Test msg
    -09.28.2024 4:50:15 PM -09.28.2024 4:50:15 PM +09.29.2024 12:45:29 AM +09.29.2024 12:45:29 AM 00:00:00:000 · #test-id=1 @@ -115,13 +115,13 @@

    Started

    -

    Sep 28, 2024 04:50:12 PM

    +

    Sep 29, 2024 12:45:26 AM

    Ended

    -

    Sep 28, 2024 04:50:15 PM

    +

    Sep 29, 2024 12:45:30 AM

    diff --git a/src/main/java/zacksolutions/base/Initialization.java b/src/main/java/zacksolutions/base/Initialization.java index 4bc86a0..ddc24ae 100644 --- a/src/main/java/zacksolutions/base/Initialization.java +++ b/src/main/java/zacksolutions/base/Initialization.java @@ -2,6 +2,7 @@ package zacksolutions.base; import java.io.FileInputStream; import java.io.IOException; +import java.time.Duration; import java.util.Properties; import com.aventstack.extentreports.ExtentTest; import com.aventstack.extentreports.reporter.ExtentSparkReporter; @@ -69,5 +70,6 @@ public class Initialization { } driver.manage().window().maximize(); driver.manage().deleteAllCookies(); + driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(5)); } } From bc25347655a9a238e6530a58887549452b20ebe9 Mon Sep 17 00:00:00 2001 From: Sami Date: Sun, 29 Sep 2024 01:00:40 -0400 Subject: [PATCH 6/8] fix: 7 - Updating Jenkinsfile --- Jenkinsfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 708e6ea..e296ae0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,5 +1,7 @@ pipeline { - agent any + agent { + label "agent_locke" + } stages { stage('Build') { From c36e6e93369e73fd7cc9f8efdec47f73a2bf01e5 Mon Sep 17 00:00:00 2001 From: Sami Date: Sun, 29 Sep 2024 01:08:07 -0400 Subject: [PATCH 7/8] fix: 8 - Updating Jenkinsfile --- src/main/java/zacksolutions/base/Initialization.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/zacksolutions/base/Initialization.java b/src/main/java/zacksolutions/base/Initialization.java index ddc24ae..3a9e0d7 100644 --- a/src/main/java/zacksolutions/base/Initialization.java +++ b/src/main/java/zacksolutions/base/Initialization.java @@ -64,7 +64,7 @@ public class Initialization { // "/drivers/chromedriver"); // driver = new ChromeDriver(); ChromeOptions options = new ChromeOptions(); - options.addArguments("--headless"); + options.addArguments("headless"); driver = new ChromeDriver(options); driver.get(prop.getProperty("url")); } From 6fe7a83a5a90a43e5e0d7bb173a1f7232e5cd955 Mon Sep 17 00:00:00 2001 From: Sami Date: Sun, 29 Sep 2024 01:22:17 -0400 Subject: [PATCH 8/8] fix: 9 - Updating Jenkinsfile --- reports/index.html | 12 ++++++------ src/main/java/zacksolutions/base/Initialization.java | 6 +++++- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/reports/index.html b/reports/index.html index 67ecae2..dd0da7b 100644 --- a/reports/index.html +++ b/reports/index.html @@ -35,7 +35,7 @@ Zenful
  • -Sep 29, 2024 12:45:26 AM +Sep 29, 2024 01:21:35 AM
  • @@ -81,7 +81,7 @@

    Test msg

    - 12:45:29 AM / 00:00:00:000 + 1:21:37 AM / 00:00:00:000 Pass

    @@ -90,8 +90,8 @@
    Test msg
    -09.29.2024 12:45:29 AM -09.29.2024 12:45:29 AM +09.29.2024 1:21:37 AM +09.29.2024 1:21:37 AM 00:00:00:000 · #test-id=1 @@ -115,13 +115,13 @@

    Started

    -

    Sep 29, 2024 12:45:26 AM

    +

    Sep 29, 2024 01:21:35 AM

    Ended

    -

    Sep 29, 2024 12:45:30 AM

    +

    Sep 29, 2024 01:21:37 AM

    diff --git a/src/main/java/zacksolutions/base/Initialization.java b/src/main/java/zacksolutions/base/Initialization.java index 3a9e0d7..18c3005 100644 --- a/src/main/java/zacksolutions/base/Initialization.java +++ b/src/main/java/zacksolutions/base/Initialization.java @@ -64,8 +64,12 @@ public class Initialization { // "/drivers/chromedriver"); // driver = new ChromeDriver(); ChromeOptions options = new ChromeOptions(); - options.addArguments("headless"); driver = new ChromeDriver(options); + options.addArguments("--no-sandbox"); + options.addArguments("--disable-dev-shm-usage"); + options.addArguments("--headless"); + options.addArguments("--remote-debugging-port=9222"); + options.setBinary("/usr/bin/google-chrome"); driver.get(prop.getProperty("url")); } driver.manage().window().maximize();