Skip to content

Commit

Permalink
[Behat][Admin] Replace step with checking successfully created promotion
Browse files Browse the repository at this point in the history
  • Loading branch information
GSadee committed Apr 18, 2024
1 parent f68cbd2 commit e803c6f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ Feature: Adding a new promotion with action configured in different channels
And I add the "Item fixed discount" action configured with amount of "$10.00" for "United States" channel
And it is also configured with amount of "£16.00" for "Web-GB" channel
And I add it
Then I should be notified that it has been successfully created
And the "Item fixed discount for all products!" promotion should appear in the registry
Then the "Item fixed discount for all products!" promotion should be successfully created
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ Feature: Adding promotion with filter
And I add the "Item fixed discount" action configured with amount of "$10.00" for "United States" channel
And I specify that on "United States" channel this action should be applied to items with price greater than "$10.00"
And I add it
Then I should be notified that it has been successfully created
And the "$10 discount for all products over $10!" promotion should appear in the registry
Then the "$10 discount for all products over $10!" promotion should be successfully created

@api @ui @javascript
Scenario: Adding a promotion with item fixed discount only for products between 10 and 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ Feature: Adding a new promotion with rule configured in different channels
And I name it "100 in every currency"
And I add the "Item total" rule configured with "€100.00" amount for "United States" channel and "£100.00" amount for "Web-GB" channel
And I add it
Then I should be notified that it has been successfully created
And the "100 in every currency" promotion should appear in the registry
Then the "100 in every currency" promotion should be successfully created
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,15 @@ public function promotionShouldNotExistInTheRegistry(PromotionInterface $promoti
);
}

/**
* @Then the :promotionName promotion should be successfully created
*/
public function thePromotionShouldBeSuccessfullyCreated(string $promotionName): void
{
$this->iShouldBeNotifiedThatItHasBeenSuccessfullyCreated();
$this->thePromotionShouldAppearInTheRegistry($promotionName);
}

/**
* @Then I should be notified that it has been successfully created
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,14 @@ public function iShouldBeViewingNonArchivalPromotions(): void
Assert::false($this->indexPage->isArchivalFilterEnabled());
}

/**
* @Then the :promotion promotion should be successfully created
*/
public function thePromotionShouldBeSuccessfullyCreated(PromotionInterface $promotion): void
{
$this->updatePage->verify(['id' => $promotion->getId()]);
}

private function assertFieldValidationMessage(string $element, string $expectedMessage)
{
Assert::same($this->formElement->getValidationMessage($element), $expectedMessage);
Expand Down

0 comments on commit e803c6f

Please sign in to comment.