diff --git a/tests/03-admin-plugins.spec.ts b/tests/03-admin-plugins.spec.ts index 3354d82..aeb4546 100755 --- a/tests/03-admin-plugins.spec.ts +++ b/tests/03-admin-plugins.spec.ts @@ -97,4 +97,21 @@ test.describe('WP Admin — PRAutoBlogger settings page', () => { test.describe('WP Admin — Peptide Repo Core admin', () => { test('PR Core menu item exists in wp-admin', async ({ page }) => { await page.goto(`${ADMIN}/`); - // PR Core registers the peptide CPT which creates a "Peptides" menu item \ No newline at end of file + // PR Core registers the peptide CPT which creates a "Peptides" menu item const nav = page.locator('#adminmenu'); + await expect(nav).toBeVisible(); + // "Peptides" top-level menu item is registered by the peptide CPT + await expect(nav.locator('text=Peptides')).toBeVisible({ timeout: 10_000 }); + }); + + test('PR Core Settings page loads', async ({ page }) => { + // Settings page lives under the Peptides CPT submenu + const res = await page.goto( + `${ADMIN}/edit.php?post_type=peptide&page=pr-core-settings` + ); + expect(res?.status()).toBe(200); + await expect(page.locator('#wpbody')).toBeVisible(); + const body = await page.textContent('body'); + expect(body).not.toContain('Fatal error'); + await expect(page.locator('form')).toBeVisible(); + }); +}); diff --git a/tests/04-rest-api.spec.ts b/tests/04-rest-api.spec.ts index 88d4b13..ed8bbe3 100755 --- a/tests/04-rest-api.spec.ts +++ b/tests/04-rest-api.spec.ts @@ -59,4 +59,11 @@ test.describe('REST API — PR Core (CPT registration)', () => { // Instead we verify the CPT exists via the WP REST types endpoint. const res = await request.get('/wp-json/wp/v2/types/peptide'); // 200 = CPT registered; 404 = CPT missing entirely — both are informative - \ No newline at end of file + expect([200, 404]).toContain(res.status()); + if (res.status() === 200) { + const body = await res.json(); + // Types endpoint returns a single type object with slug + expect(body).toHaveProperty('slug', 'peptide'); + } + }); +});