Skip to content

Commit

Permalink
Fine tune e2e running on github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
lpetrora committed Sep 11, 2024
1 parent 59e22a5 commit 8846bbd
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 30 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,11 @@ jobs:
docker compose rm -f
docker compose up --exit-code-from=playwright --pull always
working-directory: tests/
env:
CI: true

- name: upload playwright artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright
Expand Down
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export default defineConfig<PluginOptions>({
outputDir: './tests/results',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
retries: process.env.CI ? 3 : 0,
workers: 2,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'list',
use: {
Expand Down
14 changes: 14 additions & 0 deletions tests/checkmk-docker-hooks/post-create/configure_checkmk.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
su - cmk -c "/usr/bin/env bash" << __EOF__
echo abskjfdalkdhjbld | cmk-passwd cmkadmin -i
echo "Admin password set"
omd stop
omd config set MKEVENTD off
omd config set AGENT_RECEIVER off
omd config set LIVEPROXYD off
omd config set TRACE_SEND off
omd config set TRACE_RECEIVE off
omd start
echo "Event console, agent receiver, liveproxy, and trace disabled"
__EOF__
11 changes: 0 additions & 11 deletions tests/checkmk-docker-hooks/post-create/set-admin-password.sh

This file was deleted.

24 changes: 13 additions & 11 deletions tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@ services:
context: ../
dockerfile: tests/Dockerfile
environment:
CMK_SITE: cmk
CMK_ADMIN: cmkadmin
CMK_AUTOMATION: automation
CMK_PASSWORD: abskjfdalkdhjbld
PLAYWRIGHT_TO_CHECKMK_URL: http://checkmk:5000/cmk/
PLAYWRIGHT_TO_GRAFANA_URL: http://grafana:3000/
GRAFANA_USER: admin
GRAFANA_PASSWORD: password
GRAFANA_TO_CHECKMK_USER: automation
GRAFANA_TO_CHECKMK_PASSWORD: abskjfdalkdhjbld
GRAFANA_TO_CHECKMK_URL: http://checkmk:5000/cmk/
- CMK_SITE=cmk
- CMK_ADMIN=cmkadmin
- CMK_AUTOMATION=automation
- CMK_PASSWORD=abskjfdalkdhjbld
- PLAYWRIGHT_TO_CHECKMK_URL=http://checkmk:5000/cmk/
- PLAYWRIGHT_TO_GRAFANA_URL=http://grafana:3000/
- GRAFANA_USER=admin
- GRAFANA_PASSWORD=password
- GRAFANA_TO_CHECKMK_USER=automation
- GRAFANA_TO_CHECKMK_PASSWORD=abskjfdalkdhjbld
- GRAFANA_TO_CHECKMK_URL=http://checkmk:5000/cmk/
- CI

extra_hosts:
- checkmk.local:host-gateway
volumes:
Expand Down
4 changes: 1 addition & 3 deletions tests/e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import dotenv from 'dotenv';

dotenv.config();

const site = process.env.CMK_SITE;

const cfg = {
//Checkmk
site: site,
site: process.env.CMK_SITE,
cmkUser: process.env.CMK_ADMIN,
cmkPassword: process.env.CMK_PASSWORD,
automationUser: process.env.CMK_AUTOMATION,
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/models/DashboardPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type Page, expect } from '@playwright/test';
import current_config from '../config';
import { FilterTypes, GRAFANA_SELECTORS, GRAFANA_TEXT, GraphTypes } from '../constants';

const CUSTOM_TIMEOUT = 40000;
const CUSTOM_TIMEOUT = 30000;

export class DashboardPage {
readonly page: Page;
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/tests/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ test.describe('E2E tests', () => {
});

test.describe('Commercial editions tests', () => {
test.slow();
test('time-usage panel by service (single host)', async ({ page }) => {
const dashboardPage = new DashboardPage(page);
await dashboardPage.selectDatasource(CMK_EDITION.CEE);
Expand Down Expand Up @@ -94,7 +95,7 @@ test.describe('E2E tests', () => {
await dashboardPage.addFilter(FilterTypes.HOSTNAME_REGEX);
await dashboardPage.filterByHostnameRegex('localhost_grafana[0-9]+');

await expect(page.locator(GRAFANA_SELECTORS.SPINNER).first()).not.toBeVisible();
await dashboardPage.expectSpinners(false);

await dashboardPage.selectPredefinedGraphType(GraphTypes.RAM_USAGE);

Expand Down Expand Up @@ -213,6 +214,7 @@ test.describe('E2E tests', () => {
});

test.describe('Raw edition tests', () => {
test.slow();
test('time-usage panel by service (Single host)', async ({ page }, testInfo) => {
const dashboardPage = new DashboardPage(page);
await dashboardPage.selectDatasource(CMK_EDITION.CRE);
Expand Down

0 comments on commit 8846bbd

Please sign in to comment.