1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Magium\Magento\Actions\Customer; |
4
|
|
|
|
5
|
|
|
use Magium\Magento\Identities\Customer; |
6
|
|
|
use Magium\Magento\Themes\AbstractThemeConfiguration; |
7
|
|
|
use Magium\WebDriver\WebDriver; |
8
|
|
|
|
9
|
|
|
class FillRegistrationForm |
10
|
|
|
{ |
11
|
|
|
|
12
|
|
|
const ACTION = 'Customer\FillRegistrationForm'; |
13
|
|
|
|
14
|
|
|
protected $webdriver; |
15
|
|
|
protected $theme; |
16
|
|
|
protected $testCase; |
17
|
|
|
protected $navigator; |
18
|
|
|
protected $customerIdentity; |
19
|
|
|
|
20
|
|
|
public function __construct( |
21
|
|
|
WebDriver $webdriver, |
22
|
|
|
AbstractThemeConfiguration $theme, |
23
|
|
|
Customer $customerIdentity |
24
|
|
|
) { |
25
|
|
|
$this->webdriver = $webdriver; |
26
|
|
|
$this->theme = $theme; |
27
|
|
|
$this->customerIdentity = $customerIdentity; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function execute($registerForNewsletter = false) |
31
|
|
|
{ |
32
|
|
|
$firstnameElement = $this->webdriver->byXpath($this->theme->getRegisterFirstNameXpath()); |
33
|
|
|
$lastnameElement = $this->webdriver->byXpath($this->theme->getRegisterLastNameXpath()); |
34
|
|
|
$emailElement = $this->webdriver->byXpath($this->theme->getRegisterEmailXpath()); |
35
|
|
|
$passwordElement = $this->webdriver->byXpath($this->theme->getRegisterPasswordXpath()); |
36
|
|
|
$confirmElement = $this->webdriver->byXpath($this->theme->getRegisterConfirmPasswordXpath()); |
37
|
|
|
$registerElement = $this->webdriver->byXpath($this->theme->getRegisterNewsletterXpath()); |
38
|
|
|
|
39
|
|
|
$firstnameElement->sendKeys($this->customerIdentity->getFirstName()); |
40
|
|
|
$lastnameElement->sendKeys($this->customerIdentity->getLastName()); |
41
|
|
|
$emailElement->sendKeys($this->customerIdentity->getEmailAddress()); |
42
|
|
|
$passwordElement->sendKeys($this->customerIdentity->getPassword()); |
43
|
|
|
$confirmElement->sendKeys($this->customerIdentity->getPassword()); |
44
|
|
|
|
45
|
|
|
if ($registerForNewsletter) { |
46
|
|
|
$registerElement->click(); |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
} |