File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 1
1
<html >
2
2
<body >
3
+
3
4
<div >
4
- <button >The Button</button >
5
+ <form action = " /form/button" method = " POST" id = " form-id" >
6
+ <input type = " hidden" name = " text" value = " val" />
7
+ <button type = " submit" name = " btn0" >Submit</button >
8
+ </form >
9
+ </div >
10
+
11
+ <div >
12
+ <input type = " submit" form = " form-id" value = " Submit 2" />
5
13
</div >
6
14
</body >
7
15
</html >
Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
+ use Codeception \Exception \TestRuntimeException ;
3
4
use Codeception \Util \Stub ;
4
5
5
6
require_once 'tests/data/app/data.php ' ;
@@ -604,9 +605,10 @@ public function testClickSelectsClickableElementFromMatchesUsingCssLocator()
604
605
605
606
public function testClickingOnButtonOutsideFormDoesNotCauseFatalError ()
606
607
{
607
- $ this ->expectException (AssertionFailedError::class);
608
+ $ this ->expectException (TestRuntimeException::class);
609
+ $ this ->expectExceptionMessage ('Button is not inside a link or a form ' );
608
610
$ this ->module ->amOnPage ('/form/button-not-in-form ' );
609
- $ this ->module ->click (' The Button ' );
611
+ $ this ->module ->click ([ ' xpath ' => ' //input[@type="submit"][@form="form-id"] ' ] );
610
612
}
611
613
612
614
public function testSubmitFormWithoutEmptyOptionsInSelect ()
You can’t perform that action at this time.
0 commit comments