Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
LoginCustomerOnFrontendStep.php
Go to the documentation of this file.
1 <?php
8 
9 use Magento\Cms\Test\Page\CmsIndex;
11 use Magento\Customer\Test\Page\CustomerAccountLogin;
12 use Magento\Mtf\TestStep\TestStepInterface;
13 
17 class LoginCustomerOnFrontendStep implements TestStepInterface
18 {
24  protected $customer;
25 
31  protected $cmsIndex;
32 
39 
46 
54  public function __construct(
55  CmsIndex $cmsIndex,
56  CustomerAccountLogin $customerAccountLogin,
58  Customer $customer
59  ) {
60  $this->cmsIndex = $cmsIndex;
61  $this->customerAccountLogin = $customerAccountLogin;
62  $this->customer = $customer;
63  $this->logoutCustomerOnFrontend = $logoutCustomerOnFrontend;
64  }
65 
71  public function run()
72  {
73  $this->logoutCustomerOnFrontend->run();
74  $this->cmsIndex->getLinksBlock()->openLink('Sign In');
75  $this->cmsIndex->getCmsPageBlock()->waitPageInit();
76  $this->customerAccountLogin->getLoginBlock()->login($this->customer);
77  $this->cmsIndex->getCmsPageBlock()->waitPageInit();
78  $this->cmsIndex->getLinksBlock()->openLink('My Account');
79  $this->cmsIndex->getCmsPageBlock()->waitPageInit();
80  }
81 
87  public function cleanup()
88  {
89  $this->logoutCustomerOnFrontend->run();
90  }
91 }
__construct(CmsIndex $cmsIndex, CustomerAccountLogin $customerAccountLogin, LogoutCustomerOnFrontendStep $logoutCustomerOnFrontend, Customer $customer)