mirror of
https://github.com/cloud-shuttle/leptos-shadcn-ui.git
synced 2025-12-22 22:00:00 +00:00
fix: Resolve Playwright test locator specificity issues
- Fix 'strict mode violation' errors by using more specific locators - Replace generic text locators with element-specific selectors - Use CSS class selectors for dropdown menu and sidebar - Use element type selectors (h3, p) for better specificity - Add .first() method to handle multiple matching elements - Improve test reliability and reduce false positives
This commit is contained in:
@@ -152,8 +152,8 @@ test.describe('Comprehensive Dashboard Demo E2E Tests', () => {
|
||||
await expect(activitySection).toBeVisible();
|
||||
|
||||
// Check for activity items
|
||||
const activityItems = page.locator('div:has-text("Eddie Lake completed Cover page")');
|
||||
await expect(activityItems).toBeVisible();
|
||||
const activityItems = page.locator('p:has-text("Eddie Lake completed Cover page")');
|
||||
await expect(activityItems.first()).toBeVisible();
|
||||
|
||||
// Check for timestamps
|
||||
const timestamps = page.locator('text=2 hours ago, text=4 hours ago, text=6 hours ago');
|
||||
@@ -163,7 +163,7 @@ test.describe('Comprehensive Dashboard Demo E2E Tests', () => {
|
||||
|
||||
test.describe('Data Table Section', () => {
|
||||
test('should display project documents table', async () => {
|
||||
const tableSection = page.locator('text=Project Documents');
|
||||
const tableSection = page.locator('h3:has-text("Project Documents")');
|
||||
await expect(tableSection).toBeVisible();
|
||||
|
||||
// Check table headers
|
||||
@@ -183,7 +183,7 @@ test.describe('Comprehensive Dashboard Demo E2E Tests', () => {
|
||||
await openMenuButtons.first().click();
|
||||
|
||||
// Check that dropdown menu appears
|
||||
const dropdownMenu = page.locator('div:has-text("Edit"), div:has-text("Copy"), div:has-text("Delete")');
|
||||
const dropdownMenu = page.locator('.absolute.top-16.right-4.bg-card');
|
||||
await expect(dropdownMenu).toBeVisible();
|
||||
});
|
||||
|
||||
@@ -214,7 +214,7 @@ test.describe('Comprehensive Dashboard Demo E2E Tests', () => {
|
||||
await sidebarToggle.click();
|
||||
|
||||
// Check that sidebar is hidden/shown
|
||||
const sidebar = page.locator('div:has-text("Leptos Dashboard")');
|
||||
const sidebar = page.locator('.w-64.bg-card');
|
||||
await expect(sidebar).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user