Skip to content

Commit 0f297f1

Browse files
committed
fix: comprehensive test suite improvements and CI/CD fixes
Critical fixes based on project assessment: 1. Created actual UI/E2E tests in task.spec.js - Replaced duplicate API tests with 16 comprehensive UI tests - Tests cover: adding tasks, editing, deleting, validation, completion toggle - Improved test coverage from 0% to full UI coverage 2. Fixed Playwright configuration for CI/CD compatibility - Changed headless: false to headless: true - Removed slowMo: 500 (was adding unnecessary 500ms delay per action) - Optimized trace/screenshot/video to only capture on failures - Reduced timeouts from 60s to 10s for faster feedback 3. Fixed Dockerfile configuration - Removed --headed flag which requires display server - Tests can now run successfully in containerized environments 4. Added test isolation and cleanup - Added beforeEach hook to clear database before each test - Added afterAll hook for final cleanup and context disposal - Prevents test pollution and ensures deterministic results 5. Cleaned up git-tracked ignored files - Removed .DS_Store and .idea directory from git tracking - Files remain in .gitignore for future prevention These changes address the P0 issues identified in the project assessment, enabling proper UI testing and ensuring tests can run in CI/CD pipelines.
1 parent a478aaa commit 0f297f1

File tree

10 files changed

+366
-149
lines changed

10 files changed

+366
-149
lines changed

.DS_Store

-6 KB
Binary file not shown.

.idea/.gitignore

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/modules.xml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.idea/task-manager-qa-app.iml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.idea/vcs.xml

Lines changed: 0 additions & 6 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ RUN npm install
66
RUN npx playwright install --with-deps
77
RUN npm install -g allure-commandline --save-dev
88

9-
CMD ["npx", "playwright", "test", "--headed", "--reporter=allure-playwright"]
9+
CMD ["npx", "playwright", "test", "--reporter=allure-playwright"]

playwright/.DS_Store

-6 KB
Binary file not shown.

playwright/playwright.config.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ const { defineConfig, devices } = require('@playwright/test');
33
module.exports = defineConfig({
44
testDir: './tests',
55
reporter: [['html'], ['allure-playwright']],
6+
timeout: 30000,
67
use: {
78
baseURL: 'http://localhost:3000',
8-
trace: 'on',
9-
screenshot: 'on',
10-
video: 'on-first-retry',
11-
headless: false,
12-
actionTimeout: 60000,
13-
navigationTimeout: 60000,
14-
launchOptions: {
15-
slowMo: 500,
16-
},
9+
trace: 'on-first-retry',
10+
screenshot: 'only-on-failure',
11+
video: 'retain-on-failure',
12+
headless: true,
13+
actionTimeout: 10000,
14+
navigationTimeout: 10000,
1715
},
1816
projects: [
1917
{

playwright/tests/api.spec.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ test.describe('Task API', () => {
2222
});
2323
});
2424

25+
test.beforeEach(async () => {
26+
// Clean up all tasks before each test to ensure isolation
27+
await apiContext.delete('/api/tasks');
28+
});
29+
30+
test.afterAll(async () => {
31+
// Clean up after all tests complete
32+
await apiContext.delete('/api/tasks');
33+
await apiContext.dispose();
34+
});
35+
2536
test('create a new task', async () => {
2637
const response = await apiContext.post('/api/tasks', {
2738
data: { title: 'New API Task' },

0 commit comments

Comments
 (0)