tests improved

This commit is contained in:
Mark 2014-02-07 05:22:11 +04:00
parent d703b819b8
commit 1cc276076a
2 changed files with 12 additions and 8 deletions

View File

@ -13,10 +13,15 @@ class ContactPage extends BasePage
*/
public function submit(array $contactData)
{
$data = [];
foreach ($contactData as $name => $value) {
$data["ContactForm[$name]"] = $value;
foreach ($contactData as $field => $value) {
if (in_array($field, ['name','email','subject','verifyCode'])) {
$this->guy->fillField('input[name="ContactForm[' . $field .']"]', $value);
}
}
$this->guy->submitForm('#contact-form', $data);
if (isset($contactData['body'])) {
$this->guy->fillField('textarea[name="ContactForm[body]"]',$contactData['body']);
}
$this->guy->click('Submit','#contact-form');
}
}

View File

@ -14,9 +14,8 @@ class LoginPage extends BasePage
*/
public function login($username, $password)
{
$this->guy->submitForm('#login-form', [
'LoginForm[username]' => $username,
'LoginForm[password]' => $password,
]);
$this->guy->fillField('input[name="LoginForm[username]"]',$username);
$this->guy->fillField('input[name="LoginForm[password]"]',$password);
$this->guy->click('Login','#login-form');
}
}