@@ -175,7 +175,7 @@ public void GenerateTests() =>
175175 settings =>
176176 {
177177 settings . Mode = TestGenerationMode . HybridArtificialBeeColony ;
178- settings . TestCaseCategory = TestCaseCategory . Validation ;
178+ settings . TestCaseCategory = TestCaseCategory . Valid ;
179179 settings . ABCSettings = new ABCGenerationSettings
180180 {
181181 TotalPopulationGenerations = 100 ,
@@ -337,5 +337,99 @@ public void SubmitForm_WithValidation(
337337 }
338338 }
339339
340+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+3598888" , "Aa1@abcd" , 18 , "01-01-1990" , "http://a.co" , true , "United States" , new [ ] { "German" } , "" ) ]
341+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+359888888888" , "Aa1@xxxxxxxxxxxxxxxx" , 100 , "01-01-1920" , "http://a.co" , true , "Germany" , new [ ] { "German" } , "" ) ]
342+ [ TestCase ( "Ann" , "a@e.io" , "+3598888" , "Aa1@abcd" , 18 , "01-01-1920" , "http://a.co" , true , "France" , new [ ] { "English" , "French" } , "" ) ]
343+ [ TestCase ( "AAAAAAAAAAAAAAAAAAAA" , "valid.email+tagging@domain.fr" , "+3598888" , "Aa1@abcd" , 100 , "01-01-1920" , "https://example.com" , true , "Germany" , new [ ] { "English" , "French" , "German" } , "" ) ]
344+ [ TestCase ( "Ann" , "a@e.io" , "+3598888" , "Secure1!" , 100 , "31-12-2020" , "http://a.co" , true , "United States" , new [ ] { "German" } , "" ) ]
345+ [ TestCase ( "AAAAAAAAAAAAAAAAAAAA" , "a@e.io" , "+3598888" , "Aa1@xxxxxxxxxxxxxxxx" , 25 , "01-01-1920" , "https://very-long-url.com/with/path" , true , "Germany" , new [ ] { "English" , "French" , "German" } , "" ) ]
346+ [ TestCase ( "Ann" , "a@e.io" , "+359888888888" , "Aa1@abcd" , 18 , "01-01-1920" , "https://very-long-url.com/with/path" , true , "Germany" , new [ ] { "English" , "French" , "German" } , "" ) ]
347+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+359888888888" , "Aa1@abcd" , 18 , "01-01-1920" , "http://a.co" , true , "France" , new [ ] { "English" , "French" , "German" } , "" ) ]
348+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+3598888" , "Aa1@abcd" , 18 , "01-01-1990" , "http://a.co" , true , "Germany" , new [ ] { "German" } , "" ) ]
349+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+359888888888888" , "Aa1@abcd" , 25 , "31-12-2020" , "http://a.co" , true , "United States" , new [ ] { "German" } , "" ) ]
350+ [ TestCase ( "Ann" , "a@e.io" , "+3598888" , "Aa1@abcd" , 18 , "31-12-2020" , "https://very-long-url.com/with/path" , true , "Germany" , new [ ] { "English" , "French" } , "" ) ]
351+ [ TestCase ( "AAAAAAAAAAAAAAAAAAAA" , "a@e.io" , "+359888888888" , "Aa1@abcd" , 18 , "01-01-1920" , "http://a.co" , true , "United States" , new [ ] { "German" } , "" ) ]
352+ [ TestCase ( "Ann" , "a@e.io" , "+3598888" , "Secure1!" , 100 , "31-12-2020" , "https://very-long-url.com/with/path" , true , "United States" , new [ ] { "German" } , "" ) ]
353+ [ TestCase ( "Anton Angelov" , "a@e.io" , "+359888888888888" , "Aa1@xxxxxxxxxxxxxxxx" , 100 , "01-01-1920" , "https://very-long-url.com/with/path" , true , "France" , new [ ] { "English" , "French" , "German" } , "" ) ]
354+ [ TestCase ( "Ann" , "anton@example.com" , "+359888888888888" , "Aa1@xxxxxxxxxxxxxxxx" , 18 , "01-01-1990" , "http://a.co" , true , "France" , new [ ] { "German" } , "" ) ]
355+ [ TestCase ( "Ann" , "a@e.io" , "+359888888888888" , "Secure1!" , 100 , "01-01-1920" , "https://example.com" , true , "Germany" , new [ ] { "English" , "French" , "German" } , "" ) ]
356+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+3598888" , "Secure1!" , 25 , "01-01-1920" , "https://very-long-url.com/with/path" , true , "United States" , new [ ] { "English" , "French" , "German" } , "" ) ]
357+ [ TestCase ( "AAAAAAAAAAAAAAAAAAAA" , "anton@example.com" , "+359888888888" , "Aa1@xxxxxxxxxxxxxxxx" , 100 , "01-01-1920" , "https://very-long-url.com/with/path" , true , "France" , new [ ] { "English" , "French" , "German" } , "" ) ]
358+ [ TestCase ( "AAAAAAAAAAAAAAAAAAAA" , "anton@example.com" , "+3598888" , "Aa1@xxxxxxxxxxxxxxxx" , 25 , "31-12-2020" , "https://very-long-url.com/with/path" , true , "United States" , new [ ] { "English" , "French" , "German" } , "" ) ]
359+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+359888888888888" , "Aa1@abcd" , 25 , "31-12-2020" , "https://example.com" , true , "France" , new [ ] { "German" } , "" ) ]
360+ [ TestCase ( "Anton Angelov" , "a@e.io" , "+359888888888888" , "Aa1@abcd" , 18 , "01-01-1990" , "http://a.co" , true , "Germany" , new [ ] { "English" , "French" , "German" } , "" ) ]
361+ [ TestCase ( "Ann" , "anton@example.com" , "+359888888888" , "Aa1@abcd" , 18 , "01-01-1920" , "https://very-long-url.com/with/path" , true , "United States" , new [ ] { "English" , "French" , "German" } , "" ) ]
362+ [ TestCase ( "Anton Angelov" , "a@e.io" , "+359888888888888" , "Aa1@abcd" , 100 , "01-01-1990" , "http://a.co" , true , "Germany" , new [ ] { "English" , "French" , "German" } , "" ) ]
363+ [ TestCase ( "Ann" , "a@e.io" , "+3598888" , "Aa1@abcd" , 25 , "01-01-1990" , "http://a.co" , true , "Germany" , new [ ] { "German" } , "" ) ]
364+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+359888888888" , "Aa1@abcd" , 100 , "01-01-1920" , "https://example.com" , true , "United States" , new [ ] { "German" } , "" ) ]
365+ [ TestCase ( "AAAAAAAAAAAAAAAAAAAA" , "anton@example.com" , "+3598888" , "Aa1@abcd" , 18 , "31-12-2020" , "http://a.co" , true , "France" , new [ ] { "English" , "French" } , "" ) ]
366+ [ TestCase ( "AAAAAAAAAAAAAAAAAAAA" , "anton@example.com" , "+359888888888888" , "Aa1@xxxxxxxxxxxxxxxx" , 25 , "01-01-1920" , "http://a.co" , true , "United States" , new [ ] { "German" } , "" ) ]
367+ [ TestCase ( "Ann" , "valid.email+tagging@domain.fr" , "+359888888888" , "Aa1@abcd" , 100 , "31-12-2020" , "https://very-long-url.com/with/path" , true , "Germany" , new [ ] { "English" , "French" } , "" ) ]
368+ [ TestCase ( "Ann" , "a@e.io" , "+3598888" , "Aa1@abcd" , 100 , "31-12-2020" , "https://example.com" , true , "France" , new [ ] { "English" , "French" } , "" ) ]
369+ [ TestCase ( "Ann" , "a@e.io" , "+3598888" , "Secure1!" , 25 , "01-01-1920" , "https://very-long-url.com/with/path" , true , "Germany" , new [ ] { "German" } , "" ) ]
370+ [ TestCase ( "AAAAAAAAAAAAAAAAAAAA" , "a@e.io" , "+359888888888" , "Aa1@abcd" , 18 , "01-01-1990" , "https://very-long-url.com/with/path" , true , "United States" , new [ ] { "German" } , "" ) ]
371+ [ Ignore ]
372+ public void SuccessMessageDisplayed_WhenSubmitFormWithValidParameters (
373+ string fullName , string email , string phone , string password , int age ,
374+ string birthdate , string website , bool ? terms , string country , string [ ] languages , string expectedError )
375+ {
376+ _driver . Navigate ( ) . Refresh ( ) ;
377+
378+ Console . WriteLine ( "=== Input Parameters ===" ) ;
379+ Console . WriteLine ( $ "Full Name: { fullName } ") ;
380+ Console . WriteLine ( $ "Email: { email } ") ;
381+ Console . WriteLine ( $ "Phone: { phone } ") ;
382+ Console . WriteLine ( $ "Password: { password } ") ;
383+ Console . WriteLine ( $ "Age: { age } ") ;
384+ Console . WriteLine ( $ "Birthdate: { birthdate } ") ;
385+ Console . WriteLine ( $ "Website: { website } ") ;
386+ Console . WriteLine ( $ "Terms Accepted: { terms } ") ;
387+ Console . WriteLine ( $ "Country: { country } ") ;
388+ Console . WriteLine ( $ "Languages: { string . Join ( ", " , languages ?? Array . Empty < string > ( ) ) } ") ;
389+ Console . WriteLine ( $ "Expected Error: { expectedError } ") ;
390+
391+ _driver . FindElement ( By . Id ( "fullName" ) ) . SendKeys ( fullName ) ;
392+ _driver . FindElement ( By . Id ( "email" ) ) . SendKeys ( email ) ;
393+ _driver . FindElement ( By . Id ( "phone" ) ) . SendKeys ( phone ) ;
394+ _driver . FindElement ( By . Id ( "password" ) ) . SendKeys ( password ) ;
395+ _driver . FindElement ( By . Id ( "age" ) ) . SendKeys ( age . ToString ( ) ) ;
396+ _driver . FindElement ( By . Id ( "birthdate" ) ) . SendKeys ( birthdate ) ;
397+ _driver . FindElement ( By . Id ( "website" ) ) . SendKeys ( website ) ;
398+ if ( terms == true ) _driver . FindElement ( By . Id ( "terms" ) ) . Click ( ) ;
399+ if ( country != null ) new SelectElement ( _driver . FindElement ( By . Id ( "country" ) ) ) . SelectByText ( country ) ;
400+
401+ if ( languages != null )
402+ {
403+ foreach ( var l in languages )
404+ {
405+ new SelectElement ( _driver . FindElement ( By . Id ( "languages" ) ) ) . SelectByText ( l ) ;
406+ }
407+ }
408+
409+ var submitButton = _driver . FindElement ( By . CssSelector ( "button[type='submit']" ) ) ;
410+ new Actions ( _driver ) . MoveToElement ( submitButton ) . Click ( ) . Perform ( ) ;
411+
412+
413+ var invalidFeedbackDivs = _driver . FindElements ( By . ClassName ( "invalid-feedback" ) )
414+ . Where ( div => div . Displayed && ! string . IsNullOrWhiteSpace ( div . Text ) )
415+ . ToList ( ) ;
416+ if ( invalidFeedbackDivs . Any ( ) )
417+ {
418+ Console . WriteLine ( "=== Displayed Validation Messages ===" ) ;
419+ Debug . WriteLine ( "=== Displayed Validation Messages ===" ) ;
420+ foreach ( var feedback in invalidFeedbackDivs )
421+ {
422+ Console . WriteLine ( $ "- { feedback . Text } ") ;
423+ Debug . WriteLine ( $ "- { feedback . Text } ") ;
424+ }
425+
426+ Assert . Fail ( "Expected success message to be visible but there were validation messages displayed." ) ;
427+ }
428+ else
429+ {
430+ var successMsg = _driver . FindElement ( By . Id ( "successMsg" ) ) ;
431+ Assert . That ( successMsg . Displayed , Is . True , "Expected success message to be visible." ) ;
432+ }
433+ }
340434
341435}
0 commit comments