/** * @Then I should be viewing the administration panel in :localeCode * @Then I should still be viewing the administration panel in :localeCode * @Then they should be viewing the administration panel in :localeCode */ public function iShouldBeViewingTheAdministrationPanelIn($localeCode) { $this->dashboardPage->open(); $expectedSubHeader = $this->translate('sylius.ui.overview_of_your_store', $localeCode); $actualSubHeader = $this->dashboardPage->getSubHeader(); Assert::same($actualSubHeader, $expectedSubHeader, sprintf('Dashboard header should say "%s", but says "%s" instead.', $expectedSubHeader, $actualSubHeader)); }
/** * @Then I should see :numberOfItems items in the list */ public function iShouldSeeItemsInTheList($numberOfItems) { Assert::same($numberOfItems, $this->orderShowPage->countItems(), '%s items should appear on order page, but %s rows has been found'); }
/** * @param string $element * @param string $expectedMessage */ private function assertFieldValidationMessage($element, $expectedMessage) { /** @var CreatePageInterface|UpdatePageInterface $currentPage */ $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]); Assert::same($currentPage->getValidationMessage($element), $expectedMessage); }
/** * @Then I should be notified that this email is already registered */ public function iShouldBeNotifiedThatThisEmailIsAlreadyRegistered() { Assert::same($this->createPage->getAuthorValidationMessage(), 'This email is already registered, please login or use forgotten password.', 'There should be author validation error, but there is not.'); }
/** * @Then I should be notified that the shipping method is required */ public function iShouldBeNotifiedThatTheShippingMethodIsRequired() { Assert::same($this->selectShippingPage->getValidationMessageForShipment(), 'Please select shipping method.'); }
/** * @Then /^I should be notified that province code must be unique$/ */ public function iShouldBeNotifiedThatProvinceCodeMustBeUnique() { Assert::same($this->updatePage->getValidationMessage('code'), 'Province code must be unique.'); }
/** * @Then /^(the administrator) should see that (order placed by "[^"]+") has "([^"]+)" currency$/ */ public function theAdministratorShouldSeeThatThisOrderHasBeenPlacedIn(AdminUserInterface $user, OrderInterface $order, $currency) { $this->sharedSecurityService->performActionAsAdminUser($user, function () use($order, $currency) { $this->showPage->open(['id' => $order->getId()]); Assert::same($this->showPage->getOrderCurrency(), $currency, 'The order has been placed in %s, but it was expected to be placed in %s'); }); }
/** * @Then I should be notified that :element is required */ public function iShouldBeNotifiedThatIsRequired($element) { /** @var CreatePageInterface|UpdatePageInterface $currentPage */ $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]); Assert::same($currentPage->getValidationMessage($element), sprintf('Please enter taxon %s.', $element)); }
/** * @Then /^I should see (\d+) zones in the list$/ */ public function iShouldSeeZonesInTheList($number) { $resourcesOnPage = $this->indexPage->countItems(); Assert::same((int) $number, $resourcesOnPage, sprintf('On list should be %d zones but get %d', $number, $resourcesOnPage)); }
/** * @param string $element * @param string $message */ private function assertValidationMessage($element, $message) { $product = $this->sharedStorage->has('product') ? $this->sharedStorage->get('product') : null; /** @var CreatePageInterface|UpdatePageInterface $currentPage */ $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createSimpleProductPage, $this->createConfigurableProductPage, $this->updateSimpleProductPage, $this->updateConfigurableProductPage], $product); Assert::same($currentPage->getValidationMessage($element), $message); }
/** * @Then I should be notified that channel with this code already exists */ public function iShouldBeNotifiedThatChannelWithThisCodeAlreadyExists() { Assert::same($this->createPage->getValidationMessage('code'), 'Channel code has to be unique.'); }
/** * @Then /^there should be no shipments with ("[^"]+" shipping method) in the registry$/ */ public function shipmentShouldNotExistInTheRegistry(ShippingMethodInterface $shippingMethod) { $shippings = $this->shipmentRepository->findBy(['method' => $shippingMethod]); Assert::same($shippings, []); }
/** * @param int $count * * @throws \InvalidArgumentException */ private function assertCountOfExchangeRatesOnTheList($count) { $actualCount = $this->indexPage->countItems(); Assert::same($actualCount, (int) $count, 'Expected %2$d exchange rates to be on the list, but found %d instead.'); }
/** * @Then /^there should be no variants of (this product) in the product catalog$/ */ public function thereAreNoVariants(ProductInterface $product) { $variants = $this->productVariantRepository->findBy(['object' => $product]); Assert::same($variants, []); }
/** * @Then /^there should be no ("[^"]+" payments) in the registry$/ */ public function paymentShouldNotExistInTheRegistry(PaymentMethodInterface $paymentMethod) { $payments = $this->paymentRepository->findBy(['method' => $paymentMethod]); Assert::same($payments, []); }
/** * @param int $expectedCount * * @throws \InvalidArgumentException */ private function assertAddressesCountOnPage($expectedCount) { $actualCount = $this->addressBookIndexPage->getAddressesCount(); Assert::same($expectedCount, $actualCount, sprintf('There should be %d addresses on the list, but %d addresses has been found.', $expectedCount, $actualCount)); }
/** * @Then I should see only one tracked variant in the list */ public function iShouldSeeOnlyOneTrackedVariantInTheList() { $foundRows = $this->indexPage->countItems(); Assert::same(1, $foundRows, '%s rows with tracked product variants should appear on page, %s rows has been found.'); }
/** * @Then the command should finish successfully */ public function commandSuccess() { Assert::same($this->tester->getStatusCode(), 0); }
/** * @Then I should see :rating as its average rating */ public function iShouldSeeAsItsAverageRating($rating) { $averageRating = $this->showPage->getAverageRating(); Assert::same((double) $rating, $averageRating, 'Product should have average rating %2$s but has %s.'); }
/** * @Then I should be notified that the image with this code already exists */ public function iShouldBeNotifiedThatTheImageWithThisCodeAlreadyExists() { Assert::same($this->updatePage->getValidationMessageForImage('code'), 'Image code must be unique within this taxon.'); }
/** * @Then I should be notified that name is required */ public function iShouldBeNotifiedThatNameIsRequired() { Assert::same($this->updatePage->getValidationMessage('name'), 'Please enter a customer group name.'); }
/** * @Then /^I should see (\d+) product options in the list$/ */ public function iShouldSeeProductOptionsInTheList($amount) { $foundRows = $this->indexPage->countItems(); Assert::same((int) $amount, $foundRows, '%2$s rows with product options should appear on page, %s rows has been found'); }
/** * @Then I should see :itemPrice as item price */ public function iShouldSeeAsItemPrice($itemPrice) { Assert::same($this->orderShowPage->getItemPrice(), $itemPrice, 'Item price is %s, but should be %s.'); }
/** * @Then my cart's total should be :total */ public function myCartSTotalShouldBe($total) { Assert::same($total, $this->summaryPage->getCartTotal(), 'Cart should have %s total, but it has %2$s.'); }
/** * @Then I should see :number new orders in the list */ public function iShouldSeeNewOrdersInTheList($number) { Assert::same($this->dashboardPage->getNumberOfNewOrdersInTheList(), $number); }
/** * @Then I should be notified that coupon usage limit must be at least one */ public function iShouldBeNotifiedThatCouponUsageLimitMustBeAtLeast() { /** @var CreatePageInterface|UpdatePageInterface $currentPage */ $currentPage = $this->currentPageResolver->getCurrentPageWithForm([$this->createPage, $this->updatePage]); Assert::same($currentPage->getValidationMessage('usage_limit'), 'Coupon usage limit must be at least 1.'); }
/** * @Then this administrator should not be added */ public function thisAdministratorShouldNotBeAdded() { $this->indexPage->open(); Assert::same(1, $this->indexPage->countItems(), 'There should not be any new administrators'); }
/** * @param string $element * @param string $expectedMessage */ private function assertFieldValidationMessage($element, $expectedMessage) { Assert::same($this->updatePage->getValidationMessage($element), $expectedMessage); }
/** * @Then /^I should be notified that the (last name|first name|city|street) is required$/ */ public function iShouldBeNotifiedThatIsRequired($element) { Assert::same($this->updateShippingAddressPage->getValidationMessage($this->getNormalizedElementName($element)), sprintf('Please enter %s.', $element)); }
/** * @Then I should (still) shop using the :currencyCode currency */ public function iShouldShopUsingTheCurrency($currencyCode) { $this->homePage->open(); Assert::same($currencyCode, $this->homePage->getActiveCurrency()); }