Beispiel #1
0
 public function testSubmitForm()
 {
     $this->module->amOnPage('/form/complex');
     $this->module->submitForm('form', array('name' => 'Davert'));
     $form = data::get('form');
     $this->assertEquals('Davert', $form['name']);
     $this->assertEquals('kill_all', $form['action']);
 }
 public function testSubmitForm()
 {
     $this->module->amOnPage('/form/complex');
     $this->module->submitForm('form', array('name' => 'Davert', 'description' => 'Is Codeception maintainer'));
     $form = data::get('form');
     $this->assertEquals('Davert', $form['name']);
     $this->assertEquals('Is Codeception maintainer', $form['description']);
     $this->assertFalse(isset($form['disabled_fieldset']));
     $this->assertFalse(isset($form['disabled_field']));
     $this->assertEquals('kill_all', $form['action']);
 }
Beispiel #3
0
 public function testArrayFieldSubmitForm()
 {
     $this->module->amOnPage('/form/example17');
     $this->module->submitForm('form', ['FooBar' => ['bar' => 'booze'], 'Food' => ['beer' => ['yum' => ['yeah' => 'crunked']]]]);
     $data = data::get('form');
     $this->assertEquals('booze', $data['FooBar']['bar']);
     $this->assertEquals('crunked', $data['Food']['beer']['yum']['yeah']);
 }
Beispiel #4
0
 public function testSubmitFormWithoutButton() {
     $this->module->amOnPage('/form/empty');
     $this->module->submitForm('form', array(
             'text' => 'Hello!'
     ));
     $form = data::get('form');
     $this->assertEquals('Hello!', $form['text']);
 }
Beispiel #5
0
 public function testSubmitAdjacentForms()
 {
     $this->module->amOnPage('/form/submit_adjacentforms');
     $this->module->submitForm('#form-2', []);
     $data = data::get('form');
     $this->assertTrue(isset($data['second-field']));
     $this->assertFalse(isset($data['first-field']));
     $this->assertEquals('Killgore Trout', $data['second-field']);
 }
 /**
  * @Issue https://github.com/Codeception/Codeception/issues/933
  */
 public function testSubmitFormWithQueries()
 {
     $this->module->amOnPage('/form/example3');
     $this->module->seeElement('form');
     $this->module->submitForm('form', array('name' => 'jon'));
     $form = data::get('form');
     $this->assertEquals('jon', $form['name']);
     $this->module->seeCurrentUrlEquals('/form/example3?validate=yes');
 }
 public function testSubmitFormWithButtons()
 {
     $this->module->amOnPage('/form/form_with_buttons');
     $this->module->submitForm('form', array('test' => 'value'));
     $form = data::get('form');
     $this->assertFalse(isset($form['button1']) || isset($form['button2']) || isset($form['button3']) || isset($form['button4']), 'Button values should not be set');
     $this->module->amOnPage('/form/form_with_buttons');
     $this->module->submitForm('form', array('test' => 'value'), 'button3');
     $form = data::get('form');
     $this->assertFalse(isset($form['button1']) || isset($form['button2']) || isset($form['button4']), 'Button values for buttons 1, 2 and 4 should not be set');
     $this->assertTrue(isset($form['button3']), 'Button value for button3 should be set');
     $this->assertEquals($form['button3'], 'third', 'Button value for button3 should equal third');
     $this->module->amOnPage('/form/form_with_buttons');
     $this->module->submitForm('form', array('test' => 'value'), 'button4');
     $form = data::get('form');
     $this->assertFalse(isset($form['button1']) || isset($form['button2']) || isset($form['button3']), 'Button values for buttons 1, 2 and 3 should not be set');
     $this->assertTrue(isset($form['button4']), 'Button value for button4 should be set');
     $this->assertEquals($form['button4'], 'fourth', 'Button value for button4 should equal fourth');
 }
Beispiel #8
0
 public function testSubmitFormWithDocRelativePathForAction()
 {
     $this->module->amOnPage('/form/example12');
     $this->module->submitForm('form', array('test' => 'value'));
     $this->module->seeCurrentUrlEquals('/form/example11');
 }
Beispiel #9
0
 /**
  * Get facebook test user be logged in on facebook.
  * This is done by going to facebook.com
  *
  * @throws ModuleConfigException
  */
 public function haveTestUserLoggedInOnFacebook()
 {
     if (!array_key_exists('id', $this->testUser)) {
         throw new ModuleException(__CLASS__, 'Facebook test user was not found. Did you forget to create one?');
     }
     $callbackUrl = $this->browserModule->_getUrl();
     $this->browserModule->amOnUrl('https://facebook.com/login');
     $this->browserModule->submitForm('#login_form', ['email' => $this->grabFacebookTestUserEmail(), 'pass' => $this->grabFacebookTestUserPassword()]);
     // if login in successful we are back on login screen:
     $this->browserModule->dontSeeInCurrentUrl('/login');
     $this->browserModule->amOnUrl($callbackUrl);
 }