public function _failed(TestCase $test, $fail) { if (!$this->client || !$this->client->getInternalResponse()) { return; } $this->_savePageSource(codecept_output_dir() . str_replace(['::', '\\', '/'], ['.', '.', '.'], TestCase::getTestSignature($test)) . '.fail.html'); }
public function _failed(TestCase $test, $fail) { if (!$this->client || !$this->client->getInternalResponse()) { return; } $filename = str_replace(['::', '\\', '/'], ['.', '', ''], TestCase::getTestSignature($test)) . '.fail.html'; file_put_contents(codecept_output_dir($filename), $this->client->getInternalResponse()->getContent()); }
/** * @group core */ public function testCeptNamings() { $cept = new \Codeception\TestCase\Cept(); $cept->configName('LoginCept.php')->config('testFile', 'tests/acceptance/LoginCept.php'); $this->assertEquals('tests/acceptance/LoginCept.php', \Codeception\TestCase::getTestFileName($cept)); $this->assertEquals('tests/acceptance/LoginCept.php', \Codeception\TestCase::getTestFullName($cept)); $this->assertEquals('LoginCept', \Codeception\TestCase::getTestSignature($cept)); }
/** * @group core */ public function testCestNamings() { $cept = new \Codeception\TestCase\Cest(); $klass = new stdClass(); $cept->config('testClassInstance', $klass)->config('testMethod', 'user')->config('testFile', 'tests/acceptance/LoginCest.php'); $this->assertEquals('tests/acceptance/LoginCest.php:user', \Codeception\TestCase::getTestFullName($cept)); $this->assertEquals('tests/acceptance/LoginCest.php', \Codeception\TestCase::getTestFileName($cept)); $this->assertEquals('stdClass::user', \Codeception\TestCase::getTestSignature($cept)); }
protected function getTestNames($tests) { $testNames = []; foreach ($tests as $test) { if ($test instanceof \PHPUnit_Framework_TestCase) { $testNames[] = \Codeception\TestCase::getTestSignature($test); } } return $testNames; }
protected function assertContainsTestName($name, $tests) { foreach ($tests as $test) { if ($test instanceof \PHPUnit_Framework_TestCase) { $testName = \Codeception\TestCase::getTestSignature($test); if ($testName == $name) { return; } codecept_debug($testName); } } $this->fail("{$name} not found in tests"); }
public function _failed(\Codeception\TestCase $test, $fail) { $filename = str_replace(['::', '\\', '/'], ['.', '', ''], \Codeception\TestCase::getTestSignature($test)) . '.fail.png'; $this->_saveScreenshot(codecept_output_dir($filename)); $this->debug("Screenshot was saved into '_output' dir"); }
public function persist(TestEvent $e) { if (!$this->webDriverModule or !$this->dir) { return; } $indicatorHtml = ''; $slideHtml = ''; foreach ($this->slides as $i => $step) { $indicatorHtml .= (new Template($this->indicatorTemplate))->place('step', (int) $i)->place('isActive', (int) $i ? '' : 'class="active"')->produce(); $slideHtml .= (new Template($this->slidesTemplate))->place('image', $i)->place('caption', $step->getHumanizedArguments())->place('isActive', (int) $i ? '' : 'active')->place('isError', $step->hasFailed() ? 'error' : '')->produce(); } $html = (new Template($this->template))->place('indicators', $indicatorHtml)->place('slides', $slideHtml)->place('feature', ucfirst($e->getTest()->getFeature()))->place('test', TestCase::getTestSignature($e->getTest()))->produce(); $indexFile = $this->dir . DIRECTORY_SEPARATOR . 'index.html'; file_put_contents($indexFile, $html); $testName = TestCase::getTestSignature($e->getTest()) . ' - ' . ucfirst($e->getTest()->getFeature()); $this->recordedTests[$testName] = substr($indexFile, strlen(codecept_output_dir())); }
public function _failed(TestCase $test, $fail) { $this->debugWebDriverLogs(); $filename = str_replace(['::', '\\', '/'], ['.', '', ''], TestCase::getTestSignature($test)) . '.fail'; $this->_saveScreenshot(codecept_output_dir() . $filename . '.png'); $this->_savePageSource(codecept_output_dir() . $filename . '.html'); $this->debug("Screenshot and page source were saved into '_output' dir"); }
public function persist(TestEvent $e) { if (!$this->webDriverModule or !$this->dir) { return; } $indicatorHtml = ''; $slideHtml = ''; foreach ($this->slides as $i => $step) { $indicatorHtml .= (new Template($this->indicatorTemplate))->place('step', (int) $i)->place('isActive', (int) $i ? '' : 'class="active"')->produce(); $slideHtml .= (new Template($this->slidesTemplate))->place('image', $i)->place('caption', $step->getHtml('#3498db'))->place('isActive', (int) $i ? '' : 'active')->place('isError', $step->hasFailed() ? 'error' : '')->produce(); } $html = (new Template($this->template))->place('indicators', $indicatorHtml)->place('slides', $slideHtml)->place('feature', ucfirst($e->getTest()->getFeature()))->place('test', TestCase::getTestSignature($e->getTest()))->produce(); file_put_contents($this->dir . DIRECTORY_SEPARATOR . 'index.html', $html); }
public function _failed(\Codeception\TestCase $test, $fail) { $filename = str_replace(['::', '\\', '/'], ['.', '', ''], \Codeception\TestCase::getTestSignature($test)) . '.fail'; $this->_saveScreenshot(codecept_output_dir() . $filename . '.png'); file_put_contents(codecept_output_dir() . $filename . '.html', $this->webDriver->getPageSource()); $this->debug("Screenshot and HTML snapshot were saved into '_output' dir"); }