import { test, expect } from '@playwright/test'; import { adminPath, ensureDataSource, cleanupByNames } from './helpers.mjs'; test('mailshots editor: datasource-driven options + overlay editors + create', async ({ page, request }) => { const uniq = `${Date.now()}_${Math.floor(Math.random() * 100000)}`; const dsName = `e2e_ms_ds_${uniq}`; const purpose = `e2e_mailshot_${uniq}`; try { await ensureDataSource(request, dsName, 'contacts'); await page.goto(adminPath('feca-mailshots-mailshots')); await expect(page.locator('h1', { hasText: 'Mailshots' })).toBeVisible(); await page.locator('#ms-open-new').click(); await expect(page.locator('#ms-editor-modal')).toBeVisible(); await page.locator('#ms_purpose').fill(purpose); await page.locator('#ms_ds').selectOption({ label: dsName }); await expect.poll(async () => await page.locator('#ms-token-controls button, #ms-token-controls select option').count()).toBeGreaterThan(0); await expect.poll(async () => await page.locator('#ms_pdfname option').count()).toBeGreaterThan(1); await expect.poll(async () => await page.locator('#ms_email_field option').count()).toBeGreaterThan(1); await page.locator('#ms_subject').fill('Subject {{ contacts.id }}'); await page.locator('#ms-edit-message').click(); await expect(page.locator('#ms-template-modal')).toBeVisible(); await page.evaluate(() => { const html = '