@@ -633,6 +633,14 @@ public function testDontSeeInFieldOnTextarea()
633633 $ this ->module ->dontSeeInField ('textarea ' , 'sunset ' );
634634 $ this ->module ->dontSeeInField ('descendant-or-self::textarea[@id="description"] ' , 'sunset ' );
635635 }
636+
637+ public function testSeeInFieldOnButtonWithoutFormFails ()
638+ {
639+ $ this ->shouldFail ('Element /html/body/button is not a form field or does not contain a form field ' );
640+
641+ $ this ->module ->amOnPage ('/form/field_values ' );
642+ $ this ->module ->seeInField (['name ' => 'button_without_form ' ], 'yes ' );
643+ }
636644
637645 public function testSeeInFormFields ()
638646 {
@@ -784,6 +792,14 @@ public function testGrabValueFromWithFillField()
784792 $ this ->assertSame ('new value ' , $ result );
785793 }
786794
795+ public function testGrabValueFromOnButtonWithoutFormFails ()
796+ {
797+ $ this ->shouldFail ('Element /html/body/button is not a form field or does not contain a form field ' );
798+
799+ $ this ->module ->amOnPage ('/form/field_values ' );
800+ $ this ->module ->grabValueFrom (['name ' => 'button_without_form ' ]);
801+ }
802+
787803 public function testGrabAttributeFrom ()
788804 {
789805 $ this ->module ->amOnPage ('/search ' );
@@ -1251,9 +1267,12 @@ public function testSelectTwoSubmitsByCSS()
12511267 $ this ->assertSame ('2 ' , $ form ['sandwich_select ' ]);
12521268 }
12531269
1254- protected function shouldFail ()
1270+ protected function shouldFail (? string $ message = null )
12551271 {
12561272 $ this ->expectException (AssertionFailedError::class);
1273+ if (null !== $ message ) {
1274+ $ this ->expectExceptionMessage ($ message );
1275+ }
12571276 }
12581277
12591278 /**
0 commit comments