Fix behats

This commit is contained in:
Michał Pysiak 2024-07-02 13:37:57 +02:00 committed by Grzegorz Sadowski
parent eab7b8d0b5
commit dd988e3802
2 changed files with 21 additions and 1 deletions

View file

@ -47,7 +47,7 @@ Feature: Statistics
And 4 more new customers have paid 5 orders placed for total of "$5,000.37"
And 2 more new customers have paid 2 orders placed for total of "$5,000.37"
When I view statistics for "United States" channel and previous year split by month
And I view statistics for "United States" channel and next year split by month
And I view statistics for "United States" channel and next year
Then I should see 6 new customers
And I should see 7 paid orders
And there should be total sales of "$10,000.74"

View file

@ -76,6 +76,26 @@ final class DashboardContext implements Context
};
}
/**
* @When /^I view statistics for ("[^"]+" channel) and (previous|next) year$/
*
* @throws UnexpectedPageException
*/
public function iViewStatisticsForPreviousPeriod(
ChannelInterface $channel,
string $period,
): void {
if (!$this->dashboardPage->isOpen(['channel' => $channel->getCode()])) {
$this->dashboardPage->open(['channel' => $channel->getCode()]);
}
match ($period) {
'previous' => $this->dashboardPage->choosePreviousPeriod(),
'next' => $this->dashboardPage->chooseNextPeriod(),
default => null,
};
}
/**
* @When I choose :channelName channel
*/