Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Rework ShowPage and IndexPage in Shop/Product to DataAttributes#10953

Merged
GSadee merged 3 commits into
Sylius:masterfrom
Tomanhez:add-data-attributes-shop-product-index-show
Dec 20, 2019
Merged

Rework ShowPage and IndexPage in Shop/Product to DataAttributes#10953
GSadee merged 3 commits into
Sylius:masterfrom
Tomanhez:add-data-attributes-shop-product-index-show

Conversation

@Tomanhez
Copy link
Copy Markdown
Contributor

Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
License MIT

@Tomanhez Tomanhez requested a review from a team as a code owner December 17, 2019 10:35
@Tomanhez Tomanhez force-pushed the add-data-attributes-shop-product-index-show branch 2 times, most recently from ecfd04a to 45741ba Compare December 18, 2019 08:04
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Bundle/ShopBundle/Resources/views/Product/Show/_options.html.twig Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/ShowPage.php Outdated
@Tomanhez Tomanhez force-pushed the add-data-attributes-shop-product-index-show branch from 45741ba to 9c285da Compare December 18, 2019 10:11
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
@Tomanhez Tomanhez force-pushed the add-data-attributes-shop-product-index-show branch from 9c285da to 90dbf81 Compare December 18, 2019 11:38
@pamil pamil added DX Issues and PRs aimed at improving Developer eXperience. Behat Issues and PRs aimed at improving Behat usage. labels Dec 18, 2019
@Tomanhez Tomanhez force-pushed the add-data-attributes-shop-product-index-show branch 2 times, most recently from 455955b to bccf93d Compare December 19, 2019 09:08
@Tomanhez Tomanhez force-pushed the add-data-attributes-shop-product-index-show branch from bccf93d to 4fa7f94 Compare December 19, 2019 13:42
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/IndexPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/ShowPage.php Outdated
Comment thread src/Sylius/Behat/Page/Shop/Product/ShowPage.php Outdated
Assert::notNull($products);

return null !== $products->find('css', sprintf('.sylius-product-name:contains("%s")', $productName));
return $productName === $products->find('css', sprintf('[data-test-product-name="%s"]', $productName))->getText();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use here getElement method

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I can't because if I use getElement and return products, next if I try use getElement on products I get error.

Screenshot 2019-12-20 at 07 27 18

@Tomanhez Tomanhez force-pushed the add-data-attributes-shop-product-index-show branch 2 times, most recently from d61f36e to f44d19e Compare December 20, 2019 06:41
Comment thread behat.yml.dist
public function isProductOnList(string $productName): bool
{
return null !== $this->getDocument()->find('css', sprintf('.sylius-product-name:contains("%s")', $productName));
try{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you change it to try/catch block?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when I replace getDocument() to getElement() and element will not exist, getElement throw exception, we can use hasElement if all element is defined like hasElement('product') but if we try hasElement('product', ['%productName% => $productName']) we get error

@Tomanhez Tomanhez force-pushed the add-data-attributes-shop-product-index-show branch from f44d19e to 08804b7 Compare December 20, 2019 10:31
@GSadee GSadee merged commit d99201c into Sylius:master Dec 20, 2019
@GSadee
Copy link
Copy Markdown
Member

GSadee commented Dec 20, 2019

Thank you, Tomasz! 🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Behat Issues and PRs aimed at improving Behat usage. DX Issues and PRs aimed at improving Developer eXperience.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants