Skip to content

Commit a992c06

Browse files
author
Craig Mc Carthy
committed
init commit
1 parent 5a96124 commit a992c06

File tree

2 files changed

+87
-28
lines changed

2 files changed

+87
-28
lines changed

.github/workflows/run.yml

Lines changed: 87 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,105 @@
1-
name: Playwright Automated Testing Framework
1+
name: run
22

33
on:
44
pull_request:
55
branches: [ "main" ]
66
push:
77
branches: [ "**" ]
88

9+
# Concurrency control to cancel previous runs on new commits
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
914
jobs:
1015
build:
16+
runs-on: ${{ matrix.os }}
17+
timeout-minutes: 30
18+
19+
strategy:
20+
matrix:
21+
java: [17]
22+
os: [ubuntu-latest, ubuntu-22.04]
23+
browser: [chrome]
24+
fail-fast: false
1125

12-
runs-on: ubuntu-latest
26+
env:
27+
DISPLAY: ':99'
28+
MAVEN_OPTS: '-Xmx2048m'
29+
BROWSER: ${{ matrix.browser }}
1330

1431
steps:
15-
- uses: actions/checkout@v4
16-
- name: Set up JDK 17
17-
uses: actions/setup-java@v4
32+
- uses: actions/[email protected]
33+
34+
- name: Set up JDK ${{ matrix.java }}
35+
uses: actions/[email protected]
1836
with:
19-
java-version: '17'
37+
java-version: '${{ matrix.java }}'
2038
distribution: 'temurin'
2139
cache: maven
22-
- name: Remove Chrome
23-
run: sudo apt purge google-chrome-stable
24-
- name: Remove default Chromium
25-
run: sudo apt purge chromium-browser
26-
27-
- name: Install Google Chrome # Using shell script to install Google Chrome
40+
41+
- name: Cache Maven dependencies
42+
uses: actions/[email protected]
43+
with:
44+
path: |
45+
~/.m2/repository
46+
~/.m2/wrapper
47+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
48+
restore-keys: |
49+
${{ runner.os }}-maven-
50+
- name: Set up Chrome
51+
if: matrix.browser == 'chrome'
52+
uses: browser-actions/[email protected]
53+
with:
54+
chrome-version: stable
55+
56+
- name: Start Xvfb
2857
run: |
29-
chmod +x ./.github/scripts/InstallChrome.sh
30-
./.github/scripts/InstallChrome.sh
58+
sudo Xvfb :99 -ac -screen 0 1280x1024x24 > /dev/null 2>&1 &
59+
sleep 3
60+
61+
- name: Validate environment
62+
run: |
63+
echo "Java version:"
64+
java -version
65+
echo "Maven version:"
66+
mvn -version
67+
echo "Browser: ${{ matrix.browser }}"
68+
if [ "${{ matrix.browser }}" = "chrome" ]; then
69+
echo "Chrome version:"
70+
google-chrome --version
71+
fi
72+
echo "Display: $DISPLAY"
3173
3274
- name: Test
33-
run: mvn clean test -Ptest
75+
run: mvn clean install -P headless-github -B -T 1C -Dbrowser=${{ matrix.browser }}
76+
continue-on-error: false
77+
timeout-minutes: 20
78+
79+
- name: Upload test reports
80+
uses: actions/[email protected]
81+
if: always()
82+
with:
83+
name: test-reports-java${{ matrix.java }}-${{ matrix.os }}-${{ matrix.browser }}
84+
path: |
85+
**/target/surefire-reports/
86+
**/target/allure-results/
87+
**/target/cucumber/
88+
**/logs/
89+
retention-days: 30
90+
91+
- name: Upload screenshots on failure
92+
uses: actions/[email protected]
93+
if: failure()
94+
with:
95+
name: screenshots-java${{ matrix.java }}-${{ matrix.os }}-${{ matrix.browser }}
96+
path: |
97+
**/target/screenshots/
98+
**/target/test-output/
99+
retention-days: 7
100+
101+
- name: Cleanup
102+
if: always()
103+
run: |
104+
pkill -f Xvfb || true
105+
pkill -f chrome || true

common/src/main/java/com/cmccarthyirl/common/ExtentTests.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.cmccarthyirl.common;
22

33
import com.aventstack.extentreports.ExtentTest;
4-
import com.aventstack.extentreports.Status;
54
import com.aventstack.extentreports.model.Test;
65
import org.testng.ITestResult;
76

@@ -134,16 +133,4 @@ private static void assignGroups(ExtentTest test, String[] groups) {
134133
});
135134
}
136135
}
137-
138-
// Map TestNG status code to ExtentReports status (PASS, FAIL, SKIP)
139-
private static Status mapStatus(int statusCode) {
140-
switch (statusCode) {
141-
case ITestResult.FAILURE:
142-
return Status.FAIL;
143-
case ITestResult.SUCCESS:
144-
return Status.PASS;
145-
default:
146-
return Status.SKIP;
147-
}
148-
}
149136
}

0 commit comments

Comments
 (0)