Skip to content

Commit 66db3f2

Browse files
authored
GH-4742 jstl (#4814)
2 parents 8f754f4 + 592cb89 commit 66db3f2

14 files changed

Lines changed: 947 additions & 0 deletions

File tree

.github/workflows/pr-verify.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,37 @@ jobs:
124124
repo: eclipse/rdf4j
125125
workflow_id: ${{ github.run_id }}
126126
access_token: ${{ github.token }}
127+
e2e:
128+
runs-on: ubuntu-latest
129+
steps:
130+
- uses: actions/checkout@v2
131+
- name: Set up JDK
132+
uses: actions/setup-java@v1
133+
with:
134+
java-version: 11
135+
- name: Cache local Maven repository
136+
uses: actions/cache@v2
137+
with:
138+
path: ~/.m2/repository
139+
key: ${{ runner.os }}-jdk11-maven-${{ hashFiles('**/pom.xml') }}
140+
restore-keys: |
141+
${{ runner.os }}-jdk11-maven-
142+
- name: Install dependencies
143+
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
144+
- name: Install Node.js
145+
uses: actions/setup-node@v3
146+
with:
147+
node-version: 18
148+
- name: Run end-to-end tests of RDF4J Server and Workbench
149+
working-directory: ./e2e
150+
run: ./run.sh
151+
- name: Cancel workflow on failure
152+
uses: vishnudxb/cancel-workflow@v1.2
153+
if: failure()
154+
with:
155+
repo: eclipse/rdf4j
156+
workflow_id: ${{ github.run_id }}
157+
access_token: ${{ github.token }}
127158
copyright-check:
128159
runs-on: ubuntu-latest
129160
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ compliance/*/overlays
4848
docker/ignore
4949
/core/queryparser/sparql/JavaCC/javacc/
5050
/scripts/temp/
51+
org.eclipse.dash.licenses-1.0.2.jar
5152
e2e/node_modules
5253
e2e/playwright-report
5354
e2e/test-results

docker/waitForDocker.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env bash
2+
# Initial sleep to make sure docker has started
3+
sleep 5
4+
5+
6+
while : ; do
7+
STARTING=`docker ps -f "health=starting" --format "{{.Names}}"`
8+
if [ -z "$STARTING" ] #if STARTING is empty
9+
then
10+
break
11+
fi
12+
echo "Waiting for containers to finish starting"
13+
sleep 1
14+
done
15+
16+
17+
while : ; do
18+
19+
# Get cpu % from docker stats, remove '%' and then sum all the values into one number
20+
CPU=`docker stats --no-stream --format "{{.CPUPerc}}" | awk '{gsub ( "[%]","" ) ; print $0 }' | awk '{s+=$1} END {print s}'`
21+
echo "CPU: $CPU%"
22+
23+
# Do floating point comparison, if $CPU is bigger than 15, WAIT will be 1
24+
WAIT=`echo $CPU'>'15 | bc -l`
25+
echo "WAIT (0/1): $WAIT"
26+
27+
sleep 1
28+
29+
# Get cpu % from docker stats, remove '%' and then sum all the values into one number
30+
CPU2=`docker stats --no-stream --format "{{.CPUPerc}}" | awk '{gsub ( "[%]","" ) ; print $0 }' | awk '{s+=$1} END {print s}'`
31+
echo "CPU2: $CPU2%"
32+
33+
# Do floating point comparison, if $CPU is bigger than 15, WAIT will be 1
34+
WAIT2=`echo $CPU'>'15 | bc -l`
35+
echo "WAIT2 (0/1): $WAIT2"
36+
37+
# Break from loop if WAIT is 0, which is when the sum of the cpu usage is smaller than 15%
38+
[[ "$WAIT" -eq 0 ]] && [[ "$WAIT2" -eq 0 ]] && break
39+
40+
# Else sleep and loop
41+
echo "Waiting for docker"
42+
sleep 1
43+
44+
done
45+
46+
while : ; do
47+
STARTING=`docker ps -f "health=starting" --format "{{.Names}}"`
48+
if [ -z "$STARTING" ] #if STARTING is empty
49+
then
50+
break
51+
fi
52+
echo "Waiting for containers to finish starting"
53+
sleep 1
54+
done
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Playwright Tests
2+
on:
3+
push:
4+
branches: [ main, master ]
5+
pull_request:
6+
branches: [ main, master ]
7+
jobs:
8+
test:
9+
timeout-minutes: 60
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
with:
15+
node-version: 18
16+
- name: Install dependencies
17+
run: npm ci
18+
- name: Install Playwright Browsers
19+
run: npx playwright install --with-deps
20+
- name: Run Playwright tests
21+
run: npx playwright test
22+
- uses: actions/upload-artifact@v3
23+
if: always()
24+
with:
25+
name: playwright-report
26+
path: playwright-report/
27+
retention-days: 30

e2e/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
/test-results/
3+
/playwright-report/
4+
/playwright/.cache/

e2e/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# End-to-end tests
2+
3+
This directory contains end-to-end tests for the project. These tests use docker to run the RDF4J server and workbench.
4+
5+
The tests are written using Microsoft Playwright and interact with the server and workbench using the browser.
6+
7+
## Running the tests
8+
9+
Requirements:
10+
- docker
11+
- java
12+
- maven
13+
- npm
14+
- npx
15+
16+
The tests can be run using the `run.sh` script. This script will build the project, start the server and workbench and run the tests.
17+
18+
To run the tests interactively use `npx playwright test --ui`
19+
20+
The RDF4J server and workbench can be started independently using the `run.sh` script in the `docker` directory.

e2e/package-lock.json

Lines changed: 140 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

e2e/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "e2e",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {},
7+
"keywords": [],
8+
"author": "",
9+
"license": "ISC",
10+
"devDependencies": {
11+
"@playwright/test": "^1.39.0",
12+
"@types/node": "^20.8.7"
13+
}
14+
}

e2e/playwright.config.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
// @ts-check
2+
const { defineConfig, devices } = require('@playwright/test');
3+
4+
/**
5+
* Read environment variables from file.
6+
* https://github.com/motdotla/dotenv
7+
*/
8+
// require('dotenv').config();
9+
10+
/**
11+
* @see https://playwright.dev/docs/test-configuration
12+
*/
13+
module.exports = defineConfig({
14+
testDir: './tests',
15+
/* Run tests in files in parallel */
16+
fullyParallel: true,
17+
/* Fail the build on CI if you accidentally left test.only in the source code. */
18+
forbidOnly: !!process.env.CI,
19+
/* Retry on CI only */
20+
retries: process.env.CI ? 2 : 0,
21+
workers: 1,
22+
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
23+
reporter: 'html',
24+
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
25+
use: {
26+
/* Base URL to use in actions like `await page.goto('/')`. */
27+
// baseURL: 'http://127.0.0.1:3000',
28+
29+
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
30+
trace: 'on-first-retry',
31+
},
32+
33+
/* Configure projects for major browsers */
34+
projects: [
35+
{
36+
name: 'chromium',
37+
use: { ...devices['Desktop Chrome'] },
38+
},
39+
40+
{
41+
name: 'firefox',
42+
use: { ...devices['Desktop Firefox'] },
43+
},
44+
45+
{
46+
name: 'webkit',
47+
use: { ...devices['Desktop Safari'] },
48+
},
49+
50+
/* Test against mobile viewports. */
51+
// {
52+
// name: 'Mobile Chrome',
53+
// use: { ...devices['Pixel 5'] },
54+
// },
55+
// {
56+
// name: 'Mobile Safari',
57+
// use: { ...devices['iPhone 12'] },
58+
// },
59+
60+
/* Test against branded browsers. */
61+
// {
62+
// name: 'Microsoft Edge',
63+
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
64+
// },
65+
// {
66+
// name: 'Google Chrome',
67+
// use: { ...devices['Desktop Chrome'], channel: 'chrome' },
68+
// },
69+
],
70+
71+
/* Run your local dev server before starting the tests */
72+
// webServer: {
73+
// command: 'npm run start',
74+
// url: 'http://127.0.0.1:3000',
75+
// reuseExistingServer: !process.env.CI,
76+
// },
77+
});
78+

0 commit comments

Comments
 (0)