Navigating to a Customer in Magento’s Admin using Magium and Selenium

Some user stories are more complicated than others. Say that you have a feature where shipping addresses are verified by a third party when they are changed. One user story would be to do it via the frontend as a customer. Another story would be:

As a CSR I want to make an invalid modification to a customer address in the admin UI so that I can verify that the invalid customer address is not saved

Well, verifying the functionality is beyond the scope of Magium but getting to the customer is easy now.

There are three ways of doing it.

  1. By name
  2. By email
  3. By primary key/identifier

By name


use Magium\Magento\AbstractMagentoTestCase; use Magium\Magento\Actions\Admin\Login\Login; use Magium\Magento\Navigators\Admin\AdminMenu; use Magium\Magento\Navigators\Admin\Customer; class NavigateToCustomerTest extends AbstractMagentoTestCase { public function testNavigateToCustomerByName() { $this->getAction(Login::ACTION)->login(); $this->getNavigator(Customer::NAVIGATOR)->navigateTo( new Customer\ByName('Kevin Schroeder') ); } }

By email


use Magium\Magento\AbstractMagentoTestCase; use Magium\Magento\Actions\Admin\Login\Login; use Magium\Magento\Navigators\Admin\AdminMenu; use Magium\Magento\Navigators\Admin\Customer; class NavigateToCustomerTest extends AbstractMagentoTestCase { public function testNavigateToCustomerByName() { $this->getAction(Login::ACTION)->login(); $this->getNavigator(Customer::NAVIGATOR)->navigateTo( new Customer\ByEmail('[email protected]') ); } }

By primary key/identifier


use Magium\Magento\AbstractMagentoTestCase; use Magium\Magento\Actions\Admin\Login\Login; use Magium\Magento\Navigators\Admin\AdminMenu; use Magium\Magento\Navigators\Admin\Customer; class NavigateToCustomerTest extends AbstractMagentoTestCase { public function testNavigateToCustomerByName() { $this->getAction(Login::ACTION)->login(); $this->getNavigator(Customer::NAVIGATOR)->navigateTo( new Customer\ByPrimaryKey(12345) ); } }