Beispiel #1
0
 public function testSeeElementOnPage()
 {
     $this->module->amOnPage('/form/field');
     $this->module->seeElement('input[name=name]');
     $this->module->seeElement('descendant-or-self::input[@id="name"]');
     $this->module->dontSeeElement('#something-beyond');
     $this->module->dontSeeElement('descendant-or-self::input[@id="something-beyond"]');
 }
 /**
  * @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');
 }
Beispiel #3
0
 public function testStrictLocators()
 {
     $this->module->amOnPage('/login');
     $this->module->seeElement(['id' => 'submit-label']);
     $this->module->seeElement(['name' => 'password']);
     $this->module->seeElement(['class' => 'optional']);
     $this->module->seeElement(['css' => 'form.global_form_box']);
     $this->module->seeElement(['xpath' => \Codeception\Util\Locator::tabIndex(4)]);
     $this->module->fillField(['name' => 'password'], '123456');
     $this->module->amOnPage('/form/select');
     $this->module->selectOption(['name' => 'age'], 'child');
     $this->module->amOnPage('/form/checkbox');
     $this->module->checkOption(['name' => 'terms']);
     $this->module->amOnPage('/');
     $this->module->seeElement(['link' => 'Test']);
     $this->module->click(['link' => 'Test']);
     $this->module->seeCurrentUrlEquals('/form/hidden');
 }
 public function testWrongStrictXPathLocator()
 {
     $this->setExpectedException('Codeception\\Exception\\MalformedLocator');
     $this->module->amOnPage('/');
     $this->module->seeElement(['xpath' => 'hello<wo>rld']);
 }
Beispiel #5
0
 /**
  * https://github.com/Codeception/Codeception/issues/1409
  */
 public function testWrongXpath()
 {
     $this->shouldFail();
     $this->module->amOnPage('/');
     $this->module->seeElement('//aas[asd}[sd]a[/[');
 }
 public function testSeeElementFails()
 {
     $this->shouldFail();
     $this->module->amOnPage('/info');
     $this->module->seeElement('.alert');
 }