Implements automatic creation of required plugin pages (Community Login, Trainer Registration, Trainer Dashboard) upon plugin activation. This addresses E2E test failures caused by missing pages in the test environment. - Adds activation hook in `hvac-community-events.php` to call `hvac_ce_create_required_pages`. - The callback function checks for existing pages by slug and creates them using `wp_insert_post` if missing. Includes debug logging. Also fixes issues identified during E2E test debugging: - Corrects fatal error in `includes/community/class-login-handler.php` by replacing undefined constant `HVAC_COMMUNITY_EVENTS_PATH` with `HVAC_CE_PLUGIN_DIR`. - Updates `tests/e2e/tests/login.spec.ts` to use the correct selector `#wp-submit` for the login form submit button instead of `button[type="submit"]`. Documentation updates: - Adds `docs/automatic-page-creation-plan.md`. - Updates `README.md` regarding automatic page creation. - Updates Memory Bank files (`decisionLog.md`, `progress.md`, `activeContext.md`). Note: Activation hook logging did not appear during WP-CLI activation, requiring further investigation if page creation issues persist. E2E test confirmation pending.
131 lines
No EOL
7.4 KiB
XML
131 lines
No EOL
7.4 KiB
XML
<testsuites id="" name="" tests="4" failures="4" skipped="0" errors="0" time="108.12987799999999">
|
||
<testsuite name="login.spec.ts" timestamp="2025-03-28T20:13:49.315Z" hostname="chromium" tests="4" failures="4" skipped="0" time="99.003" errors="0">
|
||
<testcase name="Login Functionality @login › displays login form" classname="login.spec.ts" time="8.429">
|
||
<failure message="login.spec.ts:8:7 displays login form" type="FAILURE">
|
||
<![CDATA[ [chromium] › login.spec.ts:8:7 › Login Functionality @login › displays login form ────────────────
|
||
|
||
Error: Timed out 5000ms waiting for expect(locator).toBeVisible()
|
||
|
||
Locator: locator('button[type="submit"]')
|
||
Expected: visible
|
||
Received: <element(s) not found>
|
||
Call log:
|
||
- expect.toBeVisible with timeout 5000ms
|
||
- waiting for locator('button[type="submit"]')
|
||
|
||
|
||
11 | await expect(page.locator('input[name="pwd"]')).toBeVisible(); // Default WP password field
|
||
12 | await expect(page.locator('input[name="rememberme"]')).toBeVisible(); // Default WP remember field
|
||
> 13 | await expect(page.locator('button[type="submit"]')).toBeVisible();
|
||
| ^
|
||
14 | });
|
||
15 |
|
||
16 | test('shows error on invalid credentials', async ({ page }) => {
|
||
at /Users/ben/dev/upskill-event-manager/wordpress-dev/tests/e2e/tests/login.spec.ts:13:57
|
||
|
||
attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
|
||
test-results/login-Login-Functionality-login-displays-login-form-chromium/test-failed-1.png
|
||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||
]]>
|
||
</failure>
|
||
<system-out>
|
||
<![CDATA[
|
||
[[ATTACHMENT|../../test-results/login-Login-Functionality-login-displays-login-form-chromium/test-failed-1.png]]
|
||
]]>
|
||
</system-out>
|
||
</testcase>
|
||
<testcase name="Login Functionality @login › shows error on invalid credentials" classname="login.spec.ts" time="30.26">
|
||
<failure message="login.spec.ts:16:7 shows error on invalid credentials" type="FAILURE">
|
||
<![CDATA[ [chromium] › login.spec.ts:16:7 › Login Functionality @login › shows error on invalid credentials
|
||
|
||
Test timeout of 30000ms exceeded.
|
||
|
||
Error: page.click: Test timeout of 30000ms exceeded.
|
||
Call log:
|
||
- waiting for locator('button[type="submit"]')
|
||
|
||
|
||
17 | await page.fill('input[name="log"]', 'invalid@example.com');
|
||
18 | await page.fill('input[name="pwd"]', 'wrongpassword');
|
||
> 19 | await page.click('button[type="submit"]');
|
||
| ^
|
||
20 |
|
||
21 | await expect(page.locator('.hvac-login-error')).toContainText('Invalid username or password'); // Use error div from template
|
||
22 | });
|
||
at /Users/ben/dev/upskill-event-manager/wordpress-dev/tests/e2e/tests/login.spec.ts:19:16
|
||
|
||
attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
|
||
test-results/login-Login-Functionality--5805a-rror-on-invalid-credentials-chromium/test-failed-1.png
|
||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||
]]>
|
||
</failure>
|
||
<system-out>
|
||
<![CDATA[
|
||
[[ATTACHMENT|../../test-results/login-Login-Functionality--5805a-rror-on-invalid-credentials-chromium/test-failed-1.png]]
|
||
]]>
|
||
</system-out>
|
||
</testcase>
|
||
<testcase name="Login Functionality @login › redirects to dashboard on successful login" classname="login.spec.ts" time="30.132">
|
||
<failure message="login.spec.ts:24:7 redirects to dashboard on successful login" type="FAILURE">
|
||
<![CDATA[ [chromium] › login.spec.ts:24:7 › Login Functionality @login › redirects to dashboard on successful login
|
||
|
||
Test timeout of 30000ms exceeded.
|
||
|
||
Error: page.click: Test timeout of 30000ms exceeded.
|
||
Call log:
|
||
- waiting for locator('button[type="submit"]')
|
||
|
||
|
||
25 | await page.fill('input[name="log"]', process.env.WP_ADMIN_USER || 'devadmin');
|
||
26 | await page.fill('input[name="pwd"]', process.env.WP_ADMIN_PASSWORD || '');
|
||
> 27 | await page.click('button[type="submit"]');
|
||
| ^
|
||
28 |
|
||
29 | await expect(page).toHaveURL(/.*hvac-dashboard/); // Correct dashboard slug
|
||
30 | });
|
||
at /Users/ben/dev/upskill-event-manager/wordpress-dev/tests/e2e/tests/login.spec.ts:27:16
|
||
|
||
attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
|
||
test-results/login-Login-Functionality--0d214-shboard-on-successful-login-chromium/test-failed-1.png
|
||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||
]]>
|
||
</failure>
|
||
<system-out>
|
||
<![CDATA[
|
||
[[ATTACHMENT|../../test-results/login-Login-Functionality--0d214-shboard-on-successful-login-chromium/test-failed-1.png]]
|
||
]]>
|
||
</system-out>
|
||
</testcase>
|
||
<testcase name="Login Functionality @login › remembers login state" classname="login.spec.ts" time="30.182">
|
||
<failure message="login.spec.ts:32:7 remembers login state" type="FAILURE">
|
||
<![CDATA[ [chromium] › login.spec.ts:32:7 › Login Functionality @login › remembers login state ─────────────
|
||
|
||
Test timeout of 30000ms exceeded.
|
||
|
||
Error: page.click: Test timeout of 30000ms exceeded.
|
||
Call log:
|
||
- waiting for locator('button[type="submit"]')
|
||
|
||
|
||
34 | await page.fill('input[name="pwd"]', process.env.WP_ADMIN_PASSWORD || '');
|
||
35 | await page.check('input[name="rememberme"]');
|
||
> 36 | await page.click('button[type="submit"]');
|
||
| ^
|
||
37 |
|
||
38 | await expect(page).toHaveURL(/.*hvac-dashboard/); // Correct dashboard slug
|
||
39 |
|
||
at /Users/ben/dev/upskill-event-manager/wordpress-dev/tests/e2e/tests/login.spec.ts:36:16
|
||
|
||
attachment #1: screenshot (image/png) ──────────────────────────────────────────────────────────
|
||
test-results/login-Login-Functionality-login-remembers-login-state-chromium/test-failed-1.png
|
||
────────────────────────────────────────────────────────────────────────────────────────────────
|
||
]]>
|
||
</failure>
|
||
<system-out>
|
||
<![CDATA[
|
||
[[ATTACHMENT|../../test-results/login-Login-Functionality-login-remembers-login-state-chromium/test-failed-1.png]]
|
||
]]>
|
||
</system-out>
|
||
</testcase>
|
||
</testsuite>
|
||
</testsuites> |