mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-07 03:15:56 +00:00
The biber DM spec opened /main/messages/@administrator as its first navigation after SSO, so a single page load both joined the open team and opened the DM. The Agents plugin fetches team-scoped data during that load and errors with "Unable to find an existing account matching your username for this team", after which the typed message stays in the composer and Enter sends nothing. The spec was flaky rather than broken: the same job recorded it both green and red, and the DM channel still held a message from an earlier successful attempt, so the URL does join the team. Reload it once, so the plugin initialises against a membership that already exists. Evidence from the run artifacts: the trace records two pageError entries from the mattermost-ai bundle during that navigation, and the failure snapshot shows the message still sitting in the textbox. The causal step from the plugin error to the lost keypress is inferred, not proven, so a single green run will not confirm this fix. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
95 lines
3.5 KiB
JavaScript
95 lines
3.5 KiB
JavaScript
const { test, expect } = require("@playwright/test");
|
|
const { resolveTimeout } = require("./timeouts");
|
|
|
|
const { performKeycloakLoginForm } = require("./personas");
|
|
|
|
exports.register = function (shared) {
|
|
test("mattermost: biber sends direct message to administrator, administrator receives it", async ({ browser }) => {
|
|
test.skip(!shared.oidcEnabled, "OIDC shared service disabled");
|
|
|
|
const oidcAuthUrl = shared.expectedOidcAuthUrl();
|
|
const baseUrl = shared.expectedMattermostBaseUrl();
|
|
const testMessage = `Playwright test ${Date.now()}`;
|
|
|
|
const biberContext = await browser.newContext({ ignoreHTTPSErrors: true });
|
|
const adminContext = await browser.newContext({ ignoreHTTPSErrors: true });
|
|
|
|
try {
|
|
const biberPage = await biberContext.newPage();
|
|
|
|
await shared.startMattermostSsoFlow(biberPage, baseUrl);
|
|
await expect
|
|
.poll(() => biberPage.url(), {
|
|
timeout: resolveTimeout(30_000),
|
|
message: `Expected redirect to Keycloak OIDC: ${oidcAuthUrl}`,
|
|
})
|
|
.toContain(oidcAuthUrl);
|
|
|
|
await performKeycloakLoginForm(biberPage, shared.env.biberUsername, shared.env.biberPassword);
|
|
|
|
await expect
|
|
.poll(() => biberPage.url(), {
|
|
timeout: resolveTimeout(60_000),
|
|
message: "Expected redirect back to Mattermost after biber login",
|
|
})
|
|
.toContain(baseUrl);
|
|
|
|
await shared.dismissMattermostPopups(biberPage);
|
|
|
|
await biberPage.goto(`${baseUrl}/main/messages/@${shared.env.adminUsername}`);
|
|
await shared.dismissMattermostPopups(biberPage);
|
|
|
|
await biberPage.reload();
|
|
await shared.dismissMattermostPopups(biberPage);
|
|
|
|
const messageInput = biberPage
|
|
.locator("#post_textbox, [data-testid='post_textbox'], div[contenteditable='true'].post-create__input")
|
|
.first();
|
|
await messageInput.waitFor({ state: "visible", timeout: resolveTimeout(30_000) });
|
|
await messageInput.click({ force: true });
|
|
// keyboard.type() bypasses fill()'s contenteditable-skipping React onChange gap.
|
|
await biberPage.keyboard.type(testMessage);
|
|
await biberPage.keyboard.press("Enter");
|
|
|
|
await expect(
|
|
biberPage.getByTestId("postContent").getByText(testMessage)
|
|
).toBeVisible({ timeout: resolveTimeout(15_000) });
|
|
|
|
await shared.mattermostLogout(biberPage, baseUrl);
|
|
|
|
const adminPage = await adminContext.newPage();
|
|
|
|
await shared.startMattermostSsoFlow(adminPage, baseUrl);
|
|
await expect
|
|
.poll(() => adminPage.url(), {
|
|
timeout: resolveTimeout(30_000),
|
|
message: `Expected redirect to Keycloak OIDC: ${oidcAuthUrl}`,
|
|
})
|
|
.toContain(oidcAuthUrl);
|
|
|
|
await performKeycloakLoginForm(adminPage, shared.env.adminUsername, shared.env.adminPassword);
|
|
|
|
await expect
|
|
.poll(() => adminPage.url(), {
|
|
timeout: resolveTimeout(60_000),
|
|
message: "Expected redirect back to Mattermost after admin login",
|
|
})
|
|
.toContain(baseUrl);
|
|
|
|
await shared.dismissMattermostPopups(adminPage);
|
|
await shared.waitForMattermostChannelView(adminPage, resolveTimeout(30_000));
|
|
|
|
await adminPage.goto(`${baseUrl}/main/messages/@${shared.env.biberUsername}`);
|
|
|
|
await expect(
|
|
adminPage.getByTestId("postContent").getByText(testMessage)
|
|
).toBeVisible({ timeout: resolveTimeout(30_000) });
|
|
|
|
await shared.mattermostLogout(adminPage, baseUrl);
|
|
} finally {
|
|
await biberContext.close().catch(() => {});
|
|
await adminContext.close().catch(() => {});
|
|
}
|
|
});
|
|
};
|