@bhavinkumarvegad/playwright-email-utils
Version:
Reusable utilities for handling emails in Playwright tests from Yopmail, Gmail and other providers.
29 lines (25 loc) • 748 B
text/typescript
import { Page } from '@playwright/test';
export type Selector =
| { type: 'role'; value: { role: Parameters<Page['getByRole']>[0]; name?: string } }
| { type: 'text'; value: string }
| { type: 'locator'; value: string };
export type EmailAction = {
selector: Selector;
action: 'click' | 'textContent' | 'getAttribute';
attributeName?: string;
description: string;
};
export interface EmailQuery {
subject?: string;
from?: string;
to?: string;
afterTime?: string; // Format: yyyy-mm-dd hh:mm:ss
beforeTime?: string; // Format: yyyy-mm-dd hh:mm:ss
}
export interface EmailExtractionRule {
field: string;
type: 'between-markers' | 'regex' | 'full-text';
startMarker?: string;
endMarker?: string;
regex?: RegExp;
}