mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
[Travis] Make JS tests great again!
This commit is contained in:
parent
85c8214309
commit
8a564e9742
4 changed files with 126 additions and 8 deletions
|
|
@ -29,14 +29,10 @@ run_behat() {
|
||||||
local code=0
|
local code=0
|
||||||
|
|
||||||
print_header "Testing (Behat - brand new, javascript scenarios; @javascript && ~@todo && ~@cli)" "Sylius"
|
print_header "Testing (Behat - brand new, javascript scenarios; @javascript && ~@todo && ~@cli)" "Sylius"
|
||||||
|
run_command "bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\"" || code=$?
|
||||||
for path in features/*
|
if [[ ${code} = 1 ]]; then
|
||||||
do
|
run_command "bin/behat --strict --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\" --rerun" ; code=$?
|
||||||
run_command "bin/behat $path --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\"" || code=$?
|
fi
|
||||||
if [[ ${code} = 1 ]]; then
|
|
||||||
run_command "bin/behat $path --no-interaction -vvv -f progress -p cached --tags=\"@javascript && ~@todo && ~@cli\" --rerun" ; code=$?
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
return ${code}
|
return ${code}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Paweł Jędrzejewski
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Extension\SeleniumExtension;
|
||||||
|
|
||||||
|
use Behat\Mink\Mink;
|
||||||
|
use Behat\Testwork\EventDispatcher\Event\AfterSuiteTested;
|
||||||
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||||
|
*/
|
||||||
|
final class SeleniumSessionRestarter implements EventSubscriberInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var Mink
|
||||||
|
*/
|
||||||
|
private $mink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Mink $mink
|
||||||
|
*/
|
||||||
|
public function __construct(Mink $mink)
|
||||||
|
{
|
||||||
|
$this->mink = $mink;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public static function getSubscribedEvents()
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
AfterSuiteTested::BEFORE => ['stopSession', 128],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function stopSession()
|
||||||
|
{
|
||||||
|
if ($this->mink->hasSession('selenium2') && $this->mink->isSessionStarted('selenium2')) {
|
||||||
|
$this->mink->getSession('selenium2')->stop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of the Sylius package.
|
||||||
|
*
|
||||||
|
* (c) Paweł Jędrzejewski
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Sylius\Behat\Extension\SeleniumExtension\ServiceContainer;
|
||||||
|
|
||||||
|
use Behat\MinkExtension\ServiceContainer\MinkExtension;
|
||||||
|
use Behat\Testwork\EventDispatcher\ServiceContainer\EventDispatcherExtension;
|
||||||
|
use Behat\Testwork\ServiceContainer\Extension;
|
||||||
|
use Behat\Testwork\ServiceContainer\ExtensionManager;
|
||||||
|
use Sylius\Behat\Extension\SeleniumExtension\SeleniumSessionRestarter;
|
||||||
|
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
|
use Symfony\Component\DependencyInjection\Definition;
|
||||||
|
use Symfony\Component\DependencyInjection\Reference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Kamil Kokot <kamil.kokot@lakion.com>
|
||||||
|
*/
|
||||||
|
final class SeleniumExtension implements Extension
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getConfigKey()
|
||||||
|
{
|
||||||
|
return 'sylius_selenium';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function initialize(ExtensionManager $extensionManager)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function configure(ArrayNodeDefinition $builder)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function load(ContainerBuilder $container, array $config)
|
||||||
|
{
|
||||||
|
$definition = new Definition(SeleniumSessionRestarter::class, [new Reference(MinkExtension::MINK_ID)]);
|
||||||
|
$definition->addTag(EventDispatcherExtension::SUBSCRIBER_TAG);
|
||||||
|
|
||||||
|
$container->setDefinition('sylius_selenium.selenium_session_restarter', $definition);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function process(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -50,6 +50,8 @@ default:
|
||||||
|
|
||||||
Sylius\Behat\Extension\SymfonyExtension: ~
|
Sylius\Behat\Extension\SymfonyExtension: ~
|
||||||
|
|
||||||
|
Sylius\Behat\Extension\SeleniumExtension: ~
|
||||||
|
|
||||||
FriendsOfBehat\PerformanceExtension: ~
|
FriendsOfBehat\PerformanceExtension: ~
|
||||||
|
|
||||||
FriendsOfBehat\VariadicExtension: ~
|
FriendsOfBehat\VariadicExtension: ~
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue