1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the Behat MinkExtension. |
5
|
|
|
* (c) Konstantin Kudryashov <[email protected]> |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please view the LICENSE |
8
|
|
|
* file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Behat\MinkExtension\ServiceContainer\Driver; |
12
|
|
|
|
13
|
|
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; |
14
|
|
|
|
15
|
|
|
class SauceLabsFactory extends Selenium2Factory |
16
|
|
|
{ |
17
|
|
|
/** |
18
|
|
|
* {@inheritdoc} |
19
|
|
|
*/ |
20
|
|
|
public function getDriverName() |
21
|
|
|
{ |
22
|
|
|
return 'sauce_labs'; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* {@inheritdoc} |
27
|
|
|
*/ |
28
|
|
|
public function configure(ArrayNodeDefinition $builder) |
29
|
|
|
{ |
30
|
|
|
$builder |
31
|
|
|
->children() |
32
|
|
|
->scalarNode('username')->defaultValue(getenv('SAUCE_USERNAME'))->end() |
33
|
|
|
->scalarNode('access_key')->defaultValue(getenv('SAUCE_ACCESS_KEY'))->end() |
34
|
|
|
->booleanNode('connect')->defaultFalse()->end() |
35
|
|
|
->scalarNode('browser')->defaultValue('firefox')->end() |
36
|
|
|
->append($this->getCapabilitiesNode()) |
37
|
|
|
->end() |
38
|
|
|
; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* {@inheritdoc} |
43
|
|
|
*/ |
44
|
|
|
public function buildDriver(array $config) |
45
|
|
|
{ |
46
|
|
|
$host = 'ondemand.saucelabs.com'; |
47
|
|
|
if ($config['connect']) { |
48
|
|
|
$host = 'localhost:4445'; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
$config['wd_host'] = sprintf('%s:%s@%s/wd/hub', $config['username'], $config['access_key'], $host); |
52
|
|
|
|
53
|
|
|
return parent::buildDriver($config); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
protected function getCapabilitiesNode() |
57
|
|
|
{ |
58
|
|
|
$node = parent::getCapabilitiesNode(); |
59
|
|
|
|
60
|
|
|
$node |
|
|
|
|
61
|
|
|
->children() |
62
|
|
|
->scalarNode('platform')->defaultValue('Linux')->end() |
63
|
|
|
->scalarNode('selenium-version')->end() |
64
|
|
|
->scalarNode('max-duration')->end() |
65
|
|
|
->scalarNode('command-timeout')->end() |
66
|
|
|
->scalarNode('idle-timeout')->end() |
67
|
|
|
->scalarNode('build')->info('will be set automatically based on the TRAVIS_BUILD_NUMBER environment variable if available')->end() |
68
|
|
|
->arrayNode('custom-data') |
69
|
|
|
->useAttributeAsKey('') |
70
|
|
|
->prototype('variable')->end() |
71
|
|
|
->end() |
72
|
|
|
->scalarNode('screen-resolution')->end() |
73
|
|
|
->scalarNode('tunnel-identifier')->info('will be set automatically based on the TRAVIS_JOB_NUMBER environment variable if available')->end() |
74
|
|
|
->arrayNode('prerun') |
75
|
|
|
->children() |
76
|
|
|
->scalarNode('executable')->isRequired()->end() |
77
|
|
|
->arrayNode('args')->prototype('scalar')->end()->end() |
78
|
|
|
->booleanNode('background')->defaultFalse()->end() |
79
|
|
|
->end() |
80
|
|
|
->end() |
81
|
|
|
->booleanNode('record-video')->end() |
82
|
|
|
->booleanNode('record-screenshots')->end() |
83
|
|
|
->booleanNode('capture-html')->end() |
84
|
|
|
->booleanNode('disable-popup-handler')->end() |
85
|
|
|
->end() |
86
|
|
|
->validate() |
87
|
|
|
->ifTrue(function ($v) {return empty($v['custom-data']);}) |
88
|
|
|
->then(function ($v) { |
89
|
|
|
unset ($v['custom-data']); |
90
|
|
|
|
91
|
|
|
return $v; |
92
|
|
|
}) |
93
|
|
|
->end() |
94
|
|
|
; |
95
|
|
|
|
96
|
|
|
return $node; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.