Skip to content

Commit 47910fc

Browse files
authored
[FEATURE]: add e2e to plugins (#573)
Signed-off-by: Mahmoud Shahrokni <seyedmahmoud.shahrokni@amadeus.com>
1 parent 0bd2007 commit 47910fc

File tree

11 files changed

+248
-11
lines changed

11 files changed

+248
-11
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,42 @@ jobs:
7676
- run: npm ci
7777
- run: npm run test
7878

79+
e2e:
80+
name: "e2e tests"
81+
needs: build # <--- CRITICAL: Wait for build to finish. PERSES_PLUGIN_ARCHIVE_PATHS accepts archive files only
82+
runs-on: ubuntu-latest
83+
steps:
84+
- name: checkout
85+
uses: actions/checkout@v6
86+
- name: download plugin archives
87+
uses: actions/download-artifact@v4 # <--- Download the artifacts to use the archive files
88+
with:
89+
name: archives
90+
path: ./plugins/temp-archives
91+
- name: flatten plugin archives # <--- Move all plugins archive into a single folder for simplicity
92+
run: |
93+
mkdir -p ./plugins/development-archives
94+
find ./plugins/temp-archives -name "*.tar.gz" -exec mv {} ./plugins/development-archives/ \;
95+
rm -rf ./plugins/temp-archives
96+
ls -R ./plugins/development-archives
97+
- name: start dev env
98+
uses: hoverkraft-tech/compose-action@v2.5.0
99+
with:
100+
compose-file: .github/workflows/docker-compose.ci.yml
101+
- uses: perses/github-actions@v0.11.0
102+
- uses: ./.github/perses-ci/actions/setup_environment
103+
with:
104+
enable_npm: true
105+
nvmrc_path: ".nvmrc"
106+
- name: install dependencies
107+
run: npm ci
108+
- name: install Playwright browsers
109+
run: npx playwright install --with-deps
110+
working-directory: e2e
111+
- name: run e2e tests
112+
run: npm run test:ci --prefix e2e -- src/tests
113+
114+
79115
type-check:
80116
name: "type-check"
81117
runs-on: ubuntu-latest
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
perses:
3+
image: persesdev/perses:main-2026-02-26-739dc289-distroless-debug
4+
container_name: perses
5+
network_mode: host
6+
environment:
7+
- PERSES_PLUGIN_ENABLE_DEV=true
8+
- PERSES_PLUGIN_ARCHIVE_PATHS_0=/etc/perses/development-archives
9+
- PERSES_PROVISIONING_FOLDERS_0=/etc/perses/provisioning
10+
volumes:
11+
- ../../plugins/development-archives:/etc/perses/development-archives
12+
- ../../e2e/src/data:/etc/perses/provisioning

e2e/.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
# Playwright
3+
node_modules/
4+
/test-results/
5+
/playwright-report/
6+
/blob-report/
7+
/playwright/.cache/
8+
/playwright/.auth/

e2e/package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "@perses-dev/plugins-e2e",
3+
"version": "0.1.0",
4+
"description": "e2e tests for plugins",
5+
"private": true,
6+
"scripts": {
7+
"test:ci": "npx playwright test --workers=1 --reporter=github,list",
8+
"test:install": "npx playwright install --with-deps",
9+
"test:local": "npx playwright test --ui",
10+
"build": "echo 'Skipping build for e2e tests'"
11+
},
12+
"devDependencies": {
13+
"@playwright/test": "^1.58.2",
14+
"@types/node": "^25.2.3"
15+
}
16+
}

e2e/playwright.config.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright The Perses Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
import { defineConfig, devices } from '@playwright/test';
15+
16+
export default defineConfig({
17+
testDir: './src/tests',
18+
fullyParallel: true,
19+
retries: 0,
20+
reporter: 'list',
21+
22+
use: {
23+
baseURL: 'http://localhost:8080',
24+
trace: 'off',
25+
screenshot: 'only-on-failure',
26+
video: 'off',
27+
},
28+
29+
projects: [
30+
{
31+
name: 'chromium',
32+
use: { ...devices['Desktop Chrome'] },
33+
},
34+
],
35+
36+
expect: {
37+
timeout: 10000,
38+
},
39+
});

e2e/src/data/projects/e2e.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"kind": "Project",
3+
"metadata": {
4+
"name": "e2eproject"
5+
},
6+
"spec": {}
7+
}

e2e/src/tests/table/table.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright The Perses Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
import { test, expect } from '@playwright/test';
15+
16+
/* WAS ONLY ADDED FOR DEMONSTRATIONS*/
17+
test.describe('table Plugin', () => {
18+
test('ONLY FOR PR DEMONSTRATION', async () => {
19+
expect(1).toBe(1);
20+
});
21+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright The Perses Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
import { test, expect } from '@playwright/test';
15+
16+
/* WAS ONLY ADDED FOR DEMONSTRATIONS*/
17+
test.describe('tacetable Plugin', () => {
18+
test('ONLY FOR PR DEMONSTRATION', async () => {
19+
expect(true).toBeTruthy();
20+
});
21+
});

package-lock.json

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

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"timeseriestable",
3535
"tracetable",
3636
"tracingganttchart",
37-
"victorialogs"
37+
"victorialogs",
38+
"e2e"
3839
],
3940
"peerDependencies": {
4041
"@types/react-dom": "^18.3.0",
@@ -84,4 +85,4 @@
8485
"typescript": "^5.4.2"
8586
},
8687
"packageManager": "npm@10.9.2"
87-
}
88+
}

0 commit comments

Comments
 (0)