Commit 19fa5cb3 by Qiang Xue

Merge pull request #2353 from Ragazzo/tests_improved

tests improved
parents beafb99e 9e770acd
...@@ -13,10 +13,10 @@ class ContactPage extends BasePage ...@@ -13,10 +13,10 @@ class ContactPage extends BasePage
*/ */
public function submit(array $contactData) public function submit(array $contactData)
{ {
$data = []; foreach ($contactData as $field => $value) {
foreach ($contactData as $name => $value) { $inputType = ($field == 'body') ? 'textarea' : 'input';
$data["ContactForm[$name]"] = $value; $this->guy->fillField($inputType.'[name="ContactForm[' . $field . ']"]', $value);
} }
$this->guy->submitForm('#contact-form', $data); $this->guy->click('Submit','#contact-form');
} }
} }
...@@ -14,9 +14,8 @@ class LoginPage extends BasePage ...@@ -14,9 +14,8 @@ class LoginPage extends BasePage
*/ */
public function login($username, $password) public function login($username, $password)
{ {
$this->guy->submitForm('#login-form', [ $this->guy->fillField('input[name="LoginForm[username]"]',$username);
'LoginForm[username]' => $username, $this->guy->fillField('input[name="LoginForm[password]"]',$password);
'LoginForm[password]' => $password, $this->guy->click('Login','#login-form');
]);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment