Skip to content

Commit

Permalink
Add api tags to behats
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomanhez committed Nov 25, 2020
1 parent 5c28552 commit 1d6d7e1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,35 @@ Feature: Receiving percentage discount on products from specific price range
And the store has a product "PHP Mug" priced at "$20.00"
And there is a promotion "Christmas sale"

@ui
@ui @api
Scenario: Receiving percentage discount on a single item fulfilling minimum price criteria
Given this promotion gives "10%" off on every product with minimum price at "$50.00"
When I add product "PHP T-Shirt" to the cart
Then its price should be decreased by "$10.00"
And my cart total should be "$90.00"

@ui
@ui @api
Scenario: Receiving percentage discount on a single item with price equal to filter minimum criteria
Given this promotion gives "10%" off on every product with minimum price at "$100.00"
When I add product "PHP T-Shirt" to the cart
Then its price should be decreased by "$10.00"
And my cart total should be "$90.00"

@ui
@ui @api
Scenario: Receiving percentage discount on a single item fulfilling range price criteria
Given this promotion gives "50%" off on every product priced between "$15.00" and "$50.00"
When I add product "PHP Mug" to the cart
Then its price should be decreased by "$10.00"
And my cart total should be "$10.00"

@ui
@ui @api
Scenario: Receiving percentage discount on a single item with price equal to filter range minimum criteria
Given this promotion gives "50%" off on every product priced between "$20.00" and "$50.00"
When I add product "PHP Mug" to the cart
Then its price should be decreased by "$10.00"
And my cart total should be "$10.00"

@ui
@ui @api
Scenario: Receiving percentage discount on a single item with price equal to filter range maximum criteria
Given this promotion gives "50%" off on every product priced between "$15.00" and "$20.00"
When I add product "PHP Mug" to the cart
Expand Down
3 changes: 3 additions & 0 deletions src/Sylius/Behat/Context/Api/Shop/CartContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public function theAdministratorTryToSeeTheSummaryOfCart(?string $tokenValue): v
public function iAddThisProductToTheCart(ProductInterface $product, ?string $tokenValue): void
{
$this->putProductToCart($product, $tokenValue);

$this->sharedStorage->set('product', $product);
}

/**
Expand Down Expand Up @@ -313,6 +315,7 @@ public function thisItemShouldHaveCode(array $item, string $variantCode): void
}

/**
* @Then /^(its|theirs) price should be decreased by ("[^"]+")$/
* @Then /^(product "[^"]+") price should be decreased by ("[^"]+")$/
*/
public function itsPriceShouldBeDecreasedBy(ProductInterface $product, int $amount): void
Expand Down

0 comments on commit 1d6d7e1

Please sign in to comment.