E2E regression tests and performance test suite - #1689
Merged
Conversation
Contributor
|
🔄 AI PR Review sedang antri di server...
|
…feat/e2e_regression
Contributor
|
Pengujian untuk PR #1689 (End-to-end (E2E) dan Performance testing untuk alur sinkronisasi data) telah dilakukan dan diverifikasi dengan hasil sebagai berikut: 1. Perbaikan Migrasi & Konfigurasi Testing
2. Hasil Pengujian E2E Browser (
|
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request: feat: Add E2E regression tests and performance test suite
Description
Menambahkan pengujian E2E (Pest Browser) untuk memvalidasi alur pengguna lengkap: admin login, konfigurasi API key OpenDK di pengaturan, dan pengiriman data sync ke OpenDK. Selain itu, menambahkan skrip performa/regresi menggunakan k6 untuk pengujian beban terhadap endpoint sync inti dengan validasi p95 latency dan error rate threshold. Menghapus dependensi Playwright yang tidak terpakai dan menggantinya dengan Pest Browser + k6.
Changes made:
tests/Browser/SyncFlowTest.php— 8 test case Pest Browser yang mencakup happy path (generate token via UI + trigger sync), 4 negative cases (invalid token, revoked token, no token, malformed token), payload verification, dan full UI flow verification terhadap database.tests/performance/—config.js(konfigurasi threshold p95 < 500ms, error rate < 0.1%, VUs),helpers/auth.js(login + JWT auth helper),load-test.js(load test terhadap login, penduduk sync, identitas-desa, pesan, surat), danrate-limit-test.js(verifikasi rate limiter 60 req/min)..github/workflows/performance.yml— workflow GitHub Actions yang menjalankan k6 secara terjadwal (cron malam), on push ke master (dengan tag[perf]), atau manual dispatch. Menyiapkan MySQL, Laravel server, dan seed admin user secara otomatis.data-testidattributes ke login form (login.blade.php), settings pages (setting/aplikasi/index.blade.php,edit.blade.php,form.blade.php,generate_key.blade.php), dan button partial (button_reset_submit.blade.php) untuk mendukung Pest Browser selectors.@playwright/testdanplaywrightdaripackage.jsondevDependencies/dependencies. Menambahkan npm scripts:test:browser:sync,test:perf,test:perf:rate-limit,test:perf:ci.report.json,rate-limit-report.json,k6-results.json) ke.gitignore.Reason for change:
Impact of change:
✅ Testing coverage: E2E test mencakup happy path + 4 negative cases sesuai acceptance criteria issue #1677.
✅ Performance monitoring: k6 test memberikan metrics p95 latency dan error rate yang terintegrasi ke GitHub Actions.
✅ CI/CD pipeline: Performance test berjalan terjadwal (nightly) dan on-demand, memberikan visibilitas regresi performa.
✅ Reduced dependencies: Penghapusan Playwright mengurangi attack surface dan CI install time.
Related Issue
Steps to Reproduce
Before (no E2E/performance tests):
After (with this PR):
php artisan test --testsuite=Browser --group=sync-flowuntuk menjalankan semua E2E test.k6 run tests/performance/load-test.jsuntuk menjalankan load test.k6 run tests/performance/rate-limit-test.jsuntuk menguji rate limiter.Testing on related features:
Checklist
Http::fake)Technical Details
Technical Explanation
E2E Test (
SyncFlowTest.php):BrowserTestCasedanSessionStateyang sudah ada di project.Http::fake()digunakan untuk mem-mock external HTTP kepantau.opensid.my.id, sehingga test bisa berjalan tanpa koneksi internet.data-testidselectors untuk navigasi UI yang stabil.Tymon\JWTAuthdan di-persist kedas_settingtable.Performance Test (k6):
load-test.jsmenjalankan 5 endpoint (login, penduduk sync, identitas-desa, pesan, surat) dengan configurable VUs dan duration.http_req_duration p(95) < 500msdanhttp_req_failed rate < 0.001. Test akanabortOnFailjika threshold terlampaui.rate-limit-test.jsmengirim 70 req/min selama 2 menit untuk memverifikasi 429 response setelah batas 60 req/min tercapai.handleSummary()menghasilkan JSON report untuk artifact upload di CI.GitHub Actions (
performance.yml):0 2 * * *(nightly), push ke master dengan[perf]di commit message, atau manual dispatch.Configuration changes
package.json: Menghapus scriptstest:e2e*(Playwright) dan menambahkantest:browser:sync,test:perf*(k6)..gitignore: Menambahkan pattern k6 report files.data-testidattributes (tidak mengubah behavior).Dependencies added
grafana/install-k6-action@v1di CI (v0.49.0)Dependencies removed
@playwright/test^1.56.1 (devDependencies)playwright^1.58.2 (dependencies)Testing
Manual Testing
npm run test:browser:sync— semua 8 test harus passnpm run test:perf— pastikan p95 < 500ms dan error rate < 0.1%npm run test:perf:rate-limit— pastikan rate limiter mengembalikan 429 setelah 60 reqAutomated Testing
SyncFlowTest(8 test cases)load-test.js(5 endpoint)rate-limit-test.js(1 scenario).github/workflows/performance.ymlBrowser Compatibility (if applicable)
Screenshots / Video
Breaking Changes
None
Migration Guide
Not required
References
Additional notes:
Http::fake()sehingga tidak membutuhkan koneksi ke server OpenDK asli. Untuk testing di lingkungan staging, ubahfakeExternalHttp()menjadiHttp::preventStrayRequests().K6_P95_THRESHOLD_MS,K6_ERROR_RATE_THRESHOLD,K6_VUS,K6_DURATION.master(bukanrilis-dev). Pertimbangkan untuk menambahkan branch target jika diperlukan.