|
| 1 | +# ZKEACMS End-to-End Testing Project |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +This is an End-to-End (E2E) testing project for the ZKEACMS Content Management System. It uses Playwright as the testing framework to validate the functionality of the ZKEACMS admin interface, specifically focusing on page management capabilities. |
| 6 | + |
| 7 | +The project contains automated tests that simulate user interactions with the ZKEACMS admin panel, particularly around page creation, editing, and publishing functionality. |
| 8 | + |
| 9 | +## Technology Stack |
| 10 | + |
| 11 | +- **Testing Framework**: Playwright (v1.56.1) |
| 12 | +- **Language**: TypeScript |
| 13 | +- **Package Manager**: npm |
| 14 | +- **Target Application**: ZKEACMS |
| 15 | + |
| 16 | +## Project Structure |
| 17 | + |
| 18 | +``` |
| 19 | +test/End-To-End/ |
| 20 | +├── package.json # Project dependencies and configuration |
| 21 | +├── playwright.config.ts # Playwright configuration |
| 22 | +├── src/ # Page object models and helper classes |
| 23 | +│ ├── admin/ # Admin-specific page models |
| 24 | +│ │ ├── PageDashboardPage.ts # Page dashboard model |
| 25 | +│ │ └── PageFormPage.ts # Page form model |
| 26 | +│ └── models/ # Base page models |
| 27 | +│ └── AdminPageBase.ts # Base admin page class |
| 28 | +├── tests/ # Test specifications |
| 29 | +│ ├── example.spec.ts # Example test file |
| 30 | +│ └── admin/ |
| 31 | +│ └── page/ |
| 32 | +│ └── 01-basic-function-test.spec.ts # Basic page functionality tests |
| 33 | +├── node_modules/ # Dependencies (generated) |
| 34 | +├── playwright-report/ # Test reports (generated) |
| 35 | +└── test-results/ # Test results (generated) |
| 36 | +``` |
| 37 | + |
| 38 | +## Configuration |
| 39 | + |
| 40 | +The Playwright configuration is set up with: |
| 41 | +- Tests run in parallel across multiple browsers (Chromium, Firefox, Webkit) |
| 42 | +- Retry logic for failed tests |
| 43 | +- HTML reporter for test results |
| 44 | +- Trace collection on first retry for debugging |
| 45 | + |
| 46 | +## Key Functionality Tested |
| 47 | + |
| 48 | +### Page Creation Tests |
| 49 | +- Creating pages with required fields |
| 50 | +- Handling validation errors for missing fields |
| 51 | +- Publishing pages without widgets |
| 52 | + |
| 53 | +### Admin Authentication |
| 54 | +- Login functionality with username/password |
| 55 | +- Session management |
| 56 | + |
| 57 | +### Page Object Models |
| 58 | + |
| 59 | +#### AdminPageBase |
| 60 | +- Base class containing common admin functionality |
| 61 | +- Login and logout methods |
| 62 | +- Provides authentication for admin operations |
| 63 | + |
| 64 | +#### PageFormPage |
| 65 | +- Handles page creation form interactions |
| 66 | +- Fills page details like name, title, path, layout, etc. |
| 67 | +- Submits forms and verifies creation results |
| 68 | +- Supports publishing pages from the design view |
| 69 | + |
| 70 | +#### PageDashboardPage |
| 71 | +- Manages interactions with the page dashboard |
| 72 | +- Navigates to the page management area |
| 73 | +- Waits for data loading |
| 74 | + |
| 75 | +## Running Tests |
| 76 | + |
| 77 | +To run the tests locally: |
| 78 | + |
| 79 | +1. Ensure you have Node.js installed |
| 80 | +2. Install dependencies: |
| 81 | + ``` |
| 82 | + npm install |
| 83 | + ``` |
| 84 | +3. Run all tests: |
| 85 | + ``` |
| 86 | + npx playwright test |
| 87 | + ``` |
| 88 | +4. Run tests in UI mode: |
| 89 | + ``` |
| 90 | + npx playwright test --ui |
| 91 | + ``` |
| 92 | +5. Run tests for a specific browser: |
| 93 | + ``` |
| 94 | + npx playwright test --project=chromium |
| 95 | + ``` |
| 96 | + |
| 97 | +To run tests against a local instance of ZKEACMS instead of the demo site, update the baseURL in `playwright.config.ts` to point to your local installation. |
| 98 | + |
| 99 | +## Development Conventions |
| 100 | + |
| 101 | +- Tests follow the Page Object Model pattern for better maintainability |
| 102 | +- TypeScript interfaces are used to define data structures (e.g., PageFormData) |
| 103 | +- Each test file should focus on a specific set of functionality |
| 104 | +- Tests use meaningful names that describe the functionality being tested |
| 105 | +- Wait strategies are implemented to handle asynchronous operations properly |
| 106 | +- Credentials are managed using environment variables for security |
| 107 | + |
| 108 | +## Credential Management |
| 109 | + |
| 110 | +For security reasons, the tests now support the following approaches for authentication: |
| 111 | + |
| 112 | +1. **Environment Variables**: Set `ADMIN_USERNAME` and `ADMIN_PASSWORD` environment variables |
| 113 | +2. **Fallback Credentials**: If environment variables aren't set, the system defaults to 'admin'/'admin' |
| 114 | + |
| 115 | +To use custom credentials, create a `.env` file or set the environment variables: |
| 116 | + |
| 117 | +``` |
| 118 | +ADMIN_USERNAME=your_username |
| 119 | +ADMIN_PASSWORD=your_password |
| 120 | +``` |
| 121 | + |
| 122 | +An example file `.env.example` has been provided as a template. |
| 123 | + |
| 124 | +## Current Test Coverage |
| 125 | + |
| 126 | +The current tests validate: |
| 127 | + |
| 128 | +1. **Page Creation**: Creating a page with all required fields |
| 129 | +2. **Form Validation**: Ensuring required fields are validated |
| 130 | +3. **Page Publishing**: Publishing a page without widgets to make it public |
| 131 | +4. **Admin Authentication**: Logging into the admin panel using secure credential management |
| 132 | + |
| 133 | +## Reporting |
| 134 | + |
| 135 | +- Test results are stored in the `test-results/` directory |
| 136 | +- HTML reports can be generated to `playwright-report/` directory |
| 137 | +- Trace files are collected on first retry to help debug failed tests |
0 commit comments