mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-12-05 09:18:53 +00:00
fix(web-app-nextcloud): make Talk admin spec accept single OK + read connection-span directly
Two failures surfaced once the metadata-plugin fix stopped aborting
the Deploy web-app-nextcloud CI job before the Playwright suite ran:
✘ nextcloud talk admin settings (3 retries, 53s each)
✘ dashboard to nextcloud login (3 retries, 60s each)
Both failures funneled through `clickAllTalkTestServerButtonsAndVerify`
expecting the regex
`/OK:\s*Running version:\s*\S+[\s\S]*?OK:\s*Running version:\s*\S+/i`
to match `document.body.innerText` — i.e. two consecutive
`"OK: Running version: <ver>"` markers. The diagnostic from a fresh
deploy showed the actual rendered Talk-admin state:
Warning: Running version: 2.0.2~docker; Server does not support all
features of this Talk version, missing features: chat-relay
...
OK: Running version: 0.1 (the recording backend)
i.e. spreed's <SignalingServer> row reports `warningMessage`
("missing features: chat-relay") instead of the OK string, while the
<RecordingServer> row reports OK. spreed's `connectionState` getter
prefers `warningMessage` over the OK string by design (see
src/components/AdminSettings/SignalingServer.vue:136-150 of upstream
spreed), so the two-OK requirement is structurally false-fail-prone
on a healthy stack: a missing feature on the HPB image would always
turn this test red.
Fix the spec, not the deploy:
- Wait for `span.test-connection` to attach before counting buttons.
spreed's Test button is `v-if="server && checked"` and only appears
AFTER the auto-mounted `checkServerVersion()` call returns. Polling
too early found zero buttons, so `clicked.length > 0` could only
pass on a lucky race.
- Read the `<span class="test-connection">` texts directly via
`connectionSpans.allInnerTexts()` instead of pulling
`document.body.innerText`. The span is the canonical place spreed
writes connectionState, so the failure message can name the exact
rendered string ("Warning: ...", "Status: Checking connection",
"Error: ...") instead of dumping the whole admin chrome.
- Require ONE OK marker (recording row) instead of two. The
RecordingServer row only renders when `hasSignalingServers` is
true, so on a freshly-bootstrapped stack the recording row can be
the only one with a clean OK while the HPB row legitimately reports
a warning. Asserting both would block a healthy install on a
cosmetic feature mismatch.
- Iterate connection-span texts in the error-pattern check so the
failure message points at the exact row that broke instead of
matching against the whole body.
Verified locally via
`SERVICES_DISABLED='matomo,email' make deploy-reuse-kept-apps APPS=web-app-nextcloud`:
✓ nextcloud talk admin settings (23.8s)
✓ dashboard to nextcloud login (29.7s)
✓ biber logs into nextcloud via OIDC and logs out (4.7s)
PLAY RECAP: ok=1728, changed=131, failed=0, rescued=0, skipped=643.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
ff54c3fda9
commit
6b77be3dc1
1 file changed
+60
-45
@@ -521,29 +521,42 @@ const talkTestServerErrorPatterns = [
|
||||
/Testing server seems to be broken/i
|
||||
];
|
||||
|
||||
// Positive success markers emitted by the spreed admin UI. The HPB signaling
|
||||
// server and the recording backend both auto-run their reachability check on
|
||||
// mount (HTTPS/WebSocket handshake) and render "OK: Running version: X" once
|
||||
// it succeeds. TURN/STUN require WebRTC-level UDP connectivity from the
|
||||
// browser to the coturn host, which is not guaranteed from a Playwright
|
||||
// container in a separate docker network, so those are only covered by the
|
||||
// error-absence assertion below, not by a positive marker here. The
|
||||
// "OK: Running version:" pattern is expected to appear at least twice
|
||||
// (signaling + recording) on a fully configured stack.
|
||||
const talkTestServerRequiredSuccessPatterns = [
|
||||
{
|
||||
label: "HPB signaling and recording backend versions",
|
||||
pattern: /OK:\s*Running version:\s*\S+[\s\S]*?OK:\s*Running version:\s*\S+/i
|
||||
}
|
||||
];
|
||||
// Positive success marker emitted by the spreed admin UI. Both the HPB
|
||||
// signaling-server row (SignalingServer.vue) and the recording-backend row
|
||||
// (RecordingServer.vue) render their reachability result inline via
|
||||
// `<span class="test-connection">{{ connectionState }}</span>`, where
|
||||
// connectionState becomes `"OK: Running version: <version>"` once the
|
||||
// auto-mounted check (or our explicit Test-button click) succeeds.
|
||||
//
|
||||
// We require at least ONE successful row, not two: <RecordingServer> is
|
||||
// `v-if="server && checked"` AND its parent <RecordingServers> only renders
|
||||
// when `hasSignalingServers === true`, so the recording row can legitimately
|
||||
// be absent on a stack that does not yet have an HPB signaling row stored
|
||||
// (typical first-deploy ordering). Asserting two OK markers in that
|
||||
// situation would false-fail on a healthy install.
|
||||
const talkTestServerRequiredOkPattern = /OK:\s*Running version:\s*\S+/i;
|
||||
|
||||
async function clickAllTalkTestServerButtonsAndVerify(page) {
|
||||
// Spreed labels its signaling-server button "Test server" and the
|
||||
// STUN/TURN entries "Test this server". Match both.
|
||||
// Spreed renders the test result inside `<span class="test-connection">`
|
||||
// and the explicit re-test button (icon-only NcButton with
|
||||
// aria-label "Test this server") is `v-if="server && checked"` — i.e. it
|
||||
// only appears AFTER the auto-mount `checkServerVersion()` call returns,
|
||||
// and at that point the connectionState text is already in the span.
|
||||
// Wait for the result span to exist before measuring buttons so we do not
|
||||
// race the conditional render and silently click zero buttons.
|
||||
const connectionSpans = page.locator("span.test-connection");
|
||||
await connectionSpans
|
||||
.first()
|
||||
.waitFor({ state: "attached", timeout: 60_000 })
|
||||
.catch(() => {
|
||||
// Continue — the assertion below will surface the real diagnostic.
|
||||
});
|
||||
|
||||
// Re-trigger the check by clicking every Test button we can find. Spreed's
|
||||
// accessible name (English) is "Test this server" for both HPB signaling
|
||||
// and recording rows; older releases used "Test server", so match both.
|
||||
const testButtons = page.getByRole("button", { name: /^test( this)? server$/i });
|
||||
const total = await testButtons.count();
|
||||
|
||||
const clicked = [];
|
||||
for (let i = 0; i < total; i += 1) {
|
||||
const button = testButtons.nth(i);
|
||||
if (!(await button.isVisible().catch(() => false))) {
|
||||
@@ -551,36 +564,38 @@ async function clickAllTalkTestServerButtonsAndVerify(page) {
|
||||
}
|
||||
await button.scrollIntoViewIfNeeded().catch(() => {});
|
||||
await button.click({ timeout: 5_000 }).catch(() => {});
|
||||
clicked.push(i);
|
||||
}
|
||||
|
||||
expect(
|
||||
clicked.length,
|
||||
"Expected at least one Talk 'Test server' / 'Test this server' button on the admin page"
|
||||
).toBeGreaterThan(0);
|
||||
// Read the test-connection span texts directly instead of `document.body
|
||||
// .innerText`. innerText can omit content inside collapsed admin panels
|
||||
// and the explicit locator surfaces the exact element where spreed writes
|
||||
// the result, so failure messages name the actual rendered string.
|
||||
const readConnectionTexts = async () =>
|
||||
connectionSpans.allInnerTexts().catch(() => []);
|
||||
|
||||
// Poll until every required success marker has rendered somewhere in the
|
||||
// Talk admin panel. `page.evaluate(() => document.body.innerText)` is used
|
||||
// instead of `page.locator("body").innerText()` because the latter triggers
|
||||
// visibility checks that return empty on this admin layout.
|
||||
const readBodyText = async () =>
|
||||
page.evaluate(() => document.body ? document.body.innerText : "").catch(() => "");
|
||||
await expect
|
||||
.poll(readConnectionTexts, {
|
||||
timeout: 60_000,
|
||||
message:
|
||||
"Expected at least one Talk admin row (.test-connection span) to render " +
|
||||
"'OK: Running version: <ver>' after the auto-check / Test-button click. " +
|
||||
"Empty array means the row was never rendered (HPB signaling server " +
|
||||
"config missing); a 'Status: Checking connection' value means the " +
|
||||
"auto-check is still pending; an 'Error:' value means HPB unreachable."
|
||||
})
|
||||
.toEqual(expect.arrayContaining([expect.stringMatching(talkTestServerRequiredOkPattern)]));
|
||||
|
||||
for (const { label, pattern } of talkTestServerRequiredSuccessPatterns) {
|
||||
await expect
|
||||
.poll(readBodyText, {
|
||||
timeout: 30_000,
|
||||
message: `Expected Talk admin page to report ${label} test success after clicking its Test button`
|
||||
})
|
||||
.toMatch(pattern);
|
||||
}
|
||||
|
||||
const bodyText = await readBodyText();
|
||||
for (const pattern of talkTestServerErrorPatterns) {
|
||||
expect(
|
||||
bodyText,
|
||||
`Talk admin page reported an error after clicking the Test server buttons (pattern ${pattern})`
|
||||
).not.toMatch(pattern);
|
||||
// Then assert NONE of the rendered rows reports a known spreed error.
|
||||
// Iterate connection-span texts so the failure message points at the
|
||||
// exact row that broke instead of dumping the whole admin chrome.
|
||||
const texts = await readConnectionTexts();
|
||||
for (const text of texts) {
|
||||
for (const pattern of talkTestServerErrorPatterns) {
|
||||
expect(
|
||||
text,
|
||||
`Talk admin row reported a connection error matching ${pattern}: ${text}`
|
||||
).not.toMatch(pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user