Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Variants] introduce Variant Bundle #1990

Merged
merged 23 commits into from
May 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c15c5f0
[Variants] introduce Variant Bundle
dpfaffenbauer May 4, 2022
0118c36
[Variants] fix installing product
dpfaffenbauer May 4, 2022
db6b16f
Update src/CoreShop/Component/Variant/composer.json
dpfaffenbauer May 4, 2022
bd11bdf
[Variants] remove serialize in twig
dpfaffenbauer May 4, 2022
feeebff
Merge branch 'features/variant' of github.com:dpfaffenbauer/CoreShop …
dpfaffenbauer May 4, 2022
680e044
[Variants] fix stan issues
dpfaffenbauer May 4, 2022
f76e24e
[Variants] fix stan issues
dpfaffenbauer May 4, 2022
a905b17
[Variants] fix tests
dpfaffenbauer May 4, 2022
cca02dc
[Variants] fix psalm tests
dpfaffenbauer May 4, 2022
058ad16
[VariantBundle] frontend for variants
breakone May 4, 2022
ab96491
Merge remote-tracking branch 'dpfaffenbauer/features/variant' into fe…
breakone May 4, 2022
e5fd493
[Variants] add ui tests
dpfaffenbauer May 4, 2022
e72b7e6
[Variants] tests
dpfaffenbauer May 4, 2022
b6f1617
[Variants] add sorting to tests
dpfaffenbauer May 4, 2022
c9e1a16
[Variants] add tests for not available variants
dpfaffenbauer May 4, 2022
f698aa0
[Variants] add screenshot command
dpfaffenbauer May 4, 2022
dc5d7fb
[Variants] add full log
dpfaffenbauer May 4, 2022
99dc862
[Variants] add full log
dpfaffenbauer May 4, 2022
90ff923
[Variants] upload pimcore logs on failure
dpfaffenbauer May 4, 2022
c83df6a
[Variants] upload pimcore logs on failure
dpfaffenbauer May 4, 2022
5adbad7
[Tests] reduce log levels and fix behat deprecated notice
dpfaffenbauer May 5, 2022
5c47b1d
[Variants] disable test for now, as I have no idea why it doesn't run
dpfaffenbauer May 5, 2022
0df56fa
[Variants] fix variant-bundle composer.json
dpfaffenbauer May 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[Variants] add screenshot command
  • Loading branch information
dpfaffenbauer committed May 4, 2022
commit f698aa08e1beba26fe96cdb5eb34f99af6014210
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Feature: Viewing a product variant details
And attribute value "Winter" is not selected
When I click on attribute value "Winter"
Then I should be on the detail page for variant with key "t-shirt-green-s-winter"
Then screenshot
When I click on attribute color "blue"
When I click on attribute value "XL"
When I click on attribute value "Summer"
Expand Down
56 changes: 56 additions & 0 deletions src/CoreShop/Behat/Context/Setup/LogContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
/**
* CoreShop.
*
* This source file is subject to the GNU General Public License version 3 (GPLv3)
* For the full copyright and license information, please view the LICENSE.md and gpl-3.0.txt
* files that are distributed with this source code.
*
* @copyright Copyright (c) CoreShop GmbH (https://www.coreshop.org)
* @license https://www.coreshop.org/license GNU General Public License version 3 (GPLv3)
*/

declare(strict_types=1);

namespace CoreShop\Behat\Context\Setup;

use Behat\Behat\Context\Context;
use Behat\Mink\Exception\UnsupportedDriverActionException;
use Behat\Mink\Mink;
use Behat\Mink\Session;
use Facebook\WebDriver\Exception\WebDriverException;

final class LogContext implements Context
{
public function __construct(private Mink $mink, private string $logDirectory)
{
}

/**
* @Given /^screenshot$/
*/
public function screenshot(): void
{
$session = $this->getSession();

try {
$this->saveLog($session->getScreenshot(), 'png');
} catch (UnsupportedDriverActionException|WebDriverException $exception) {
//Ignore
}
}

private function getSession(): Session
{
return $this->mink->getSession();
}

private function saveLog(string $content, string $type): void
{
$path = sprintf("%s/behat-%s.%s", $this->logDirectory, date('YmdHis'), $type);

if (file_put_contents($path, $content) === false) {
throw new \RuntimeException(sprintf('Failed while trying to write log in "%s".', $path));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -369,3 +369,11 @@ services:
- '@coreshop.factory.attribute_value'
tags:
- { name: fob.context_service }

coreshop.behat.context.setup.log:
class: CoreShop\Behat\Context\Setup\LogContext
arguments:
- '@behat.mink'
- '%kernel.project_dir%/etc/build'
tags:
- { name: fob.context_service }
1 change: 1 addition & 0 deletions src/CoreShop/Behat/Resources/config/suites/ui/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ default:
- coreshop.behat.context.transform.product_quantity_price_rule
- coreshop.behat.context.transform.variant

- coreshop.behat.context.setup.log
- coreshop.behat.context.setup.store
- coreshop.behat.context.setup.product
- coreshop.behat.context.setup.tax_rate
Expand Down