From 5cb96b9f6cd9b5fdafc43e97efd64a1649cf7ba1 Mon Sep 17 00:00:00 2001 From: tuka217 Date: Fri, 22 Apr 2016 14:51:28 +0200 Subject: [PATCH] Adding scenario for browsing product attributes --- .../product/managing_product_attributes.yml | 1 + .../browsing_all_product_attributes.feature | 17 +++++++++++++++ .../ManagingProductAttributesContext.php | 21 +++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 features/product_attributes/managing_product_attributes/browsing_all_product_attributes.feature diff --git a/etc/behat/suites/ui/product/managing_product_attributes.yml b/etc/behat/suites/ui/product/managing_product_attributes.yml index 57683a7919..b19977fb7a 100644 --- a/etc/behat/suites/ui/product/managing_product_attributes.yml +++ b/etc/behat/suites/ui/product/managing_product_attributes.yml @@ -13,6 +13,7 @@ default: - sylius.behat.context.transform.locale - sylius.behat.context.transform.shared_storage + - sylius.behat.context.transform.lexical - sylius.behat.context.ui.admin.managing_product_attributes filters: diff --git a/features/product_attributes/managing_product_attributes/browsing_all_product_attributes.feature b/features/product_attributes/managing_product_attributes/browsing_all_product_attributes.feature new file mode 100644 index 0000000000..619027624b --- /dev/null +++ b/features/product_attributes/managing_product_attributes/browsing_all_product_attributes.feature @@ -0,0 +1,17 @@ +@managing_product_attributes +Feature: Browsing product attributes + In order to see all product attributes available in the store + As an Administrator + I want to browse product attributes + + Background: + Given the store has a text product attribute "T-shirt brand" with code "t_shirt_brand" + And the store has a checkbox product attribute "T-shirt with cotton" with code "t_shirt_with_cotton" + And the store has a integer product attribute "Book pages" with code "book_pages" + And I am logged in as an administrator + + @ui + Scenario: Browsing all product attributes in store + When I want to see all product attributes in store + Then I should see 3 product attributes in the list + And I should see the product attribute "T-shirt brand" in the list diff --git a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductAttributesContext.php b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductAttributesContext.php index f1e4cf5f58..f97a5d49c9 100644 --- a/src/Sylius/Behat/Context/Ui/Admin/ManagingProductAttributesContext.php +++ b/src/Sylius/Behat/Context/Ui/Admin/ManagingProductAttributesContext.php @@ -108,6 +108,7 @@ final class ManagingProductAttributesContext implements Context /** * @Then the attribute :name should appear in the store + * @Then I should see the product attribute :name in the list */ public function theAttributeShouldAppearInTheStore($name) { @@ -235,4 +236,24 @@ final class ManagingProductAttributesContext implements Context sprintf('Product attribute %s should be required.', $element) ); } + + /** + * @When I want to see all product attributes in store + */ + public function iWantToSeeAllProductAttributesInStore() + { + $this->indexPage->open(); + } + + /** + * @Then /^I should see (\d+) product attributes in the list$/ + */ + public function iShouldSeeCustomersInTheList($amountOfProductAttributes) + { + Assert::same( + $amountOfProductAttributes, + $this->indexPage->countItems(), + sprintf('Amount of product attributes should be equal %s, but is not.', $amountOfProductAttributes) + ); + } }