I Want To Log In As A Customer
This requires 2-3 components
- The Identity to log in as
- A Navigator that navigates to the login screen
- An Action that does the logging in
Why 2-3 and not all 3? Because there is a NavigateAndLogin
navigator available that does both
<?php
use Magium\Magento\AbstractMagentoTestCase;
use Magium\Magento\Actions\Customer\Login;
use Magium\Magento\Navigators\Customer\AccountHome;
class ToCustomerLoginTest extends AbstractMagentoTestCase
{
public function testLoginCustomer()
{
$this->commandOpen($this->getTheme()->getBaseUrl());
$this->getNavigator(AccountHome::NAVIGATOR)->navigateTo();
$this->getAction(Login::ACTION)->login();
self::assertEquals('My Account', $this->webdriver->getTitle());
}
}