Skip to content

Commit 3984c3a

Browse files
edwhclaude
andcommitted
Fix Playwright test failures in device tests
Use more specific selector for counting devices in tests to avoid matching h3 elements in both desktop and mobile views. Add device-list class to EventDeviceList component for easier targeting. Increase timeout for photo upload verification to handle slower uploads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 9dbf425 commit 3984c3a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

resources/js/components/EventDeviceList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div class="device-list">
33
<b-table-simple responsive class="pl-0 pl-md-3 pr-0 pr-md-3 pb-2 mb-2" table-class="m-0 leave-tables-alone">
44
<b-thead>
55
<b-tr>

tests/Integration/utils.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ exports.addDevice = async function(page, baseURL, idevents, powered, photo, fixe
187187
var addsel = powered ? '.add-powered-device-desktop' : '.add-unpowered-device-desktop'
188188
log('Using device selector', { addsel, powered })
189189

190-
// Get current device count.
190+
// Get current device count - count h3 elements within the device-list container in the visible desktop tab
191191
await page.waitForSelector(addsel)
192-
var current = await page.locator('h3:visible').count()
192+
var current = await page.locator('.d-none.d-md-block .device-list h3.noheader:visible').count()
193193
log('Current device count', { current })
194194

195195
// Click the add button.
@@ -242,18 +242,18 @@ exports.addDevice = async function(page, baseURL, idevents, powered, photo, fixe
242242
log('Submitting device creation')
243243
await page.locator('text=Add item >> visible=true').click()
244244

245-
// Wait for device to show.
245+
// Wait for device to show - use same specific selector as when counting
246246
log('Waiting for device to appear in list')
247-
await expect(page.locator('h3:visible')).toHaveCount(current + 1)
247+
await expect(page.locator('.d-none.d-md-block .device-list h3.noheader:visible')).toHaveCount(current + 1)
248248

249249
// Check that the photo appears.
250250
log('Opening device for verification')
251251
await page.locator('.edit:visible').last().click()
252252

253253
if (photo) {
254254
log('Verifying photo was uploaded')
255-
// Should see the dropzone and uploaded photo.
256-
await expect(page.locator('.device-photos:visible img')).toHaveCount(2)
255+
// Should see the dropzone and uploaded photo - allow extra time for upload to complete
256+
await expect(page.locator('.device-photos:visible img')).toHaveCount(2, { timeout: 10000 })
257257
} else {
258258
log('Verifying no additional photos present')
259259
// Just dropzone

0 commit comments

Comments
 (0)