public function testComplexSelectorsAndForms()
 {
     $this->module->amOnPage('/login');
     $this->module->submitForm('form#user_form_login', array('email' => '*****@*****.**', 'password' => '111111'));
     $post = data::get('form');
     $this->assertEquals('*****@*****.**', $post['email']);
 }
Exemple #2
0
	public function _after(\Codeception\TestCase $test) {
		$_SESSION = array();
		$_GET = array();
		$_POST = array();
		$_COOKIE = array();
		parent::_after($test);
	}
Exemple #3
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"]');
 }
 public function testExample1()
 {
     $this->module->amOnPage('/form/example1');
     $this->module->see('Login', 'button');
     $this->module->fillField('#LoginForm_username', 'davert');
     $this->module->fillField('#LoginForm_password', '123456');
     $this->module->checkOption('#LoginForm_rememberMe');
     $this->module->click('Login');
     $login = data::get('form');
     $this->assertEquals('davert', $login['LoginForm']['username']);
     $this->assertEquals('123456', $login['LoginForm']['password']);
     $this->assertNotEmpty($login['LoginForm']['rememberMe']);
 }
Exemple #5
0
 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = array();
     $_FILES = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     $_REQUEST = array();
     if (Yii::$app) {
         Yii::$app->session->close();
     }
     parent::_after($test);
 }
Exemple #6
0
 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = array();
     $_FILES = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     $_REQUEST = array();
     if ($this->transaction and $this->config['cleanup']) {
         $this->transaction->rollback();
     }
     if (Yii::$app) {
         Yii::$app->session->close();
     }
     parent::_after($test);
 }
Exemple #7
0
 public function _after(\Codeception\TestCase $test)
 {
     $_SESSION = array();
     $_GET = array();
     $_POST = array();
     $_COOKIE = array();
     $_REQUEST = array();
     Yii::app()->session->close();
     parent::_after($test);
 }
Exemple #8
0
 public function _after(\Codeception\TestCase $test)
 {
     $this->kernel->shutdown();
     parent::_after($test);
 }
Exemple #9
0
 protected function proceedSee($text, $selector = null)
 {
     if ($selector) {
         $nodes = null;
         if (Locator::isCSS($selector)) {
             $nodes = $this->session->getPage()->findAll('css', $selector);
         }
         if (!$nodes and Locator::isXPath($selector)) {
             $nodes = $this->session->getPage()->findAll('xpath', $selector);
         }
         if (empty($nodes)) {
             throw new ElementNotFound($selector, 'CSS or XPath');
         }
         $values = '';
         foreach ($nodes as $node) {
             $values .= '<!-- Merged Output -->' . $node->getText();
         }
         return array('pageContains', $this->escape($text), $values, "'{$selector}' selector.");
     }
     $response = $this->session->getPage()->getText();
     $output = Framework::formatResponse($response);
     return array('pageContains', $this->escape($text), $response, "'{$text}' in " . $output . '.');
 }
Exemple #10
0
 protected function proceedSee($text, $selector = null)
 {
     $response = $this->browser->getResponse()->getContent();
     if ($selector) {
         $nodes = $this->browser->getResponseDomCssSelector()->matchAll($selector);
         $values = '';
         foreach ($nodes as $node) {
             $values .= '<!-- Merged Output -->' . trim($node->nodeValue);
         }
         $response = Framework::formatResponse($response);
         return array('pageContains', $text, $values, "'{$selector}' on {$response}");
     }
     $response = Framework::formatResponse($response);
     return array('pageContains', $text, strip_tags($this->browser->getResponse()->getContent()), "on {$response}.");
 }
Exemple #11
0
 public function __construct($config = null)
 {
     $this->config = array_merge(array('cleanup' => true, 'start' => 'bootstrap' . DIRECTORY_SEPARATOR . 'start.php'), (array) $config);
     parent::__construct();
 }
Exemple #12
0
 protected function proceedSee($text, $selector = null)
 {
     if ($selector) {
         try {
             $nodes = $this->session->getPage()->findAll('css', $selector);
         } catch (\Symfony\Component\CssSelector\Exception\ParseException $e) {
             $nodes = $this->session->getPage()->findAll('xpath', $selector);
         }
         $values = '';
         foreach ($nodes as $node) {
             $values .= '<!-- Merged Output -->' . $node->getText();
         }
         return array('pageContains', $this->escape($text), $values, "'{$selector}' selector.");
     }
     $response = $this->session->getPage()->getText();
     $output = Framework::formatResponse($response);
     return array('pageContains', $this->escape($text), $response, "'{$text}' in " . $output . '.');
 }