test(smoke): fix the 6 remaining failures (auth now works)

- 02 search: target the visible .hero-search instance; the old .first()
  selector matched the hidden header search-overlay (instance 1).
- 01 calculator: it auto-computes from the peptide preset; select the peptide
  and assert #prc-results, scoped to .prc-calculator (the old broad
  button[type=submit] selector clicked the PSA search button).
- 03 admin: 'const nav' had been swallowed into a comment (ReferenceError).
- 04 rest-api: PSA /search returns {results:[]} with no 'status' key; drop it.

Auth fixed separately via a dedicated staging CI admin (ci-smoke) + corrected
STAGING_WP_ADMIN_* secrets; the global.setup failure was cascading into these.

Agent-Session: cto smoke-green
This commit is contained in:
peptiderepo
2026-06-09 15:20:35 +00:00
parent 655843e42b
commit 71d467479a
4 changed files with 16 additions and 33 deletions

View File

@@ -39,31 +39,14 @@ test.describe('Reconstitution Calculator', () => {
expect(options).toBeGreaterThan(1); // >1 means at least one peptide beyond placeholder
});
test('fills inputs and gets a numeric result', async ({ page }) => {
// Select BPC-157 or the first non-placeholder option
const select = page.locator('select').first();
const firstPeptide = select.locator('option').nth(1);
const firstValue = await firstPeptide.getAttribute('value');
await select.selectOption(firstValue ?? '');
// Fill reconstitution volume (mL) — use a known valid value
const volInput = page.locator('input[name*="recon"], input[placeholder*="mL"], input[type="number"]').first();
await volInput.fill('2');
// Fill desired dose
const doseInput = page.locator('input[name*="dose"], input[placeholder*="dose"], input[type="number"]').nth(1);
await doseInput.fill('250');
// Trigger calculation (button or auto-calculate on input)
const calcButton = page.locator('button[type="submit"], button:has-text("Calculate")');
if (await calcButton.count() > 0) {
await calcButton.first().click();
}
// Results container should show a non-zero concentration or injection volume
const results = page.locator('.prc-results, .calculator-results, [data-prc-result]').first();
await expect(results).toBeVisible({ timeout: 5_000 });
const resultText = await results.textContent();
expect(resultText).toMatch(/\d+(\.\d+)?/); // contains at least one number
});
test('fills inputs and gets a numeric result', async ({ page }) => {
const calc = page.locator('.prc-calculator');
// The calculator auto-computes once a peptide preset is chosen (the preset
// supplies vial size, recommended water volume and a default dose).
await calc.locator('#prc-peptide-select').selectOption({ index: 1 });
// Results panel unhides and renders numeric result cards.
const results = page.locator('#prc-results');
await expect(results).toBeVisible({ timeout: 10_000 });
await expect(page.locator('.prc-result-card__value').first()).toHaveText(/\d/, { timeout: 5_000 });
});
});

View File

@@ -25,14 +25,14 @@ test.describe('Peptide Search AI', () => {
test('search input widget is present on page', async ({ page }) => {
// PSA renders a form with class .psa-search-form or input with data-psa attr
const searchInput = page.locator(
'.psa-search-form input, input[name*="peptide"], input[placeholder*="peptide" i], [data-psa] input'
'.hero-search .psa-search-input'
).first();
await expect(searchInput).toBeVisible({ timeout: 10_000 });
});
test('searching for a known peptide returns results', async ({ page }) => {
const searchInput = page.locator(
'.psa-search-form input, input[name*="peptide"], input[placeholder*="peptide" i], [data-psa] input'
'.hero-search .psa-search-input'
).first();
await expect(searchInput).toBeVisible();
@@ -41,7 +41,7 @@ test.describe('Peptide Search AI', () => {
await searchInput.press('Enter');
// Results container should appear and contain something
const results = page.locator('.psa-results, .psa-search-results, [data-psa-results]').first();
const results = page.locator('.hero-search .psa-search-results').first();
await expect(results).toBeVisible({ timeout: 15_000 });
const text = await results.textContent();
expect((text ?? '').trim().length).toBeGreaterThan(0);
@@ -57,7 +57,7 @@ test.describe('Peptide Search AI', () => {
);
const searchInput = page.locator(
'.psa-search-form input, input[name*="peptide"], input[placeholder*="peptide" i], [data-psa] input'
'.hero-search .psa-search-input'
).first();
await searchInput.fill('TB-500');
await searchInput.press('Enter');

View File

@@ -97,7 +97,8 @@ 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 const nav = page.locator('#adminmenu');
// 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 });

View File

@@ -38,7 +38,6 @@ test.describe('REST API — Peptide Search AI', () => {
expect([200, 404]).toContain(res.status());
if (res.status() === 200) {
const body = await res.json();
expect(body).toHaveProperty('status');
expect(body).toHaveProperty('results');
}
});