Enable and fix scenarios

This commit is contained in:
Michał Pysiak 2024-08-22 13:51:03 +02:00 committed by Grzegorz Sadowski
parent 620644d6f5
commit 72f7054571
7 changed files with 42 additions and 50 deletions

View file

@ -7,91 +7,91 @@ Feature: Viewing product's attributes
Background:
Given the store operates on a single channel in "United States"
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's text attribute
Given the store has a product "T-Shirt banana"
And this product has a text attribute "T-Shirt material" with value "Banana skin"
When I check this product's details
Then I should see the product attribute "T-Shirt material" with value "Banana skin"
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's non-translatable text attribute
Given the store has a product "T-Shirt banana"
And this product has non-translatable text attribute "T-Shirt details" with value "Banana is a very good material."
When I check this product's details
Then I should see the product attribute "T-Shirt details" with value "Banana is a very good material."
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's textarea attribute
Given the store has a product "T-Shirt banana"
And this product has a textarea attribute "T-Shirt details" with value "Banana is a very good material."
When I check this product's details
Then I should see the product attribute "T-Shirt details" with value "Banana is a very good material."
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's non-translatable textarea attribute
Given the store has a product "T-Shirt banana"
And this product has non-translatable textarea attribute "T-Shirt details" with value "Banana is a very good material."
When I check this product's details
Then I should see the product attribute "T-Shirt details" with value "Banana is a very good material."
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's checkbox attribute
Given the store has a product "T-Shirt banana"
And this product has a "checkbox" attribute "T-Shirt with cotton" set to "Yes"
When I check this product's details
Then I should see the product attribute "T-Shirt with cotton" with positive value
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's checkbox non-translatable attribute
Given the store has a product "T-Shirt banana"
And this product has non-translatable "checkbox" attribute "T-Shirt with cotton" set to "Yes"
When I check this product's details
Then I should see the product attribute "T-Shirt with cotton" with positive value
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's date attribute
Given the store has a product "T-Shirt banana"
And this product has a date attribute "T-Shirt date of production" with date "12 December 2015"
When I check this product's details
Then I should see the product attribute "T-Shirt date of production" with date "Dec 12, 2015"
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's date non-translatable attribute
Given the store has a product "T-Shirt banana"
And this product has non-translatable date attribute "T-Shirt date of production" with date "12 December 2015"
When I check this product's details
Then I should see the product attribute "T-Shirt date of production" with date "Dec 12, 2015"
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's datetime attribute
Given the store has a product "T-Shirt banana"
And this product has non-translatable datetime attribute "T-Shirt date of production" with date "12 December 2015 12:34"
When I check this product's details
Then I should see the product attribute "T-Shirt date of production" with date "Dec 12, 2015 12:34:00 PM"
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's datetime non-translatable attribute
Given the store has a product "T-Shirt banana"
And this product has non-translatable datetime attribute "T-Shirt date of production" with date "12 December 2015 12:34"
When I check this product's details
Then I should see the product attribute "T-Shirt date of production" with date "Dec 12, 2015 12:34:00 PM"
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's percent attribute
Given the store has a product "T-Shirt banana"
And this product has a percent attribute "T-Shirt cotton content" with value 50%
When I check this product's details
Then I should see the product attribute "T-Shirt cotton content" with value 50%
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's percent non-translatable attribute
Given the store has a product "T-Shirt banana"
And this product has non-translatable percent attribute "T-Shirt cotton content" with value 50%
When I check this product's details
Then I should see the product attribute "T-Shirt cotton content" with value 50%
@todo @ui @api
@api @ui
Scenario: The product attributes are listed by their respective position
Given the store has a product "T-Shirt banana"
And this product has percent attribute "Wool content" at position 2

View file

@ -13,7 +13,7 @@ Feature: Viewing product's attributes in different locales
And this product has a text attribute "T-Shirt material" with value "Skórka banana" in "Polish (Poland)" locale
And this product has a textarea attribute "T-Shirt details" with value "Banana is a very good material." in "English (United States)" locale
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's text attribute after locale change
When I view product "T-Shirt banana" in the "Polish (Poland)" locale
Then I should see the product attribute "T-Shirt material" with value "Skórka banana"

View file

@ -18,26 +18,26 @@ Feature: Viewing product's attributes in different locales and channels
And this product has a textarea attribute "T-Shirt details" with value "Banana is a very good material." in "English (United States)" locale
And I am browsing the channel "US Channel"
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's attribute for current channel with its default locale
When I view product "T-Shirt banana" in the "Polish (Poland)" locale
Then I should see the product attribute "T-Shirt material" with value "Skórka banana"
And I should also see the product attribute "T-Shirt details" with value "Banana is a very good material."
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's attribute for current channel in different locale
When I view product "T-Shirt banana" in the "English (United States)" locale
Then I should see the product attribute "T-Shirt material" with value "Banana skin"
And I should also see the product attribute "T-Shirt details" with value "Banana is a very good material."
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's attribute for different channel with its default locale
When I change my current channel to "PL Channel"
And I view product "T-Shirt banana" in the "Polish (Poland)" locale
Then I should see the product attribute "T-Shirt material" with value "Skórka banana"
And I should also see the product attribute "T-Shirt details" with value "Banana is a very good material."
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's attribute for different channel in different locale
When I change my current channel to "PL Channel"
And I view product "T-Shirt banana" in the "English (United States)" locale

View file

@ -10,14 +10,14 @@ Feature: Viewing product's select attributes
And the store has a select product attribute "T-Shirt material" with values "Banana skin" and "Cotton"
And there is an administrator "sylius@example.com" identified by "sylius"
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's select attribute
Given this product has select attribute "T-Shirt material" with values "Banana skin" and "Cotton"
When I check this product's details
Then I should see the product attribute "T-Shirt material" with value "Banana skin" on the list
And I should also see the product attribute "T-Shirt material" with value "Cotton" on the list
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's select attribute after changing a value
Given this product has select attribute "T-Shirt material" with values "Banana skin" and "Cotton"
When this product attribute's value changed from "Cotton" to "Orange skin"
@ -25,14 +25,14 @@ Feature: Viewing product's select attributes
Then I should see the product attribute "T-Shirt material" with value "Banana skin" on the list
And I should also see the product attribute "T-Shirt material" with value "Orange skin" on the list
@todo @ui @javascript @api @no-postgres
@api @ui @no-postgres
Scenario: Viewing a detailed page with product's select attribute after removing an only value
Given this product has select attribute "T-Shirt material" with value "Cotton"
When this product attribute's value "Cotton" has been removed
And I check this product's details
Then I should not see the product attribute "T-Shirt material"
@todo @ui @javascript @api @no-postgres
@api @ui @no-postgres
Scenario: Viewing a detailed page with product's select attribute after removing one of the value
Given this product has select attribute "T-Shirt material" with values "Banana skin" and "Cotton"
When this product attribute's value "Cotton" has been removed

View file

@ -17,13 +17,13 @@ Feature: Viewing product's select attributes in different locales
And this product has also a select attribute "T-Shirt material" with value "Skórka banana" in "Polish (Poland)" locale
And this product has also a select attribute "T-Shirt colour" with value "Yellow" in "English (United States)" locale
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's select attribute in default locale
When I view product "T-Shirt banana"
Then I should see the product attribute "T-Shirt material" with value "Banana skin" on the list
And I should also see the product attribute "T-Shirt colour" with value "Yellow" on the list
@todo @ui @api
@api @ui
Scenario: Viewing a detailed page with product's select attribute in different locale
When I view product "T-Shirt banana" in the "Polish (Poland)" locale
Then I should see the product attribute "T-Shirt material" with value "Skórka banana" on the list

View file

@ -77,28 +77,14 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
public function getAttributeByName(string $name): ?string
{
$attributesTable = $this->getElement('attributes');
if (DriverHelper::isJavascript($this->getDriver())) {
try {
$attributesTab = $this->getElement('tab', ['%name%' => 'attributes']);
if (!$attributesTab->hasAttribute('[data-test-active]')) {
$attributesTab->click();
}
} catch (ElementNotFoundException) {
return null;
}
}
$nameTd = $attributesTable->find('css', sprintf('[data-test-product-attribute-name="%s"]', $name));
if (null === $nameTd) {
try {
$attributeValueElement = $this->getElement('attributes')
->find('css', sprintf('[data-test-product-attribute-value="%s"]', $name));
} catch (ElementNotFoundException) {
return null;
}
$row = $nameTd->getParent();
return trim($row->find('css', '[data-test-product-attribute-value]')->getText());
return $attributeValueElement->getText();
}
public function getAttributeListByName(string $name): array
@ -110,9 +96,8 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
public function getAttributes(): array
{
$attributesTable = $this->getElement('attributes');
return $attributesTable->findAll('css', '[data-test-product-attribute-name]');
return $this->getElement('attributes')
->findAll('css', '[data-test-product-attribute-name]');
}
public function getAverageRating(): float

View file

@ -5,11 +5,18 @@
{% block accordion_item_content %}
<table class="table table-lg table-list" {{ sylius_test_html_attribute('product-attributes') }}>
<tbody>
{% for attribute in product.getAttributesByLocale(configuration.request.locale, configuration.request.defaultLocale, sylius_base_locale)|sort_by('attribute.position') %}
{% for attribute_value in product.getAttributesByLocale(configuration.request.locale, configuration.request.defaultLocale, sylius_base_locale)|sort_by('attribute.position') %}
<tr>
<th scope="row" {{ sylius_test_html_attribute('product-attribute-name', attribute.name) }}>{{ attribute.name }}</th>
<td {{ sylius_test_html_attribute('product-attribute-value', attribute.name) }}>
{{ attribute.value }}
<th scope="row" {{ sylius_test_html_attribute('product-attribute-name', attribute_value.name) }}>{{ attribute_value.name }}</th>
<td {{ sylius_test_html_attribute('product-attribute-value', attribute_value.name) }}>
{% include [
'@SyliusAttribute/types/'~attribute_value.type~'.html.twig',
'@SyliusAttribute/types/default.html.twig'
] with {
'attribute': attribute_value,
'locale': configuration.request.locale,
'fallbackLocale': configuration.request.defaultLocale
} %}
</td>
</tr>
{% endfor %}