Skip to content
Merged

ui 2.0 #1792

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 9 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
runs-on:
- codebuild-defguard-core-runner-${{ github.run_id }}-${{ github.run_attempt }}
instance-size:2xlarge
outputs:
tests_ok: ${{ steps.run-test.outcome == 'success' }}

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -79,6 +81,8 @@ jobs:
run: npx playwright install chromium

- name: run tests
id: run-test
continue-on-error: true
working-directory: ./e2e
run: pnpm test

Expand All @@ -87,7 +91,7 @@ jobs:
run: docker compose --file './docker-compose.e2e.yaml' down

- uses: actions/upload-artifact@v4
if: failure()
if: steps.run-test.outcome == 'failure'
with:
name: playwright-report
path: |
Expand All @@ -102,6 +106,9 @@ jobs:

trigger-staging-deploy:
needs: test
if: ${{ github.event_name != 'pull_request' && startsWith(github.ref_name, 'release/') }}
if: |
github.event_name != 'pull_request' &&
startsWith(github.ref_name, 'release/') &&
needs.test.outputs.tests_ok == 'true'
uses: ./.github/workflows/staging-deployment.yml
secrets: inherit
5 changes: 4 additions & 1 deletion .github/workflows/lint-web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,15 @@ jobs:
submodules: "recursive"
- uses: actions/setup-node@v4
with:
node-version: 24
node-version: 25
- name: install deps
working-directory: ./web
run: |
npm i -g npm pnpm
pnpm i --frozen-lockfile
- name: Build
working-directory: ./web
run: pnpm run build
- name: Lint
working-directory: ./web
run: pnpm run lint
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/test-web.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .github/workflows/test-web.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on: []


permissions:
contents: read
jobs:
test-web:
runs-on:
- codebuild-defguard-core-runner-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- uses: actions/setup-node@v4
with:
node-version: 24
- name: install deps
working-directory: ./web
run: |
npm i -g npm pnpm
pnpm i --frozen-lockfile
- name: Run tests
working-directory: ./web
run: pnpm run test
6 changes: 2 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
FROM public.ecr.aws/docker/library/node:24 AS web
FROM public.ecr.aws/docker/library/node:25 AS web

WORKDIR /app
COPY web/package.json web/pnpm-lock.yaml web/.npmrc ./
COPY web/package.json web/pnpm-lock.yaml ./
RUN npm i -g pnpm
RUN pnpm install --ignore-scripts --frozen-lockfile
COPY web/ .
RUN pnpm run generate-translation-types
RUN pnpm build

FROM public.ecr.aws/docker/library/rust:1 AS chef
Expand All @@ -31,7 +30,6 @@ RUN cargo chef cook --release --recipe-path recipe.json

# build project
COPY --from=web /app/dist ./web/dist
COPY web/src/shared/images/svg ./web/src/shared/images/svg
RUN apt-get update && apt-get -y install protobuf-compiler libprotobuf-dev
COPY Cargo.toml Cargo.lock ./
# for vergen
Expand Down
5 changes: 0 additions & 5 deletions e2e/.env

This file was deleted.

28 changes: 28 additions & 0 deletions e2e/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { table } from 'console';
import { User } from './types';
import { mergeObjects } from './utils/utils';

Expand Down Expand Up @@ -29,6 +30,25 @@ export const testsConfig: TestsConfig = mergeObjects(envConfig, defaultConfig);
export const routes = {
base: testsConfig.BASE_URL,
me: '/me',
profile: '/user/',
tab: {
details: '?tab=details',
devices: '?tab=devices',
authentication_keys: '?tab=auth-keys',
api_tokens: '?tab=api-tokens',
},
firewall: {
rules: '/acl/rules',
aliases: '/acl/aliases',
},
locations: '/locations',
network_devices: '/network-devices',
openid_apps: '/openid',
webhooks: '/webhooks',
identity: {
users: '/users',
groups: '/groups',
},
consent: '/consent',
addDevice: '/add-device',
auth: {
Expand All @@ -37,6 +57,14 @@ export const routes = {
recovery: '/auth/mfa/recovery',
email: '/auth/mfa/email',
},
settings: {
base: '/settings',
smtp: '/settings/smtp',
openid: '/settings/openid',
tab: {
openid: '/settings?tab=openid',
},
},
admin: {
wizard: '/admin/wizard',
users: '/admin/users',
Expand Down
4 changes: 2 additions & 2 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"main": "index.js",
"type": "commonjs",
"scripts": {
"lint": "pnpm prettier --check ./tests/**.ts ./utils/**/*.ts && pnpm eslint ./tests/**.ts ./utils/**/*.ts",
"fix": "pnpm prettier -w ./tests/**/*.ts ./utils/**/*.ts && pnpm eslint --fix ./tests/**/*.ts ./utils/**/*.ts",
"lint": "pnpm prettier --check './tests/**.ts' './utils/**/*.ts' && pnpm eslint './tests/**.ts' './utils/**/*.ts'",
"fix": "pnpm prettier -w './tests/**/*.ts' './utils/**/*.ts' && pnpm eslint --fix ./tests/**/*.ts ./utils/**/*.ts",
"test": "pnpm playwright test"
},
"keywords": [],
Expand Down
8 changes: 3 additions & 5 deletions e2e/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig, devices, FullConfig, ReporterDescription } from '@playwright/test';
import { defineConfig, devices, ReporterDescription } from '@playwright/test';

import { routes, testsConfig } from './config';
import { loadEnv } from './utils/loadEnv';
Expand All @@ -25,15 +25,14 @@ if (process.env.SHOW_REPORT) {
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
timeout: process.env.CI ? testsConfig.TEST_TIMEOUT * 1000 : 180_000,
timeout: testsConfig.TEST_TIMEOUT * 1000,
testDir: './tests',
/* Run tests in files in parallel */
fullyParallel: false,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
maxFailures: process.env.CI ? 1 : undefined,
workers: 1,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: reporter,
Expand All @@ -50,8 +49,7 @@ export default defineConfig({
permissions: ['clipboard-read', 'clipboard-write'],
},
},
globalTeardown: require.resolve('./utils/teardown'),
globalSetup: require.resolve('./utils/setup'),

/* Configure projects for major browsers */
projects: [
{
Expand Down
32 changes: 32 additions & 0 deletions e2e/tests/acl.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { expect, test } from '@playwright/test';

import { defaultUserAdmin, routes } from '../config';
import { Protocols } from '../types';
import { createAlias } from '../utils/acl';
import { loginBasic } from '../utils/controllers/login';
import { dockerRestart } from '../utils/docker';

test.describe('Test aliases', () => {
// let testUser: User;

test.beforeEach(() => {
dockerRestart();
// testUser = { ...testUserTemplate, username: 'test' };
});

test('Create alias and check content', async ({ page, browser }) => {
const name = 'TestAlias';
const addresses = ['1.2.3.4/24', '10.10.10.10/20', '1.2.4.2'];
const ports = ['80', '443'];
const protocols = [Protocols.UDP, Protocols.ICMP];
await createAlias(browser, name, addresses, ports, protocols);
await loginBasic(page, defaultUserAdmin);
await page.goto(routes.base + routes.firewall.aliases);
const aliasRow = await page.locator('.virtual-row').filter({ hasText: name });
await expect(aliasRow).toBeVisible();
await expect(aliasRow).toContainText(addresses.join(', '));
await expect(aliasRow).toContainText(ports.join(', '));
await expect(aliasRow).toContainText(Protocols.UDP);
await expect(aliasRow).toContainText(Protocols.ICMP);
});
});
Loading