snapshot of https://github.com/frappe/crm.git (develop, 2026-09-18; blobs > 131072B omitted)
Some checks failed
Frontend / Unit Tests & Coverage (push) Has been skipped
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
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Failing after 1s
Regenerate POT file (translatable strings) / Regenerate POT file (main-hotfix) (push) Failing after 1s
Some checks failed
Frontend / Unit Tests & Coverage (push) Has been skipped
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
Regenerate POT file (translatable strings) / Regenerate POT file (develop) (push) Failing after 1s
Regenerate POT file (translatable strings) / Regenerate POT file (main-hotfix) (push) Failing after 1s
This commit is contained in:
45
e2e/pages/leads.page.ts
Normal file
45
e2e/pages/leads.page.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { Locator, Page, expect } from '@playwright/test'
|
||||
import { LeadData } from '../helpers/crm'
|
||||
|
||||
/**
|
||||
* Leads list view (/crm/leads) and the "Create Lead" modal.
|
||||
*
|
||||
* Fields render via FieldLayout; the quick-entry text fields carry the
|
||||
* label itself as their placeholder (e.g. "First Name", "Email"), so we
|
||||
* drive them by placeholder scoped to the dialog for stable selectors.
|
||||
*/
|
||||
export class LeadsPage {
|
||||
constructor(private page: Page) {}
|
||||
|
||||
async goto() {
|
||||
await this.page.goto('/crm/leads')
|
||||
await this.page.waitForLoadState('networkidle')
|
||||
}
|
||||
|
||||
async openCreateModal() {
|
||||
await this.page.getByRole('button', { name: 'Create', exact: true }).click()
|
||||
await expect(
|
||||
this.page.getByRole('heading', { name: 'Create Lead' }),
|
||||
).toBeVisible()
|
||||
}
|
||||
|
||||
/** Fill the mandatory text fields and submit; resolves once the modal closes. */
|
||||
async createLead(data: LeadData) {
|
||||
const dialog = this.page.getByRole('dialog')
|
||||
await dialog.getByPlaceholder('First Name', { exact: true }).fill(data.first_name)
|
||||
if (data.last_name)
|
||||
await dialog.getByPlaceholder('Last Name', { exact: true }).fill(data.last_name)
|
||||
if (data.email)
|
||||
await dialog.getByPlaceholder('Email', { exact: true }).fill(data.email)
|
||||
|
||||
await dialog.getByRole('button', { name: 'Create', exact: true }).click()
|
||||
await expect(
|
||||
this.page.getByRole('heading', { name: 'Create Lead' }),
|
||||
).toBeHidden()
|
||||
}
|
||||
|
||||
/** A list row matching the given text (e.g. the lead's name/email). */
|
||||
row(text: string): Locator {
|
||||
return this.page.getByRole('link').filter({ hasText: text }).first()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user