import { Page } from "@playwright/test";

interface emailConfig {
	documentNumber: string
	page: Page
}

const email = async (config: emailConfig) => {
	const page = await config.page.context().newPage();
	await page.goto('https://www.guerrillamail.com/',{waitUntil: 'domcontentloaded'});
	const emailInput = page.locator('div').locator('#inbox-id');
	await emailInput.waitFor({state: 'visible', timeout: 5_000});
	await emailInput.click();
	await page.getByRole('textbox').fill(config.documentNumber);
	await page.getByRole('button', { name: 'set' }).click();
	await page.locator('#gm-host-select').selectOption('grr.la');
	await page.waitForTimeout(6_000);
	await page.getByRole('cell', { name: 'Activar nueva cuenta' }).click();
	await page.getByRole('link', { name: 'Activar' }).click();
	await page.close();
	return page;
};
export { email };