/** * @issue https://github.com/Codeception/Codeception/issues/2841 */ public function testSubmitFormDoesNotKeepGetParameters() { $this->module->amOnPage('/form/bug2841?stuff=other'); $this->module->fillField('#texty', 'thingshjere'); $this->module->click('#submit-registration'); $this->assertEmpty(data::get('query'), 'Query string is not empty'); }
public function testFillFieldWithAmpersand() { $this->module->amOnPage('/form/field'); $this->module->fillField('Name', 'this & that'); $this->module->click('Submit'); $form = data::get('form'); $this->assertEquals('this & that', $form['name']); }
public function testTextFieldByLabel() { $this->module->amOnPage('/form/field'); $this->module->fillField('Name', 'Nothing special'); $this->module->click('Submit'); $form = data::get('form'); $this->assertEquals('Nothing special', $form['name']); }
/** * https://github.com/Codeception/Codeception/issues/1098 */ public function testExample5() { $this->module->amOnPage('/form/example5'); $this->module->fillField('username', 'John'); $this->module->fillField('password', '1234'); $this->module->click('Login'); $this->module->seeCurrentUrlEquals('/form/example5?username=John&password=1234'); }
/** * https://github.com/Codeception/Codeception/issues/1051 */ public function testSubmitFormWithTwoSubmitButtonsSubmitsCorrectValueAfterFillField() { $this->module->amOnPage('/form/example10'); $this->module->fillField("username", "bob"); $this->module->click("#button2"); $form = data::get('form'); $this->assertTrue(isset($form['button2'])); $this->assertTrue(isset($form['username'])); $this->assertEquals('value2', $form['button2']); $this->assertEquals('bob', $form['username']); }
public function testFillFieldSquareBracketNames() { $this->module->amOnPage('/form/names-sq-brackets'); $this->module->fillField('//input[@name="input_text"]', 'filling this input'); $this->module->fillField('//input[@name="input[text][]"]', 'filling this input'); $this->module->fillField('//textarea[@name="textarea_name"]', 'filling this textarea'); $this->module->fillField('//textarea[@name="textarea[name][]"]', 'filling this textarea'); $this->module->fillField('//textarea[@name="textarea[name][]"]', 'filling this textarea once again'); $this->module->fillField('//textarea[@name="textarea_name"]', 'filling this textarea'); $this->module->fillField('//textarea[@name="textarea[name][]"]', 'filling this textarea more'); $this->module->fillField('//textarea[@name="textarea[name][]"]', 'filling this textarea most'); }
/** * @Issue https://github.com/Codeception/Codeception/issues/1585 * @Issue https://github.com/Codeception/Codeception/issues/1602 */ public function testUnreachableField() { $this->module->amOnPage('/form/bug1585'); $this->module->fillField('textarea[name="captions[]"]', 'test2'); $this->module->fillField('items[1][]', 'test3'); $this->module->fillField('input[name="users[]"]', 'davert'); $this->module->attachFile('input[name="files[]"]', 'app/avatar.jpg'); $this->module->click('Submit'); $data = data::get('form'); $this->assertContains('test3', $data['items'][1]); $this->assertContains('test2', $data['captions']); $this->assertContains('davert', $data['users']); }
public function testFillFieldWithoutPage() { $this->setExpectedException("\\Codeception\\Exception\\TestRuntime"); $this->module->fillField('#name', 'Nothing special'); }