Skip to content

Commit

Permalink
feature Sylius#14866 [PriceHistory][UI] ChannelPricingLogEntry implem…
Browse files Browse the repository at this point in the history
…entation (Rafikooo)

This PR was merged into the 1.13 branch.

Discussion
----------

| Q               | A                                                            |
|-----------------|--------------------------------------------------------------|
| Branch?         | 1.13 <!-- see the comment below -->                  |
| Bug fix?        | no                                                      |
| New feature?    |yes                                                       |
| BC breaks?      | no                                                      |
| Deprecations?   | no<!-- don't forget to update the UPGRADE-*.md file --> |
| Related tickets | Sylius#14854            |
| License         | MIT                                                          |

<!--
 - Bug fixes must be submitted against the 1.12 branch
 - Features and deprecations must be submitted against the 1.13 branch
 - Make sure that the correct base branch is set

 To be sure you are not breaking any Backward Compatibilities, check the documentation:
 https://docs.sylius.com/en/latest/book/organization/backward-compatibility-promise.html
-->

<img width="1450" alt="image" src="https://user-images.githubusercontent.com/40125720/226258220-40859921-e83b-4731-b2b3-2ed5a34fb442.png">


Commits
-------

aaa683a [PriceHistory][UI] Tag scenarios with accessing price history enabled
913434c [PriceHistory][UI] Tag scenarios with seeing price history enabled
48bf8ca [PriceHistory][UI] Add behat contexts and suites configuration
c377d92 [PriceHistory][UI] Add grid with ChannelPricingLogEntry resource
  • Loading branch information
GSadee authored Mar 20, 2023
2 parents f74f7f3 + c377d92 commit 77717c4
Show file tree
Hide file tree
Showing 29 changed files with 531 additions and 161 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature: Accessing the price history from the configurable product show page
And the product "Wyborowa Vodka" has a "Wyborowa Vodka Lemon" variant priced at "$10.00"
And I am logged in as an administrator

@todo @no-api
@ui @no-api
Scenario: Being able to access the price history of variant from the configurable product show page
Given I am browsing products
When I access "Wyborowa Vodka" product page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Feature: Accessing the price history from the simple product show page
And it is enabled
And I am logged in as an administrator

@todo @no-api
@ui @no-api
Scenario: Being able to access price history from simple product show page
Given I am browsing products
When I access "Ursus C-355" product page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Seeing the correct catalog price history after creating a product varia
Given the store operates on a single channel in "United States"
And I am logged in as an administrator

@api
@api @ui
Scenario: Seeing historical product variant prices after the product variant has been created without any promotion applied
Given the store has a "Wyborowa Vodka" configurable product
When I want to create a new variant of this product
Expand All @@ -20,7 +20,7 @@ Feature: Seeing the correct catalog price history after creating a product varia
Then I should see a single log entry in the catalog price history
And there should be a log entry with the "$20.00" selling price, "$25.00" original price and datetime of the price change

@api
@api @ui
Scenario: Seeing historical product variant prices after the product variant has been created without original price and any promotion applied
Given the store has a "Wyborowa Vodka" configurable product
When I want to create a new variant of this product
Expand All @@ -31,7 +31,7 @@ Feature: Seeing the correct catalog price history after creating a product varia
Then I should see a single log entry in the catalog price history
And there should be a log entry with the "$20.00" selling price, no original price and datetime of the price change

@api
@api @ui
Scenario: Seeing historical product variant prices after the product variant has been created with catalog promotions applied
Given the store has a "Wyborowa Vodka" configurable product
And there is a catalog promotion "Christmas sale" that reduces price by "50%" and applies on "Wyborowa Vodka" product
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Seeing the correct catalog price history after editing a product varian
And the store has a product "Wyborowa Vodka" priced at "$40.00" in "United States" channel
And I am logged in as an administrator

@api
@api @ui
Scenario: Seeing historical product variant prices after the product variant has been edited
When I want to modify the "Wyborowa Vodka" product variant
And I change its price to "$42.00" for "United States" channel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Feature: Seeing the price history of a product variant after changes to catalog
And there is an exclusive catalog promotion "Extra sale" with priority 10 that reduces price by "10%" and applies on "Wyborowa Vodka Lemon" variant
And I am logged in as an administrator

@api
@api @ui
Scenario: Seeing the catalog price history of a variant with many catalog promotions
And I go to the price history of a variant with code "WYBOROWA_VODKA_EXQUISITE"
Then I should see 2 log entries in the catalog price history
And there should be a log entry on the 1st position with the "$5.00" selling price, "$15.00" original price and datetime of the price change
And there should be a log entry on the 2nd position with the "$40.00" selling price, "$15.00" original price and datetime of the price change

@api
@api @ui
Scenario: Seeing the catalog price history of a variant with one catalog promotion
And I go to the price history of a variant with code "WYBOROWA_VODKA_LEMON"
Then I should see 2 log entries in the catalog price history
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Seeing the price history of a simple product after changes to catalog p
And it reduces price by "90%"
And I am logged in as an administrator

@api
@api @ui
Scenario: Seeing the catalog price history of a simple product
Given the "Winter sale" catalog promotion is enabled
When I disable "Winter sale" catalog promotion
Expand All @@ -23,7 +23,7 @@ Feature: Seeing the price history of a simple product after changes to catalog p
And there should be a log entry on the 2nd position with the "$10.00" selling price, "$100.00" original price and datetime of the price change
And there should be a log entry on the 3rd position with the "$100.00" selling price, no original price and datetime of the price change

@api
@api @ui
Scenario: Seeing the catalog price history of a simple product with a price different than an original price
Given "Wyborowa Vodka" variant is originally priced at "$120.00" in "United States" channel
And the "Winter sale" catalog promotion is enabled
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?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.
*/

declare(strict_types=1);

namespace Sylius\Behat\Context\Ui\Admin;

use Behat\Behat\Context\Context;
use Sylius\Behat\Page\Admin\ChannelPricingLogEntry\IndexPageInterface;
use Sylius\Component\Core\Model\ProductVariantInterface;
use Webmozart\Assert\Assert;

final class ChannelPricingLogEntryContext implements Context
{
public function __construct(private IndexPageInterface $indexPage)
{
}

/**
* @When /^I go to the price history of a (variant with code "[^"]+")$/
*/
public function iGoToThePriceHistoryOfAVariant(ProductVariantInterface $productVariant): void
{
$channelPricing = $productVariant->getChannelPricings()->first();
$product = $productVariant->getProduct();

$this->indexPage->open([
'productId' => $product->getId(),
'variantId' => $productVariant->getId(),
'channelPricingId' => $channelPricing->getId(),
]);
}

/**
* @Then I should see :count log entries in the catalog price history
* @Then I should see a single log entry in the catalog price history
*/
public function iShouldSeeLogEntriesInTheCatalogPriceHistoryForTheVariant(int $count = 1): void
{
Assert::same($this->indexPage->countItems(), $count);
}

/**
* @Then /^there should be a log entry on the (\d+)(?:|st|nd|rd|th) position with the "([^"]+)" selling price, "([^"]+)" original price and datetime of the price change$/
* @Then /^there should be a log entry on the (\d+)(?:|st|nd|rd|th) position with the "([^"]+)" selling price, no original price and datetime of the price change$/
*/
public function thereShouldBeALogEntryOnThePositionWithTheSellingPriceOriginalPriceAndDatetimeOfThePriceChange(
int $position,
string $price,
string $originalPrice = '-',
): void {
Assert::true($this->indexPage->isLogEntryWithPriceAndOriginalPriceOnPosition($price, $originalPrice, $position));
}

/**
* @Then /^there should be a log entry with the "([^"]+)" selling price, "([^"]+)" original price and datetime of the price change$/
* @Then /^there should be a log entry with the "([^"]+)" selling price, no original price and datetime of the price change$/
*/
public function thereShouldBeALogEntryWithTheSellingPriceOriginalPriceAndDatetimeOfThePriceChange(
string $price,
string $originalPrice = '-',
): void {
Assert::true($this->indexPage->isLogEntryWithPriceAndOriginalPrice($price, $originalPrice));
}
}
Loading

0 comments on commit 77717c4

Please sign in to comment.