本文整理汇总了PHP中codecept_output_dir函数的典型用法代码示例。如果您正苦于以下问题:PHP codecept_output_dir函数的具体用法?PHP codecept_output_dir怎么用?PHP codecept_output_dir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了codecept_output_dir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _failed
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');
}
示例2: _failed
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());
}
示例3: _failed
public function _failed(TestInterface $test, $fail)
{
if (!$this->client || !$this->client->getInternalResponse()) {
return;
}
$filename = preg_replace('~\\W~', '.', Descriptor::getTestSignature($test));
$filename = mb_strcut($filename, 0, 244, 'utf-8') . '.fail.html';
$this->_savePageSource(codecept_output_dir() . $filename);
}
示例4: _reconfigure
/**
* {@inheritDoc}
*
* Starts the connection
*/
public function _reconfigure($config = array())
{
parent::_reconfigure($config);
if (!isset($this->config['username'])) {
throw new \Exception("Sauce Connect Extension requires a username.");
}
if (!isset($this->config['accesskey'])) {
throw new \Exception("Sauce Connect Extension requires a accesskey.");
}
$connect = __DIR__ . '/../../../bin/sauce_connect';
if (!file_exists($connect)) {
$connect = __DIR__ . '/../../../../bin/sauce_connect';
}
if (!file_exists($connect)) {
throw new \Exception("Couldnt find the bin directory... Make sure its in ./bin or ./vendor/bin/");
}
$processBuilder = new ProcessBuilder([$connect]);
$processBuilder->addEnvironmentVariables(['SAUCE_USERNAME' => $this->config['username'], 'SAUCE_ACCESS_KEY' => $this->config['accesskey']]);
$timeout = isset($this->config['timeout']) ? $this->config['timeout'] : 60;
$this->process = $processBuilder->getProcess();
$this->process->setTimeout(0);
$this->process->start(function ($type, $buffer) {
$buffer = explode("\n", $buffer);
foreach ($buffer as $line) {
if (strpos($line, 'Press any key to see more output') === false) {
file_put_contents(codecept_output_dir() . 'sauce_connect.log', $line . "\n", FILE_APPEND);
}
}
});
$timer = 0;
$connected = false;
$this->writeln(["", "----------------------------------------------------------------------------", "Attempting to connect to SauceLabs. Waiting {$timeout} seconds."]);
while ($this->process->isRunning() && $timer < $timeout) {
$output = $this->process->getOutput();
if (strpos($output, 'Connected! You may start your tests.') !== false) {
$connected = true;
break;
}
sleep(1);
$timer++;
if ($timer % 5 === 0) {
$this->write('.');
}
}
if (false === $connected) {
$this->process->stop();
throw new \Exception(sprintf("Could not start tunnel. Check %ssauce_connect.log for more information.", codecept_output_dir()));
}
$this->writeln(["", "Connected to SauceLabs", "----------------------------------------------------------------------------", ""]);
}
示例5: failureDescription
protected function failureDescription($other)
{
$page = substr($other, 0, 300);
$message = new Message($page);
$message->style('info');
$message->prepend("\n--> ");
$message->prepend($this->uriMessage());
if (strlen($other) > 300) {
$debugMessage = new Message("[Content too long to display. See complete response in '" . codecept_output_dir() . "' directory]");
$debugMessage->style('debug')->prepend("\n");
$message->append($debugMessage);
}
$message->append("\n--> ");
return $message->getMessage() . $this->toString();
}
示例6: eyeball
/**
* Run visual inspection on browser.
*/
public function eyeball($name)
{
$filebase = codecept_output_dir() . $name;
$dirname = dirname($filebase);
if (!file_exists($dirname)) {
mkdir($dirname, 0777, true);
}
$oldFile = $filebase . self::SUFFIX;
$newFile = $filebase . self::NEWSUFFIX;
$diffFile = $filebase . self::DIFFSUFFIX;
$this->getModule('WebDriver')->_saveScreenshot($newFile);
if (file_exists($oldFile)) {
if ($this->comparer->difference($oldFile, $newFile, $diffFile) > 0) {
$this->changes[] = $filebase;
} else {
// Remove the new and diff when no changes detected.
unlink($newFile);
unlink($diffFile);
}
} else {
// New file, add it to the list.
$this->changes[] = $filebase;
}
}
示例7: absolutePath
private function absolutePath($path)
{
if (strpos($path, '/') === 0 or strpos($path, ':') === 1) {
// absolute path
return $path;
}
return codecept_output_dir() . $path;
}
示例8: _failed
public function _failed(TestInterface $test, $fail)
{
$this->debugWebDriverLogs();
$filename = str_replace([':', '\\', '/'], ['.', '', ''], Descriptor::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");
}
示例9: _failed
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");
}
示例10: persist
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()));
}
示例11: afterResult
public function afterResult()
{
if ($this->options['html']) {
$path = codecept_output_dir() . $this->options['html'];
$this->output->writeln("- <bold>HTML</bold> report generated in <comment>file://{$path}</comment>");
}
if ($this->options['xml']) {
$path = codecept_output_dir() . $this->options['xml'];
$this->output->writeln("- <bold>XML</bold> report generated in <comment>{$path}</comment>");
}
if ($this->options['tap']) {
$path = codecept_output_dir() . $this->options['tap'];
$this->output->writeln("- <bold>TAP</bold> report generated in <comment>{$path}</comment>");
}
if ($this->options['json']) {
$path = codecept_output_dir() . $this->options['json'];
$this->output->writeln("- <bold>JSON</bold> report generated in <comment>{$path}</comment>");
}
}
示例12: before
public function before(TestEvent $e)
{
$this->dir = null;
$this->stepNum = 0;
$this->slides = [];
$testName = str_replace(['::', '\\', '/'], ['.', '', ''], TestCase::getTestSignature($e->getTest()));
$this->dir = codecept_output_dir() . "record_{$this->seed}_{$testName}";
mkdir($this->dir);
}
示例13: _failed
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");
}
示例14: _failed
public function _failed(\Codeception\TestCase $test, $fail)
{
$filename = str_replace(['::', '\\', '/'], ['.', '', ''], \Codeception\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");
}
示例15: _failed
public function _failed(TestInterface $test, $fail)
{
$this->debugWebDriverLogs();
$filename = preg_replace('~\\W~', '.', Descriptor::getTestSignature($test));
$outputDir = codecept_output_dir();
$this->_saveScreenshot($outputDir . mb_strcut($filename, 0, 245, 'utf-8') . '.fail.png');
$this->_savePageSource($outputDir . mb_strcut($filename, 0, 244, 'utf-8') . '.fail.html');
$this->debug("Screenshot and page source were saved into '{$outputDir}' dir");
}