@@ -216,20 +216,20 @@ describe("Toolbar general interaction", () => {
216216
217217 it ( "Should place AlwaysOverflow items in overflow from first render without flash" , ( ) => {
218218 cy . mount (
219- < Toolbar id = "no-flash-toolbar" >
220- < ToolbarButton text = "Visible" icon = "add" overflow-priority = "NeverOverflow" id = "never-overflow-btn" > </ ToolbarButton >
221- < ToolbarButton text = "Test 2" icon = "employee" overflow-priority = "AlwaysOverflow" id = "always-overflow-btn1" > </ ToolbarButton >
222- < ToolbarButton text = "Test 3" icon = "decline" overflow-priority = "AlwaysOverflow" id = "always-overflow-btn2" > </ ToolbarButton >
219+ < Toolbar >
220+ < ToolbarButton text = "Visible" icon = "add" overflow-priority = "NeverOverflow" > </ ToolbarButton >
221+ < ToolbarButton text = "Test 2" icon = "employee" overflow-priority = "AlwaysOverflow" > </ ToolbarButton >
222+ < ToolbarButton text = "Test 3" icon = "decline" overflow-priority = "AlwaysOverflow" > </ ToolbarButton >
223223 </ Toolbar >
224224 ) ;
225225
226226 // Verify state immediately after mount, before any waiting
227227 // AlwaysOverflow items should already be in itemsToOverflow array
228- cy . get ( "#no-flash- toolbar" ) . then ( $toolbar => {
228+ cy . get ( "[ui5- toolbar] " ) . then ( $toolbar => {
229229 const toolbar = $toolbar [ 0 ] as Toolbar ;
230- const alwaysBtn1 = document . getElementById ( "always-overflow-btn1 ") as ToolbarButton ;
231- const alwaysBtn2 = document . getElementById ( "always-overflow-btn2 ") as ToolbarButton ;
232- const neverBtn = document . getElementById ( "never-overflow-btn ") as ToolbarButton ;
230+ const alwaysBtn1 = document . querySelector ( "[ui5-toolbar-button][text='Test 2'] ") as ToolbarButton ;
231+ const alwaysBtn2 = document . querySelector ( "[ui5-toolbar-button][text='Test 3'] ") as ToolbarButton ;
232+ const neverBtn = document . querySelector ( "[ui5-toolbar-button][text='Visible'] ") as ToolbarButton ;
233233
234234 // AlwaysOverflow items should be in itemsToOverflow from the start
235235 expect ( toolbar . itemsToOverflow ) . to . include ( alwaysBtn1 ) ;
@@ -247,37 +247,37 @@ describe("Toolbar general interaction", () => {
247247 cy . wait ( 500 ) ;
248248
249249 // Verify overflow button is visible (not hidden)
250- cy . get ( "#no-flash- toolbar" )
250+ cy . get ( "[ui5- toolbar] " )
251251 . shadow ( )
252252 . find ( ".ui5-tb-overflow-btn" )
253253 . should ( "exist" )
254254 . should ( "not.have.class" , "ui5-tb-overflow-btn-hidden" ) ;
255255
256256 // Verify the visible button is in the toolbar (not in overflow popover wrapper)
257- cy . get ( "#never-overflow-btn " )
257+ cy . get ( "[ui5-toolbar-button][text='Visible'] " )
258258 . shadow ( )
259259 . find ( "[ui5-button]" )
260260 . should ( "not.have.class" , "ui5-tb-popover-item" ) ;
261261
262262 // Open overflow popover
263- cy . get ( "#no-flash- toolbar" )
263+ cy . get ( "[ui5- toolbar] " )
264264 . shadow ( )
265265 . find ( ".ui5-tb-overflow-btn" )
266266 . realClick ( ) ;
267267
268268 // Verify the AlwaysOverflow items are in the popover
269- cy . get ( "#no-flash- toolbar" )
269+ cy . get ( "[ui5- toolbar] " )
270270 . shadow ( )
271271 . find ( ".ui5-tb-popover-item" )
272272 . should ( "have.length" , 2 ) ;
273273
274274 // Verify specific items are in overflow
275- cy . get ( "#always-overflow-btn1 " )
275+ cy . get ( "[ui5-toolbar-button][text='Test 2'] " )
276276 . shadow ( )
277277 . find ( "[ui5-button]" )
278278 . should ( "have.class" , "ui5-tb-popover-item" ) ;
279279
280- cy . get ( "#always-overflow-btn2 " )
280+ cy . get ( "[ui5-toolbar-button][text='Test 3'] " )
281281 . shadow ( )
282282 . find ( "[ui5-button]" )
283283 . should ( "have.class" , "ui5-tb-popover-item" ) ;
@@ -286,56 +286,55 @@ describe("Toolbar general interaction", () => {
286286 it ( "Should place dynamically added AlwaysOverflow items in overflow without flash" , ( ) => {
287287 // Start with a toolbar that already has an AlwaysOverflow item in overflow
288288 cy . mount (
289- < Toolbar id = "dynamic-overflow-toolbar" >
290- < ToolbarButton text = "First Always" icon = "employee" overflow-priority = "AlwaysOverflow" id = "first-always-btn" > </ ToolbarButton >
289+ < Toolbar >
290+ < ToolbarButton text = "First Always" icon = "employee" overflow-priority = "AlwaysOverflow" > </ ToolbarButton >
291291 </ Toolbar >
292292 ) ;
293293
294294 // Wait for initial render to complete
295295 cy . wait ( 500 ) ;
296296
297297 // Verify initial state - first AlwaysOverflow item is in overflow
298- cy . get ( "#first-always-btn " )
298+ cy . get ( "[ui5-toolbar-button][text='First Always'] " )
299299 . shadow ( )
300300 . find ( "[ui5-button]" )
301301 . should ( "have.class" , "ui5-tb-popover-item" ) ;
302302
303303 // Overflow button should be visible (not hidden)
304- cy . get ( "#dynamic-overflow- toolbar" )
304+ cy . get ( "[ui5- toolbar] " )
305305 . shadow ( )
306306 . find ( ".ui5-tb-overflow-btn" )
307307 . should ( "not.have.class" , "ui5-tb-overflow-btn-hidden" ) ;
308308
309309 // Now dynamically add ANOTHER AlwaysOverflow item while overflow is non-empty
310- cy . get ( "#dynamic-overflow- toolbar" ) . then ( $toolbar => {
310+ cy . get ( "[ui5- toolbar] " ) . then ( $toolbar => {
311311 const toolbar = $toolbar [ 0 ] as Toolbar ;
312312 const newButton = document . createElement ( "ui5-toolbar-button" ) as ToolbarButton ;
313- newButton . id = "dynamic-always-btn" ;
314313 newButton . text = "Dynamic Always" ;
315314 newButton . icon = "decline" ;
316315 newButton . overflowPriority = "AlwaysOverflow" ;
317316 toolbar . appendChild ( newButton ) ;
318317 } ) ;
319318
320319 // Verify the dynamically added item is placed in the overflow (has popover class)
321- cy . get ( "#dynamic-always-btn " )
320+ cy . get ( "[ui5-toolbar-button][text='Dynamic Always'] " )
322321 . shadow ( )
323322 . find ( "[ui5-button]" )
324323 . should ( "have.class" , "ui5-tb-popover-item" ) ;
325324
326325 // The first AlwaysOverflow item should still be in overflow
327- cy . get ( "#first-always-btn " )
326+ cy . get ( "[ui5-toolbar-button][text='First Always'] " )
328327 . shadow ( )
329328 . find ( "[ui5-button]" )
330329 . should ( "have.class" , "ui5-tb-popover-item" ) ;
331330
332331 // Open overflow popover and verify both AlwaysOverflow items are there
333- cy . get ( "#dynamic-overflow- toolbar" )
332+ cy . get ( "[ui5- toolbar] " )
334333 . shadow ( )
335334 . find ( ".ui5-tb-overflow-btn" )
336335 . realClick ( ) ;
337336
338- cy . get ( "#dynamic-overflow- toolbar" )
337+ cy . get ( "[ui5- toolbar] " )
339338 . shadow ( )
340339 . find ( ".ui5-tb-popover-item" )
341340 . should ( "have.length" , 2 ) ;
0 commit comments