-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbehat.php
More file actions
83 lines (75 loc) 路 2.83 KB
/
Copy pathbehat.php
File metadata and controls
83 lines (75 loc) 路 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
declare(strict_types=1);
use Behat\Config\Config;
use Behat\Config\Extension;
use Behat\Config\Formatter\JUnitFormatter;
use Behat\Config\Formatter\PrettyFormatter;
use Behat\Config\Profile;
use Behat\Config\Suite;
use Behat\Config\TesterOptions;
use Behat\MinkExtension\ServiceContainer\MinkExtension;
use DrevOps\BehatPhpServer\PhpServerContext;
use DrevOps\BehatScreenshotExtension\Context\ScreenshotContext;
use DrevOps\BehatScreenshotExtension\ServiceContainer\BehatScreenshotExtension;
use DVDoug\Behat\CodeCoverage\Extension as CodeCoverageExtension;
$suite = (new Suite('default'))
->withPaths('%paths.base%/tests/behat/features')
->addContext('FeatureContext')
->addContext('BehatCliContext')
->addContext(ScreenshotContext::class)
->addContext(PhpServerContext::class, ['webroot' => '%paths.base%/tests/behat/fixtures', 'host' => '0.0.0.0']);
$mink = new Extension(MinkExtension::class, [
'files_path' => '%paths.base%/tests/behat/fixtures',
'base_url' => 'http://0.0.0.0:8888',
'browser_name' => 'chrome',
'javascript_session' => 'selenium2',
'sessions' => [
'browserkit_http' => ['browserkit_http' => NULL],
'selenium2' => [
'selenium2' => [
'wd_host' => 'http://localhost:4444/wd/hub',
'capabilities' => [
'browser' => 'chrome',
'extra_capabilities' => [
'goog:chromeOptions' => [
'args' => [
// Containers and CI runners have no GPU.
'--disable-gpu',
// The rest increase stability and speed.
'--disable-extensions',
'--disable-infobars',
'--disable-popup-blocking',
'--disable-translate',
'--no-first-run',
'--test-type',
],
],
],
],
],
],
],
]);
$screenshot = new Extension(BehatScreenshotExtension::class, [
'dir' => '%paths.base%/.logs/screenshots',
'on_failed' => TRUE,
'purge' => TRUE,
'info_types' => ['url', 'feature', 'step', 'datetime'],
]);
$coverage = new Extension(CodeCoverageExtension::class, [
'filter' => ['include' => ['directories' => ['src' => NULL]]],
'reports' => [
'text' => ['showColors' => TRUE, 'showOnlySummary' => TRUE],
'html' => ['target' => '.logs/coverage/behat/.coverage-html'],
'cobertura' => ['target' => '.logs/coverage/behat/cobertura.xml'],
],
]);
$profile = (new Profile('default', ['autoload' => ['%paths.base%/tests/behat/bootstrap']]))
->withTesterOptions((new TesterOptions())->withStrictResultInterpretation())
->withSuite($suite)
->withExtension($mink)
->withExtension($screenshot)
->withExtension($coverage)
->withFormatter(new PrettyFormatter())
->withFormatter((new JUnitFormatter())->withOutputPath('%paths.base%/.logs/test_results/behat'));
return (new Config())->withProfile($profile);