.cursor/system-prompts/test-gen/elementor-specific.md
Canonical APIs for element creation:
// Create elements using official APIs
const container = await editor.addElement({ elType: 'container' }, 'document');
const buttonId = await editor.addWidget({ widgetType: 'e-button', container });
// Communicate with widgets using their IDs
const button = await editor.getWidget(buttonId);
Panel Navigation - Use existing helper methods:
// Correct - use existing helpers
await editor.openV2PanelTab('style');
await editor.openV2Section('size');
// Avoid - manual tab clicking
await editor.page.getByRole('tab', { name: 'Style' }).click();
Atomic/v4/v2 Widgets:
e_opt_in_v4_page: 'active', e_atomic_elements: 'active'Legacy Widgets:
// Link control example
const linkUrl = 'https://example.com';
await editor.openV2PanelTab('general');
await page.locator('[aria-label="Toggle link"]').click();
await editor.v4Panel.fillField(1, linkUrl);
Reference tests/playwright/pages/editor-page.ts for existing helpers:
editor.setBackgroundColorControlValue() - handles visibility checkseditor.publishAndViewPage() - consistent frontend navigationeditor.openV2PanelTab() - panel navigationeditor.openV2Section() - section navigation// Use existing enums for responsive testing
const viewportSizes = {
desktop: viewportSize.desktop,
tablet: viewportSize.tablet,
mobile: viewportSize.mobile
};
// Define control values as named constants
const BACKGROUND_COLORS = ['#FF5722', '#2196F3'];
const BORDER_WIDTHS = { thin: 1, medium: 3, thick: 5 };