Open Vinai opened 11 years ago
I have a step-definition to view a product in a specific store. Perhaps it helps you.
And I visit the product with the sku "123test" in the "Brand abc" store
Step-Definition
/**
* @Given I visit the product with the sku :sku in the :site store
*/
public function iVisitTheProductWithTheSkuInTheStore($sku, $site) {
$websites = Mage::app()->getWebsites();
foreach ($websites as $website) {
$name = $website->getName();
if ($site == $name) {
// Open Webpage.
Mage::app()->setCurrentStore($website->getId());
$product = Mage::getModel('catalog/product')
->loadByAttribute('sku', $sku);
if (!$product) {
throw new Exception("A product with the sku " . $sku . " does not exist.");
}
$url = $product->getProductUrl();
return $this->visit($url);
}
}
throw new Exception("Website " . $site . " does not exist.");
}
Any specified store view will be overridden by
MageTest\MagentoExtension\Fixture\Product::create()