@sergey_butkevich/portal-app-acceptance-tests
v0.1.0
Published
Playwright automated E2E tests for Portal App student project validation
Maintainers
Readme
Portal App Acceptance Tests
A set of automated E2E tests using Playwright for validating student project Portal App implementation.
📋 Description
This package contains acceptance tests that students can use to verify the correctness of their Portal App project implementation. The tests cover core functional requirements of the project.
🧪 Test Coverage
- Registration (
registration.spec.ts) - user registration flow - Authentication (
login.spec.ts) - login functionality - Profile (
profile.spec.ts) - user profile management - Contacts (
contacts.spec.ts) - contact management - Permissions (
permissions.spec.ts) - access rights verification - Impersonation (
impersonation.spec.ts) - impersonating other users - Admin Panel (
admin-access.spec.ts) - administrative functions access - Super Admin (
super-admin.spec.ts) - super admin features - Password Recovery (
forgot-password.spec.ts) - password reset process
📦 Installation
npm install --save-dev @sergey_butkevich/portal-app-acceptance-testsили
yarn add -D @sergey_butkevich/portal-app-acceptance-tests⚙️ Prerequisites
- Node.js >= 16
- Playwright >= 1.40.0
🚀 Usage
1. Install Playwright (if not already installed)
npm install --save-dev @playwright/test
npx playwright install2. Create configuration file
Create a playwright.config.ts file in the root of your project:
import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './node_modules/@sergey_butkevich/portal-app-acceptance-tests/tests',
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
reporter: 'html',
use: {
baseURL: 'http://localhost:3000', // Your application URL
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
webServer: {
command: 'npm run dev', // command to start your application
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
});3. Run tests
All tests:
npx playwright testSpecific test suite:
npx playwright test node_modules/@sergey_butkevich/portal-app-acceptance-tests/tests/registration.spec.tsWith UI mode:
npx playwright test --uiIn headed mode (with visible browser):
npx playwright test --headed4. View report
npx playwright show-report📝 Environment Variables
Tests can use the following environment variables:
BASE_URL=http://localhost:3000 # Your application URLCreate a .env file in the project root for local development.
🔧 Configure baseURL
Make sure the correct baseURL is specified in your Playwright configuration:
use: {
baseURL: 'http://localhost:3000',
}📖 Test Documentation
Detailed description of each test suite is available in TEST-SUITES-README.md.
🤝 Project Requirements
Your application must:
- Be accessible at the specified
baseURL - Have all required pages and forms
- Handle requests correctly
- Have proper element selectors (data-testid, role, text)
🐛 Debugging
If tests fail:
- Verify the application is running and accessible
- Ensure the correct
baseURLis being used - Run tests in debug mode:
npx playwright test --debug - Check screenshots and traces in the
test-results/folder
📄 License
ISC
👨💻 Author
Serge Butkevich
