Change scenario

This commit is contained in:
Michał Pysiak 2024-10-07 08:13:13 +02:00
parent 80539930b8
commit 9b08a7a3a1
No known key found for this signature in database
GPG key ID: 9C1F2D0F99830187
4 changed files with 31 additions and 29 deletions

View file

@ -11,9 +11,8 @@ Feature: Assigning customer's IP address to a placed order
And the store allows paying Offline
And there is a customer account "customer@example.com"
And there is a customer "customer@example.com" that placed order with "PHP T-Shirt" product to "United States" based billing address with "Free" shipping method and "Offline" payment method without completing it
And I am logged in as "customer@example.com"
And I confirm my order
Then I should see the thank you page
And The customer logged in as "customer@example.com"
And The customer confirmed the order
@api @ui
Scenario: Verifying the customer's IP address for a newly placed order

View file

@ -347,6 +347,7 @@ final class CheckoutContext implements Context
* @Given I confirmed my order
* @When I confirm my order
* @When /^the (?:visitor|customer) confirm his order$/
* @When The customer confirmed the order
*/
public function iConfirmMyOrder(): void
{

View file

@ -20,7 +20,7 @@ use Sylius\Bundle\CoreBundle\Fixture\Factory\ExampleFactoryInterface;
use Sylius\Component\User\Repository\UserRepositoryInterface;
use Webmozart\Assert\Assert;
final class ShopSecurityContext implements Context
final readonly class ShopSecurityContext implements Context
{
public function __construct(
private SharedStorageInterface $sharedStorage,
@ -33,6 +33,7 @@ final class ShopSecurityContext implements Context
/**
* @Given I am logged in as :email
* @When I log in as :email
* @When The customer logged in as :email
*/
public function iAmLoggedInAs(string $email): void
{

View file

@ -30,7 +30,7 @@ use Sylius\Component\Core\Model\ShippingMethodInterface;
use Sylius\Component\Locale\Model\LocaleInterface;
use Webmozart\Assert\Assert;
final class CheckoutCompleteContext implements Context
final readonly class CheckoutCompleteContext implements Context
{
public function __construct(
private SharedStorageInterface $sharedStorage,
@ -44,7 +44,7 @@ final class CheckoutCompleteContext implements Context
* @When I try to open checkout complete page
* @When I want to complete checkout
*/
public function iTryToOpenCheckoutCompletePage()
public function iTryToOpenCheckoutCompletePage(): void
{
$this->completePage->tryToOpen();
}
@ -52,7 +52,7 @@ final class CheckoutCompleteContext implements Context
/**
* @When I decide to change the payment method
*/
public function iGoToThePaymentStep()
public function iGoToThePaymentStep(): void
{
$this->completePage->changePaymentMethod();
}
@ -60,7 +60,7 @@ final class CheckoutCompleteContext implements Context
/**
* @When /^I provide additional note like "([^"]+)"$/
*/
public function iProvideAdditionalNotesLike($notes)
public function iProvideAdditionalNotesLike($notes): void
{
$this->sharedStorage->set('additional_note', $notes);
$this->completePage->addNotes($notes);
@ -69,7 +69,7 @@ final class CheckoutCompleteContext implements Context
/**
* @When I return to the checkout summary step
*/
public function iReturnToTheCheckoutSummaryStep()
public function iReturnToTheCheckoutSummaryStep(): void
{
$this->completePage->open();
}
@ -80,6 +80,7 @@ final class CheckoutCompleteContext implements Context
* @Given the customer confirm his order
* @When I confirm my order
* @When I try to confirm my order
* @When The customer confirmed the order
*/
public function iConfirmMyOrder(): void
{
@ -102,7 +103,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then my order's shipping address should be to :fullName
*/
public function iShouldSeeThisShippingAddressAsShippingAddress($fullName)
public function iShouldSeeThisShippingAddressAsShippingAddress(string $fullName): void
{
$address = $this->sharedStorage->get('shipping_address_' . StringInflector::nameToLowercaseCode($fullName));
@ -112,7 +113,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then my order's billing address should be to :fullName
*/
public function iShouldSeeThisBillingAddressAsBillingAddress($fullName)
public function iShouldSeeThisBillingAddressAsBillingAddress(string $fullName): void
{
$address = $this->sharedStorage->get('billing_address_' . StringInflector::nameToLowercaseCode($fullName));
@ -122,7 +123,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then address to :fullName should be used for both shipping and billing of my order
*/
public function iShouldSeeThisShippingAddressAsShippingAndBillingAddress($fullName)
public function iShouldSeeThisShippingAddressAsShippingAndBillingAddress(string $fullName): void
{
$this->iShouldSeeThisShippingAddressAsShippingAddress($fullName);
$this->iShouldSeeThisBillingAddressAsBillingAddress($fullName);
@ -131,7 +132,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then I should have :quantity :productName products in the cart
*/
public function iShouldHaveProductsInTheCart($quantity, $productName)
public function iShouldHaveProductsInTheCart(string $quantity, string $productName): void
{
Assert::true($this->completePage->hasItemWithProductAndQuantity($productName, $quantity));
}
@ -171,7 +172,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then my order promotion total should be :promotionTotal
*/
public function myOrderPromotionTotalShouldBe($promotionTotal)
public function myOrderPromotionTotalShouldBe(string $promotionTotal): void
{
Assert::true($this->completePage->hasPromotionTotal($promotionTotal));
}
@ -179,7 +180,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then :promotionName should be applied to my order
*/
public function shouldBeAppliedToMyOrder($promotionName)
public function shouldBeAppliedToMyOrder(string $promotionName): void
{
Assert::true($this->completePage->hasOrderPromotion($promotionName));
}
@ -187,7 +188,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then :promotionName should be applied to my order shipping
*/
public function shouldBeAppliedToMyOrderShipping($promotionName)
public function shouldBeAppliedToMyOrderShipping(string $promotionName): void
{
Assert::true($this->completePage->hasShippingPromotion($promotionName));
}
@ -203,7 +204,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then my order's shipping method should be :shippingMethod
*/
public function myOrdersShippingMethodShouldBe(ShippingMethodInterface $shippingMethod)
public function myOrdersShippingMethodShouldBe(ShippingMethodInterface $shippingMethod): void
{
Assert::true($this->completePage->hasShippingMethod($shippingMethod));
}
@ -211,7 +212,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then my order's payment method should be :paymentMethod
*/
public function myOrdersPaymentMethodShouldBe(PaymentMethodInterface $paymentMethod)
public function myOrdersPaymentMethodShouldBe(PaymentMethodInterface $paymentMethod): void
{
Assert::same($this->completePage->getPaymentMethodName(), $paymentMethod->getName());
}
@ -219,7 +220,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then the :product product should have unit price :price
*/
public function theProductShouldHaveUnitPrice(ProductInterface $product, $price)
public function theProductShouldHaveUnitPrice(ProductInterface $product, string $price): void
{
Assert::true($this->completePage->hasProductUnitPrice($product, $price));
}
@ -228,7 +229,7 @@ final class CheckoutCompleteContext implements Context
* @Then /^I should be notified that (this product) does not have sufficient stock$/
* @Then I should be notified that product :product does not have sufficient stock
*/
public function iShouldBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product)
public function iShouldBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product): void
{
Assert::true($this->completePage->hasProductOutOfStockValidationMessage($product));
}
@ -236,7 +237,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then /^I should not be notified that (this product) does not have sufficient stock$/
*/
public function iShouldNotBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product)
public function iShouldNotBeNotifiedThatThisProductDoesNotHaveSufficientStock(ProductInterface $product): void
{
Assert::false($this->completePage->hasProductOutOfStockValidationMessage($product));
}
@ -252,7 +253,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then I should see :provinceName in the shipping address
*/
public function iShouldSeeInTheShippingAddress($provinceName)
public function iShouldSeeInTheShippingAddress(string $provinceName): void
{
Assert::true($this->completePage->hasShippingProvinceName($provinceName));
}
@ -260,7 +261,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then I should see :provinceName in the billing address
*/
public function iShouldSeeInTheBillingAddress($provinceName)
public function iShouldSeeInTheBillingAddress(string $provinceName): void
{
Assert::true($this->completePage->hasBillingProvinceName($provinceName));
}
@ -268,7 +269,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then I should not see any information about payment method
*/
public function iShouldNotSeeAnyInformationAboutPaymentMethod()
public function iShouldNotSeeAnyInformationAboutPaymentMethod(): void
{
Assert::false($this->completePage->hasPaymentMethod());
}
@ -276,7 +277,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then I should not be able to confirm order because products do not fit :shippingMethod requirements
*/
public function iShouldNotBeAbleToConfirmOrderBecauseDoNotBelongsToShippingCategory(ShippingMethodInterface $shippingMethod)
public function iShouldNotBeAbleToConfirmOrderBecauseDoNotBelongsToShippingCategory(ShippingMethodInterface $shippingMethod): void
{
$this->completePage->confirmOrder();
@ -292,7 +293,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then /^I should be informed that (this promotion) is no longer applied$/
*/
public function iShouldBeInformedThatMyPromotionIsNoLongerApplied(PromotionInterface $promotion)
public function iShouldBeInformedThatMyPromotionIsNoLongerApplied(PromotionInterface $promotion): void
{
$this->notificationChecker->checkNotification(
sprintf('You are no longer eligible for this promotion %s.', $promotion->getName()),
@ -303,7 +304,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then /^I should be informed that (this payment method) has been disabled$/
*/
public function iShouldBeInformedThatThisPaymentMethodHasBeenDisabled(PaymentMethodInterface $paymentMethod)
public function iShouldBeInformedThatThisPaymentMethodHasBeenDisabled(PaymentMethodInterface $paymentMethod): void
{
Assert::same(
$this->completePage->getValidationErrors(),
@ -317,7 +318,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then /^I should be informed that (this product) has been disabled$/
*/
public function iShouldBeInformedThatThisProductHasBeenDisabled(ProductInterface $product)
public function iShouldBeInformedThatThisProductHasBeenDisabled(ProductInterface $product): void
{
Assert::same(
$this->completePage->getValidationErrors(),
@ -351,7 +352,7 @@ final class CheckoutCompleteContext implements Context
/**
* @Then /^I should be informed that (this variant) has been disabled$/
*/
public function iShouldBeInformedThatThisVariantHasBeenDisabled(ProductVariantInterface $productVariant)
public function iShouldBeInformedThatThisVariantHasBeenDisabled(ProductVariantInterface $productVariant): void
{
Assert::same(
$this->completePage->getValidationErrors(),