@@ -38,7 +38,7 @@ test.describe('Form Validation Edge Cases', () => {
3838
3939 // Either truncated or validation error shown
4040 const actualValue = await firstNameInput . inputValue ( ) ;
41- const hasError = await page . locator ( '.mat-error, .error' ) . filter ( { hasText : / l e n g t h | m a x | c h a r a c t e r s / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
41+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . filter ( { hasText : / l e n g t h | m a x | c h a r a c t e r s / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
4242
4343 expect ( actualValue . length <= 150 || hasError ) . toBe ( true ) ;
4444 } ) ;
@@ -76,7 +76,7 @@ test.describe('Form Validation Edge Cases', () => {
7676 await page . waitForTimeout ( 500 ) ;
7777
7878 // Check for validation errors
79- const hasError = await page . locator ( '.mat-error, .error' ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
79+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
8080
8181 if ( ! testCase . valid ) {
8282 expect ( hasError ) . toBe ( true ) ;
@@ -111,7 +111,7 @@ test.describe('Form Validation Edge Cases', () => {
111111 await emailInput . blur ( ) ;
112112 await page . waitForTimeout ( 500 ) ;
113113
114- const hasError = await page . locator ( '.mat-error, .error' ) . filter ( { hasText : / e m a i l | v a l i d | f o r m a t / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
114+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . filter ( { hasText : / e m a i l | v a l i d | f o r m a t / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
115115 expect ( hasError ) . toBe ( true ) ;
116116 }
117117
@@ -129,7 +129,7 @@ test.describe('Form Validation Edge Cases', () => {
129129 await emailInput . blur ( ) ;
130130 await page . waitForTimeout ( 500 ) ;
131131
132- const hasError = await page . locator ( '.mat-error, .error' ) . filter ( { hasText : / e m a i l | v a l i d | f o r m a t / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
132+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . filter ( { hasText : / e m a i l | v a l i d | f o r m a t / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
133133 expect ( hasError ) . toBe ( false ) ;
134134 }
135135 } ) ;
@@ -149,7 +149,7 @@ test.describe('Form Validation Edge Cases', () => {
149149 await salaryInput . blur ( ) ;
150150 await page . waitForTimeout ( 500 ) ;
151151
152- const hasError = await page . locator ( '.mat-error, .error' ) . filter ( { hasText : / p o s i t i v e | n e g a t i v e | g r e a t e r | i n v a l i d / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
152+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . filter ( { hasText : / p o s i t i v e | n e g a t i v e | g r e a t e r | i n v a l i d / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
153153 const submitButton = page . locator ( 'button[type="submit"]' ) ;
154154 const isDisabled = await submitButton . isDisabled ( ) . catch ( ( ) => false ) ;
155155
@@ -172,7 +172,7 @@ test.describe('Form Validation Edge Cases', () => {
172172 await salaryInput . blur ( ) ;
173173 await page . waitForTimeout ( 500 ) ;
174174
175- const hasError = await page . locator ( '.mat-error, .error' ) . filter ( { hasText : / g r e a t e r | z e r o | p o s i t i v e / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
175+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . filter ( { hasText : / g r e a t e r | z e r o | p o s i t i v e / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
176176
177177 expect ( hasError || true ) . toBe ( true ) ;
178178 }
@@ -194,7 +194,7 @@ test.describe('Form Validation Edge Cases', () => {
194194 await salaryInput . blur ( ) ;
195195 await page . waitForTimeout ( 500 ) ;
196196
197- const hasError = await page . locator ( '.mat-error, .error' ) . filter ( { hasText : / m a x | l a r g e | l i m i t / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
197+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . filter ( { hasText : / m a x | l a r g e | l i m i t / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
198198 const actualValue = await salaryInput . inputValue ( ) ;
199199
200200 // Either shows error or truncates/limits the value
@@ -233,7 +233,7 @@ test.describe('Form Validation Edge Cases', () => {
233233
234234 // Should either reject or sanitize
235235 const actualValue = await firstNameInput . inputValue ( ) ;
236- const hasError = await page . locator ( '.mat-error, .error' ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
236+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
237237
238238 // Value should be sanitized or show error
239239 expect ( actualValue !== injection || hasError ) . toBe ( true ) ;
@@ -301,7 +301,7 @@ test.describe('Form Validation Edge Cases', () => {
301301 await firstNameInput . blur ( ) ;
302302 await page . waitForTimeout ( 500 ) ;
303303
304- const hasError = await page . locator ( '.mat-error, .error' ) . filter ( { hasText : / r e q u i r e d | e m p t y | i n v a l i d / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
304+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . filter ( { hasText : / r e q u i r e d | e m p t y | i n v a l i d / i } ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
305305 const submitButton = page . locator ( 'button[type="submit"]' ) ;
306306 const isDisabled = await submitButton . isDisabled ( ) . catch ( ( ) => false ) ;
307307
@@ -330,7 +330,7 @@ test.describe('Form Validation Edge Cases', () => {
330330 await page . waitForTimeout ( 2000 ) ;
331331
332332 // Should either trim automatically or show validation error
333- const hasError = await page . locator ( '.mat-error, .error' ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
333+ const hasError = await page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) . isVisible ( { timeout : 1000 } ) . catch ( ( ) => false ) ;
334334 const submitted = ! page . url ( ) . includes ( 'create' ) ;
335335
336336 expect ( ! hasError || submitted ) . toBe ( true ) ;
@@ -358,7 +358,7 @@ test.describe('Form Validation Edge Cases', () => {
358358 await page . waitForTimeout ( 500 ) ;
359359
360360 // Should show multiple errors
361- const errors = page . locator ( '.mat-error, .error' ) ;
361+ const errors = page . locator ( 'mat-error, .mat-mdc-form-field- error, .mat- error' ) ;
362362 const errorCount = await errors . count ( ) ;
363363
364364 expect ( errorCount ) . toBeGreaterThanOrEqual ( 1 ) ;
0 commit comments