Commit bf5bb373 by Mark

tests improved

parent 81f36ec2
...@@ -13,10 +13,15 @@ class ContactPage extends BasePage ...@@ -13,10 +13,15 @@ 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) { if (in_array($field, ['name','email','subject','verifyCode'])) {
$data["ContactForm[$name]"] = $value; $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');
} }
} }
...@@ -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