Skip to content

Commit c718a04

Browse files
committed
Reproduced issue 6022
Can't fill field outside form when the field has form attribute
1 parent 3e03a13 commit c718a04

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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">Login</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>

tests/unit/Codeception/Module/TestsForWeb.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff 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');

0 commit comments

Comments
 (0)