@@ -880,6 +880,22 @@ export async function startSSEListener(ctx: Context) {
880880 ctx . log . info ( chalk . yellow . bold ( `Warning: ${ data . message } ` ) ) ;
881881 }
882882 break ;
883+ case 'CSSReport' :
884+ if ( data . buildId == ctx . build . id ) {
885+ const lines = data . message . split ( '\n' ) ;
886+ if ( lines . length < 1 ) {
887+ return ;
888+ }
889+ ctx . log . info ( chalk . green ( lines [ 0 ] ) ) ;
890+
891+ if ( lines [ 1 ] . includes ( 'Success' ) ) {
892+ lines . slice ( 1 ) . forEach ( line => ctx . log . info ( chalk . green ( line ) ) ) ;
893+ }
894+ else {
895+ lines . slice ( 1 ) . forEach ( line => ctx . log . info ( chalk . yellow ( line ) ) ) ;
896+ }
897+ break ;
898+ }
883899 case 'error' :
884900 ctx . log . debug ( 'SSE Error occurred:' , data ) ;
885901 currentConnection ?. abort ( ) ;
@@ -964,7 +980,7 @@ export function resolveCustomCSS(cssValue: string, configPath: string, logger: a
964980}
965981
966982
967- export function parseCSSFile ( cssContent : string ) : Array < {
983+ export function parseCSS ( cssContent : string ) : Array < {
968984 selector : string ;
969985 declarations : Array < { property : string ; value : string ; important : boolean } > ;
970986 source ?: { start ?: any ; end ?: any } ;
@@ -1012,13 +1028,6 @@ export function parseCSSFile(cssContent: string): Array<{
10121028 return rules ;
10131029}
10141030
1015- /**
1016- * Validate CSS selectors in the page context
1017- * @param page - Playwright page object
1018- * @param cssRules - Parsed CSS rules
1019- * @param logger - Logger instance
1020- * @returns Validation results with success and failed selectors
1021- */
10221031export async function validateCSSSelectors (
10231032 page : any ,
10241033 cssRules : Array < { selector : string ; declarations : any [ ] } > ,
@@ -1040,12 +1049,12 @@ export async function validateCSSSelectors(
10401049 selector . includes ( '@' ) ||
10411050 selector . includes ( '::' )
10421051 ) {
1043- successCount ++ ; // Count as success since they're valid CSS
1052+ successCount ++ ;
10441053 continue ;
10451054 }
10461055
10471056 try {
1048- // Validate if selector finds at least one element
1057+
10491058 const elementExists = await page . evaluate ( ( { selectorValue } : { selectorValue : string } ) => {
10501059 try {
10511060 const elements = document . querySelectorAll ( selectorValue ) ;
@@ -1075,12 +1084,6 @@ export async function validateCSSSelectors(
10751084 } ;
10761085}
10771086
1078- /**
1079- * Generate CSS injection report
1080- * @param validationResult - Results from CSS selector validation
1081- * @param logger - Logger instance
1082- * @returns Formatted report string
1083- */
10841087export function generateCSSInjectionReport (
10851088 validationResult : {
10861089 successCount : number ;
0 commit comments