Skip to content
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/mvn-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,64 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARCADEDB_DOCKER_IMAGE: ${{ needs.build-and-package.outputs.image-tag }}

studio-e2e-tests:
runs-on: ubuntu-latest
needs: build-and-package
permissions:
contents: read
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Set up Node
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "22"
cache: "npm"
cache-dependency-path: "e2e-studio/package-lock.json"

- name: Restore Docker image
uses: actions/cache/restore@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: /tmp/arcadedb-image.tar
key: docker-image-${{ github.run_id }}-${{ github.run_attempt }}

- name: Load Docker image
run: docker load < /tmp/arcadedb-image.tar

- name: Install Playwright Browsers
working-directory: e2e-studio
run: |
npm install
npm run install-browsers

- name: E2E Studio Tests
working-directory: e2e-studio
run: |
npm run test --headless
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARCADEDB_DOCKER_IMAGE: ${{ needs.build-and-package.outputs.image-tag }}

- name: Studio E2E Tests Reporter
uses: dorny/test-reporter@890a17cecf52a379fc869ab770a71657660be727 # v2.1.0
if: success() || failure()
with:
name: Studio E2E Tests Report
path: "e2e-studio/test-results/junit-report.xml"
list-suites: "failed"
list-tests: "failed"
reporter: java-junit

- name: Upload Studio E2E test artifacts
if: success() || failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: studio-e2e-artifacts
path: |
e2e-studio/test-results/
e2e-studio/playwright-report/
retention-days: 7

python-e2e-tests:
runs-on: ubuntu-latest
needs: build-and-package
Expand Down
64 changes: 64 additions & 0 deletions e2e-studio/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# ArcadeDB Studio E2E Tests

This directory contains end-to-end tests for ArcadeDB Studio using Playwright.

## Setup

1. Install dependencies:
```bash
npm install
```

2. Install Playwright browsers:
```bash
npx playwright install
```

## Prerequisites

- ArcadeDB server running on `http://localhost:2480`
- Server configured with username: `root` and password: `playwithdata`
- Beer database with sample data available

## Running Tests

### Local Development (with Docker)
```bash
# Run tests with automatic server management
npm run test:local

# Run tests in headed mode (visible browser)
npm run test:headed

# Debug tests
npm run test:debug
```

### CI Environment
```bash
# Install browsers for CI
npm run install-browsers

# Run tests (assumes ArcadeDB server is already running)
npm test
```

**Note**: In CI, the tests include a global setup that validates server connectivity before running tests. This helps identify server startup issues early.

## Test Files

- `tests/create-database.spec.ts` - Tests database creation functionality
- `tests/query-beer-database.spec.ts` - Tests Beer database querying and graph visualization

## Configuration

- `playwright.config.ts` - Playwright configuration with CI/local mode support
- `package.json` - Project dependencies and scripts

## CI Integration

The tests are configured to work in GitHub Actions CI:
- Uses JUnit reporter for test result reporting
- Assumes external server management (no webServer configuration)
- Headless mode with failure screenshots and videos
- Generates test artifacts for debugging failures
51 changes: 51 additions & 0 deletions e2e-studio/global-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { chromium, FullConfig } from '@playwright/test';

async function globalSetup(config: FullConfig) {
console.log('🔍 Checking if ArcadeDB server is available...');

const browser = await chromium.launch();
const page = await browser.newPage();

try {
// Try to connect to the server with retries
const maxRetries = 30; // 30 retries = 60 seconds max wait
let retries = 0;

while (retries < maxRetries) {
try {
console.log(`⏳ Attempt ${retries + 1}/${maxRetries} - Checking server connectivity...`);

// Try to reach the health endpoint first
const response = await page.request.get('http://localhost:2480/api/v1/ready', {
timeout: 2000
});

if (response.status() === 204) {
console.log('✅ Server health check passed');

// Now try to load the Studio interface
await page.goto('http://localhost:2480', { timeout: 5000 });
console.log('✅ ArcadeDB Studio is accessible');
break;
}
} catch (error) {
retries++;
if (retries >= maxRetries) {
console.error('❌ Failed to connect to ArcadeDB server after maximum retries');
console.error('🔧 Make sure ArcadeDB server is running on http://localhost:2480');
console.error('💡 Original error:', error.message);
throw new Error('ArcadeDB server is not accessible');
}

console.log(`⏱️ Server not ready, waiting 2 seconds before retry...`);
await new Promise(resolve => setTimeout(resolve, 2000));
}
}
} finally {
await browser.close();
}

console.log('🚀 Global setup completed successfully');
}

export default globalSetup;
Loading
Loading