@@ -830,13 +830,14 @@ WHERE {
830830 const result = await page . evaluate ( ( ) => {
831831 return {
832832 barExists : ! ! document . querySelector ( ".yasqe_snippetsBar" ) ,
833- snippetCount : document . querySelectorAll ( ".yasqe_snippetButton " ) . length ,
833+ dropdownCount : document . querySelectorAll ( ".yasqe_snippetDropdown " ) . length ,
834834 snippets : window . yasqe . config . snippets . map ( ( s : any ) => s . label ) ,
835835 } ;
836836 } ) ;
837837
838838 expect ( result . barExists ) . to . be . true ;
839- expect ( result . snippetCount ) . to . equal ( 5 ) ;
839+ // With grouped snippets, we should have 2 dropdown buttons (Query Types and Patterns)
840+ expect ( result . dropdownCount ) . to . be . at . least ( 2 ) ;
840841 expect ( result . snippets ) . to . include ( "SELECT" ) ;
841842 expect ( result . snippets ) . to . include ( "CONSTRUCT" ) ;
842843 expect ( result . snippets ) . to . include ( "ASK" ) ;
@@ -851,8 +852,18 @@ WHERE {
851852 window . yasqe . getDoc ( ) . setCursor ( { line : 1 , ch : 2 } ) ;
852853 } ) ;
853854
854- // Click the FILTER snippet button
855- await page . click ( 'button[aria-label="Insert FILTER snippet"]' ) ;
855+ // Click the "Patterns" dropdown button to open it
856+ await page . click ( 'button[aria-label="Patterns snippets"]' ) ;
857+
858+ // Wait for dropdown to open
859+ await page . waitForSelector ( '.yasqe_snippetDropdownContent[style*="display: block"]' ) ;
860+
861+ // Click the FILTER snippet item
862+ await page . evaluate ( ( ) => {
863+ const items = Array . from ( document . querySelectorAll ( ".yasqe_snippetDropdownItem" ) ) ;
864+ const filterItem = items . find ( ( item ) => item . textContent === "FILTER" ) as HTMLElement ;
865+ if ( filterItem ) filterItem . click ( ) ;
866+ } ) ;
856867
857868 const value = await page . evaluate ( ( ) => window . yasqe . getValue ( ) ) ;
858869 expect ( value ) . to . include ( "FILTER (?var > 100)" ) ;
0 commit comments