@@ -29,12 +29,10 @@ test("devices route renders the device list page", async ({ page }) => {
29
29
await expect ( table ) . toBeVisible ( ) ;
30
30
31
31
// Verify our test device is in the table
32
- const deviceLink = await page . locator ( "table td a" , {
33
- hasText : TEST_DEVICE_NAME ,
34
- } ) ;
32
+ const deviceLink = await page . getByRole ( "link" , { name : TEST_DEVICE_NAME } ) ;
35
33
await expect ( deviceLink ) . toBeVisible ( ) ;
36
34
// Verify the device status is online
37
- const statusBadge = await page . locator ( 'table .badge:has-text( "online")' ) ;
35
+ const statusBadge = await page . getByText ( "online" , { exact : true } ) ;
38
36
await expect ( statusBadge ) . toBeVisible ( ) ;
39
37
} ) ;
40
38
@@ -58,9 +56,7 @@ test("adding a new device works correctly", async ({ page }) => {
58
56
await page . getByRole ( "link" , { name : "devices" } ) . click ( ) ;
59
57
60
58
// Verify our test device is in the table
61
- const newDeviceUrl = await page . locator ( "table a" , {
62
- hasText : NEW_DEVICE_URL ,
63
- } ) ;
59
+ const newDeviceUrl = await page . getByRole ( "link" , { name : NEW_DEVICE_URL } ) ;
64
60
await expect ( newDeviceUrl ) . toBeVisible ( ) ;
65
61
} ) ;
66
62
@@ -69,7 +65,7 @@ test("device detail page and tab navigation", async ({ page }) => {
69
65
await page . goto ( "/devices/list" , { waitUntil : "load" } ) ;
70
66
71
67
// Click on our pre-seeded mock device
72
- await page . locator ( "table td a ", { hasText : TEST_DEVICE_NAME } ) . click ( ) ;
68
+ await page . getByRole ( "link ", { name : TEST_DEVICE_NAME } ) . click ( ) ;
73
69
74
70
// Wait for navigation to complete - should be redirected to the state tab
75
71
await page . waitForURL ( / \/ d e v i c e s \/ .* \/ .* \/ s t a t e / ) ;
@@ -78,12 +74,7 @@ test("device detail page and tab navigation", async ({ page }) => {
78
74
expect ( page . url ( ) ) . toMatch ( / \/ d e v i c e s \/ .* \/ .* \/ s t a t e / ) ;
79
75
80
76
// Verify device name is displayed in the breadcrumb
81
- const breadcrumbDeviceName = await page . locator (
82
- ".breadcrumbs > ul > li:nth-child(2) > a" ,
83
- {
84
- hasText : TEST_DEVICE_NAME ,
85
- } ,
86
- ) ;
77
+ const breadcrumbDeviceName = await page . getByRole ( "link" , { name : TEST_DEVICE_NAME } ) ;
87
78
await expect ( breadcrumbDeviceName ) . toBeVisible ( ) ;
88
79
89
80
// Check for API and network links
@@ -93,11 +84,11 @@ test("device detail page and tab navigation", async ({ page }) => {
93
84
await expect ( networkLink ) . toBeVisible ( ) ;
94
85
95
86
// Check for status badge
96
- const onlineBadge = await page . locator ( '.badge:has-text( "online")' ) ;
87
+ const onlineBadge = await page . getByText ( "online" , { exact : true } ) ;
97
88
await expect ( onlineBadge ) . toBeVisible ( ) ;
98
89
99
90
// Check for navigation tabs
100
- const stateTabs = page . locator ( ".tabs ") ;
91
+ const stateTabs = page . getByRole ( "tablist ") ;
101
92
await expect ( stateTabs ) . toBeVisible ( ) ;
102
93
103
94
// Verify all tabs are present
0 commit comments