1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace BeubiQA\Application\Command; |
4
|
|
|
|
5
|
|
|
use BeubiQA\Application\Selenium\SeleniumHandler; |
6
|
|
|
use Symfony\Component\Console\Command\Command; |
7
|
|
|
use Symfony\Component\Console\Input\InputInterface; |
8
|
|
|
use Symfony\Component\Console\Input\InputOption; |
9
|
|
|
use Symfony\Component\Console\Output\OutputInterface; |
10
|
|
|
|
11
|
|
|
class ShowSeleniumCommand extends Command |
12
|
|
|
{ |
13
|
|
|
/** @var SeleniumHandler */ |
14
|
|
|
protected $seleniumHandler; |
15
|
|
|
|
16
|
|
|
public function __construct(SeleniumHandler $seleniumHandler) |
17
|
|
|
{ |
18
|
|
|
$this->seleniumHandler = $seleniumHandler; |
19
|
|
|
parent::__construct('start'); |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
protected function configure() |
23
|
|
|
{ |
24
|
|
|
$this |
25
|
|
|
->setName('show') |
26
|
|
|
->setDescription('Displays selenium server log (tails the log file)') |
27
|
|
|
->addOption( |
28
|
|
|
'log-location', |
29
|
|
|
null, |
30
|
|
|
InputOption::VALUE_REQUIRED, |
31
|
|
|
'Set the location of the selenium.log file', |
32
|
|
|
'selenium.log' |
33
|
|
|
) |
34
|
|
|
->addOption( |
35
|
|
|
'follow', |
36
|
|
|
'f', |
37
|
|
|
InputOption::VALUE_OPTIONAL, |
38
|
|
|
'Follow selenium log. You may choose a specific level to follow. E.g. --follow ERROR ', |
39
|
|
|
'INFO' |
40
|
|
|
); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @param InputInterface $input |
45
|
|
|
* @param OutputInterface $output |
46
|
|
|
* |
47
|
|
|
* @throws \RuntimeException |
48
|
|
|
*/ |
49
|
|
|
protected function execute(InputInterface $input, OutputInterface $output) |
50
|
|
|
{ |
51
|
|
|
$options = []; |
52
|
|
|
$options['follow'] = $input->getOption('follow'); |
53
|
|
|
$options['log-location'] = $input->getOption('log-location'); |
54
|
|
|
|
55
|
|
|
$output->writeln('Displaying '.$options['log-location'].' file:'.PHP_EOL); |
56
|
|
|
$this->seleniumHandler->watch($options); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|