File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -1003,6 +1003,18 @@ private function getFormFromCrawler(Crawler $form)
10031003    {
10041004        $ fakeDomnew  \DOMDocument ();
10051005        $ fakeDomappendChild ($ fakeDomimportNode ($ formgetNode (0 ), true ));
1006+ 
1007+         //add fields having form attribute with id of this form 
1008+         $ formId$ formattr ('id ' );
1009+         if  ($ formIdnull ) {
1010+             $ fakeForm$ fakeDomfirstChild ;
1011+             $ topParent$ formparents ()->last ();
1012+             $ fieldsByFormAttribute$ topParentfilter ("input[form= $ formId],select[form= $ formId],textarea[form= $ formId] " );
1013+             foreach  ($ fieldsByFormAttributeas  $ field
1014+                 $ fakeFormappendChild ($ fakeDomimportNode ($ fieldtrue ));
1015+             }
1016+         }
1017+ 
10061018        $ node$ fakeDomdocumentElement ;
10071019        $ actionstring )$ this getFormUrl ($ form
10081020        $ clonednew  Crawler ($ node$ action$ this getBaseUrl ());
Original file line number Diff line number Diff line change 1+ <html >
2+ <body >
3+     <div  class = " login-container2"  
4+         <form  action = " /form/button" id = " form1" accept-charset = " utf-8" method = " post" form > 
5+         <div  class = " form-element-row"  
6+             <button  form = " form1" name = " btn[login]" class = " primary small" button > 
7+         </div > 
8+         <div  class = " form-element-row"  
9+             <input  type = " text" id = " form1-username" name = " username" placeholder = " User code" form = " form1"  
10+         </div > 
11+         <div  class = " form-element-row"  
12+             <input  type = " password" id = " form1-password" name = " password" placeholder = " Password" form = " form1"  
13+         </div > 
14+     </div > 
15+ body >
16+ </html >
Original file line number Diff line number Diff line change @@ -1684,6 +1684,17 @@ public function testClickButtonWithFormInvalidIdOutside()
16841684        $ this module ->click ('Invalid form ' );
16851685    }
16861686
1687+     /** 
1688+      * https://github.com/Codeception/Codeception/issues/6022 
1689+      */ 
1690+     public  function  testFillFieldNotInForm ()
1691+     {
1692+         $ this module ->amOnPage ('/form/input-not-in-form ' );
1693+         $ this module ->seeElement ("form " ,["id "  => "form1 " ]);
1694+         $ this module ->seeElement ("input " ,["name "  => "username " ]);
1695+         $ this module ->fillField ("username " ,"usr-code " );
1696+     }
1697+ 
16871698    public  function  testSubmitHashForm ()
16881699    {
16891700        $ this module ->amOnPage ('/form/anchor ' );
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments