Some checks failed
Frontend / Unit Tests & Coverage (push) Has been skipped
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Failing after 1m13s
Regenerate POT file (translatable strings) / Regenerate POT file (main-hotfix) (push) Failing after 6s
Server / Tests (frappe ${{ matrix.frappe-branch }}) (push) Has been skipped
Server / Resolve frappe matrix (push) Failing after 1s
Frontend / Lint (push) Failing after 1s
Frontend / Production Build (push) Failing after 1s
Server / Coverage Wrap Up (push) Has been skipped
Frontend / Coverage Wrap Up (push) Has been skipped
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { test, expect } from '@playwright/test'
|
|
import { LeadPage } from '../pages'
|
|
import { cleanupE2ERecords, getList, seedLead } from '../helpers'
|
|
|
|
test.describe('Send email from lead view', () => {
|
|
test.afterAll(async ({ request }) => {
|
|
await cleanupE2ERecords(request)
|
|
})
|
|
|
|
test('composes and sends an email that is recorded as a Communication', async ({
|
|
page,
|
|
request,
|
|
}) => {
|
|
const lead = await seedLead(request)
|
|
const body = `E2E email body ${Date.now()}`
|
|
const leadPage = new LeadPage(page)
|
|
|
|
await leadPage.goto(lead.name)
|
|
await leadPage.clearComposerDraft()
|
|
await leadPage.openEmailBox()
|
|
await leadPage.sendEmail(body)
|
|
|
|
// The send creates a Communication linked to the lead (no SMTP delivery needed).
|
|
await expect
|
|
.poll(async () => {
|
|
const rows = await getList(request, 'Communication', {
|
|
filters: {
|
|
reference_doctype: 'CRM Lead',
|
|
reference_name: lead.name,
|
|
communication_type: 'Communication',
|
|
},
|
|
fields: ['name'],
|
|
})
|
|
return rows.length
|
|
})
|
|
.toBeGreaterThan(0)
|
|
|
|
// And it surfaces in the lead's Emails tab. With a cleared draft the
|
|
// recipient row reflects this lead's email and renders outside the
|
|
// sandboxed body iframe, so it is reliable to assert on.
|
|
await leadPage.openTab('Emails')
|
|
await expect(page.getByText(lead.email!).first()).toBeVisible()
|
|
})
|
|
})
|