Skip to content

Commit

Permalink
Adjust behat scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubtobiasz committed Jul 15, 2022
1 parent 28e39e2 commit 27406cd
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 25 deletions.
15 changes: 0 additions & 15 deletions features/channel/browsing_shop_on_right_channel.feature

This file was deleted.

15 changes: 15 additions & 0 deletions features/channel/filtering_out_disabled_channels.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@channels
Feature: Filtering out disabled channels
In order to avoid mistakes
As a Customer
I want to be able to browse only available shops

Background:
Given the store operates on a channel named "Fashion" in "USD" currency and with hostname "127.0.0.1"
And the store operates on a channel named "Furniture" in "EUR" currency and with hostname "127.0.0.1"
And the channel "Fashion" is disabled

@ui
Scenario: Seeing Furniture shop homepage
When I visit the homepage
Then I should see "Furniture" shop
7 changes: 7 additions & 0 deletions src/Sylius/Behat/Context/Setup/ChannelContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,11 @@ private function changeChannelState(ChannelInterface $channel, $state)
$this->channelManager->flush();
$this->sharedStorage->set('channel', $channel);
}

private function getHostnameFromUrl(string $url): ?string
{
$parsedUrl = parse_url($url);

return $parsedUrl['host'] ?? null;
}
}
12 changes: 2 additions & 10 deletions src/Sylius/Behat/Context/Ui/ChannelContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,9 @@ public function shouldSeePluginMainPageWithContent(string $content): void
}

/**
* @When I visit the homepage
* @Then I should see :channel shop
*/
public function iVisitTheHomepage(): void
{
$this->homePage->open();
}

/**
* @Then I should be on channel :channel
*/
public function iShouldBeOnChannel(ChannelInterface $channel): void
public function iShouldSeeShop(ChannelInterface $channel): void
{
Assert::eq($this->homePage->getMetaTitle(), $channel->getName());
}
Expand Down
1 change: 1 addition & 0 deletions src/Sylius/Behat/Context/Ui/Shop/HomepageContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function __construct(
/**
* @When I check latest products
* @When I check available taxons
* @When I visit the homepage
*/
public function iCheckLatestProducts(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,7 @@ default:
- sylius.behat.context.setup.channel

- sylius.behat.context.ui.channel

- sylius.behat.context.ui.shop.homepage
filters:
tags: "@channels&&@ui"

0 comments on commit 27406cd

Please sign in to comment.