test(integration): select the group From address in the #569 spec
Extend 04-shared-identity's UI test to not just assert team@example.org is offered but to actually select it as the sender and confirm it becomes the active From identity, then hold on the composer so the selected group address is visible in the recorded video. Adds selectComposerFrom / selectedComposerFrom helpers.
This commit is contained in:
committed by
Linus Rath
parent
60b9ae66ea
commit
2f791318df
@@ -322,6 +322,24 @@ export async function openFolder(page: Page, sel: FolderSelector): Promise<void>
|
||||
await folderRow(page, sel).first().click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Select the composer's From sender whose option text contains `emailNeedle`
|
||||
* (e.g. a shared/group address). Requires the multi-identity <select> to be
|
||||
* rendered. Scrolls it into view first so the change is captured on video.
|
||||
*/
|
||||
export async function selectComposerFrom(page: Page, emailNeedle: string): Promise<void> {
|
||||
const from = page.locator('[data-testid="composer-from"]').first();
|
||||
await from.scrollIntoViewIfNeeded();
|
||||
const value = await from.locator('option', { hasText: emailNeedle }).first().getAttribute('value');
|
||||
if (!value) throw new Error(`No composer From option matching "${emailNeedle}"`);
|
||||
await from.selectOption(value);
|
||||
}
|
||||
|
||||
/** The display text of the currently selected From sender. */
|
||||
export async function selectedComposerFrom(page: Page): Promise<string> {
|
||||
const from = page.locator('[data-testid="composer-from"]').first();
|
||||
return (await from.locator('option:checked').first().textContent())?.trim() ?? '';
|
||||
}
|
||||
/** Locator for an email row by (exact) subject. */
|
||||
export function emailItem(page: Page, subject: string): Locator {
|
||||
return page.locator(`[data-testid="email-list-item"][data-subject="${subject}"]`);
|
||||
|
||||
Reference in New Issue
Block a user