IWSN: "Połącz z IWSN" — a person of Intecion connects the site (contract 1.8.0)
- the state block on the e-mail tab (method IWSN): the button while the service offers the confirmation page
(connectAvailable) or before the site has enrolled; a click asks the site's server for the link
(POST /api/iapl/mail-relay/connect-link, admin only), which asks the service (POST /v1/connect, enrolling first),
checks that it begins with the service's own {base}/connect?, and hands it over without storing or logging it;
the browser opens it in a new tab with noopener noreferrer; the block asks /v1/status every 5 s for 10 min
- states: waiting for confirmation (button), waiting for approval (no page), connected, stopped; 503
connect-unavailable and 429 said in the admin's language; a load of the panel asks the service while the site waits
- dashboard alert for a waiting site (live); doctor mail-relay-connect (error) — replaces the pending warning and the
"not enrolled yet" note of mail-relay-state
- opt-out mail.relay.connectButton: false (no button, no route); building blocks requestRelayConnectLink,
isRelayConnectUrl, RELAY_CONNECT_LINK_PATH; the fake service implements /v1/connect, connectAvailable and
confirmConnect
- contract copy 1.8.0 (IWDL working tree, checksums match); docs, AGENT.md, setup / upgrade / debug skills, changelog
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
347e3bafa1
commit
2c0262367d
@@ -104,4 +104,39 @@ test.describe('the mail service', () => {
|
||||
await page.waitForLoadState('networkidle')
|
||||
for (const body of [await page.content(), await status.text(), ...seen]) {expect(body).not.toContain('ims_')}
|
||||
})
|
||||
|
||||
test('"Connect to IWSN" (contract 1.8.0 §2.1): the link opens in a new tab, the person confirms, the block sees it by itself', async ({ page }) => {
|
||||
// the site enrolled above; the service now holds it for confirmation by a person of Intecion
|
||||
relay.site(site)!.state = 'pending'
|
||||
await page.goto('/admin/login')
|
||||
await page.fill('#field-email', email!)
|
||||
await page.fill('#field-password', password!)
|
||||
await page.click('.form-submit button')
|
||||
await page.waitForURL(/verify-totp|\/admin(\?|$)/, { waitUntil: 'commit' })
|
||||
if (page.url().includes('verify-totp')) {
|
||||
await page.getByRole('textbox').first().click()
|
||||
await page.keyboard.type(totp(secret!))
|
||||
}
|
||||
await expect(page).toHaveTitle(/Dashboard|Pulpit/, { timeout: 20_000 })
|
||||
await page.goto('/admin/globals/site-integrations')
|
||||
await page.getByRole('tab', { name: /E-mail sending|Wysyłka e-mail/ }).or(page.getByRole('button', { name: /E-mail sending|Wysyłka e-mail/ })).first().click()
|
||||
const block = page.locator('[data-mail-transport]')
|
||||
await block.getByRole('button', { name: /Check now|Sprawdź teraz/ }).click()
|
||||
const connect = block.locator('[data-mail-relay-connect]')
|
||||
await expect(connect).toBeVisible({ timeout: 20_000 })
|
||||
await expect(block).toContainText(/Waiting for confirmation|Oczekuje na potwierdzenie/)
|
||||
// no link was asked for by the page itself
|
||||
expect(relay.requests.filter((r) => r.path === '/v1/connect')).toEqual([])
|
||||
|
||||
const [tab] = await Promise.all([page.waitForEvent('popup'), connect.click()])
|
||||
const url = tab.url()
|
||||
expect(url.startsWith(`${server.url}/connect?ref=`)).toBe(true)
|
||||
expect(await tab.evaluate(() => window.opener)).toBeNull()
|
||||
// the person of Intecion signs in and presses "Potwierdź" on the service's page (the stand-in does it here)
|
||||
expect(relay.confirmConnect(url)).toBe(true)
|
||||
await tab.close()
|
||||
// the block asks every 5 s and shows the result without a reload
|
||||
await expect(block).toContainText(/Connected to IWSN|Połączono z IWSN/, { timeout: 20_000 })
|
||||
await expect(connect).toHaveCount(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user