Skip to content

Commit 74ec14f

Browse files
committed
update testing docs
1 parent 43c1a6d commit 74ec14f

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

plugins/wpgraphql-logging/TESTING.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ tests/
4545
├── _envs/ # Environment configs
4646
├── _output/ # Test output (logs, coverage)
4747
├── _support/ # Helper classes, modules
48+
├── e2e/ # End-to-end tests (Playwright)
49+
│ ├── specs/ # Test specifications
50+
│ │ ├── basic-usage.spec.js
51+
│ │ ├── data-cleanup.spec.js
52+
│ │ └── exclude-and-sanitize.spec.js
53+
│ ├── plugins/ # Test helper plugins
54+
│ ├── config/ # E2E test configuration
55+
│ ├── utils.js # Helper functions
56+
│ ├── constants.js # Test constants
57+
│ └── playwright.config.js # Playwright configuration
4858
├── wpunit/ # WPUnit (WordPress-aware unit/integration) test cases
4959
├── wpunit.suite.dist.yml
5060
└── wpunit/
@@ -95,6 +105,40 @@ Automated testing runs on every pull request via GitHub Actions for a modified p
95105
| **Codeception (WPUnit)** | Runs unit and integration tests | [View Workflow](../../actions/workflows/codeception.yml) |
96106

97107

108+
## E2E Tests
109+
110+
End-to-end tests use Playwright to simulate real user workflows from configuring the plugin to viewing logs and managing data.
111+
112+
### Test Suites
113+
114+
| Test Suite | Description | Key Scenarios |
115+
| -------------------------------- | -------------------------------- | -------------------------------------------------------- |
116+
| **basic-usage.spec.js** | Core logging functionality | Enable logging, execute queries, view logs, download CSV |
117+
| **exclude-and-sanitize.spec.js** | Query filtering and data privacy | Exclude queries, sanitize sensitive data |
118+
| **data-cleanup.spec.js** | Data management | Configure automatic log deletion, verify cron job |
119+
120+
### Test Helper Plugins
121+
122+
Located in `tests/e2e/plugins/`:
123+
124+
- **`reset-wpgraphql-logging-settings`** - Resets plugin settings and clears logs table for clean test state
125+
126+
### Running E2E Tests
127+
128+
```shell
129+
# Start wp-env (make sure Docker is running)
130+
npm run wp-env start
131+
132+
# Run all E2E tests
133+
npm run test:e2e
134+
135+
# Run specific test file
136+
npm run test:e2e tests/e2e/specs/basic-usage.spec.js
137+
138+
# Run tests in headed mode (with browser UI)
139+
npm run test:e2e:debug
140+
```
141+
98142
>[!IMPORTANT]
99143
> Test coverage for WP Unit Tests is **95%**. Any new code will require tests to be added in order to pass CI checks. This is set in [text](codeception.dist.yml) in the parameter `min_coverage`.
100144

0 commit comments

Comments
 (0)