Skip to content

Commit 769d395

Browse files
author
danil-nizamov
committed
updated integration tests
1 parent 33d9be1 commit 769d395

File tree

3 files changed

+50
-5
lines changed

3 files changed

+50
-5
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858

5959
- name: Run integration tests
6060
working-directory: ./tests
61-
run: npm run test:integration
61+
run: timeout 10m npm run test:integration
6262

6363
- name: Upload test results
6464
uses: actions/upload-artifact@v4
@@ -99,4 +99,4 @@ jobs:
9999

100100
- name: Run integration tests
101101
working-directory: ./tests
102-
run: npm run test:integration
102+
run: timeout 10m npm run test:integration

tests/integration/smoke.spec.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Smoke test to verify the application loads correctly
2+
const { test, expect } = require('@playwright/test');
3+
4+
test.describe('Smoke Tests', () => {
5+
test('should load the application', async ({ page }) => {
6+
// Navigate to the application
7+
await page.goto('/');
8+
9+
// Wait for the page to load
10+
await page.waitForLoadState('networkidle');
11+
12+
// Check if the main elements are present
13+
await expect(page.locator('h1')).toContainText('DB Schema Designer');
14+
await expect(page.locator('#diagram')).toBeVisible();
15+
await expect(page.locator('#sidebar')).toBeVisible();
16+
17+
// Check if the form elements are present
18+
await expect(page.locator('#nt-name')).toBeVisible();
19+
await expect(page.locator('button[type="submit"]')).toContainText('Add Table');
20+
});
21+
22+
test('should have working JavaScript', async ({ page }) => {
23+
await page.goto('/');
24+
25+
// Check if the UI functions are available
26+
const uiAvailable = await page.evaluate(() => {
27+
return typeof window.UI !== 'undefined' &&
28+
typeof window.Diagram !== 'undefined';
29+
});
30+
31+
expect(uiAvailable).toBe(true);
32+
});
33+
});

tests/playwright.config.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,24 @@ module.exports = defineConfig({
55
testDir: './integration',
66
fullyParallel: true,
77
forbidOnly: !!process.env.CI,
8-
retries: process.env.CI ? 2 : 0,
9-
workers: process.env.CI ? 1 : undefined,
8+
retries: process.env.CI ? 1 : 0,
9+
workers: process.env.CI ? 2 : undefined,
10+
timeout: 30 * 1000, // 30 seconds per test
1011
reporter: 'html',
1112
use: {
1213
baseURL: 'http://localhost:3000',
1314
trace: 'on-first-retry',
15+
actionTimeout: 10 * 1000, // 10 seconds for actions
16+
navigationTimeout: 30 * 1000, // 30 seconds for navigation
1417
},
15-
projects: [
18+
projects: process.env.CI ? [
19+
// In CI, only run chromium for speed
20+
{
21+
name: 'chromium',
22+
use: { ...devices['Desktop Chrome'] },
23+
},
24+
] : [
25+
// In local development, run all browsers
1626
{
1727
name: 'chromium',
1828
use: { ...devices['Desktop Chrome'] },
@@ -31,5 +41,7 @@ module.exports = defineConfig({
3141
url: 'http://localhost:3000',
3242
reuseExistingServer: !process.env.CI,
3343
timeout: 120 * 1000, // 2 minutes
44+
stdout: 'pipe',
45+
stderr: 'pipe',
3446
},
3547
});

0 commit comments

Comments
 (0)