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\ExpectedCondition; |
8
|
|
|
use Magium\WebDriver\WebDriver; |
9
|
|
|
|
10
|
|
|
class FillRegistrationForm |
11
|
|
|
{ |
12
|
|
|
|
13
|
|
|
const ACTION = 'Customer\FillRegistrationForm'; |
14
|
|
|
|
15
|
|
|
protected $webdriver; |
16
|
|
|
protected $theme; |
17
|
|
|
protected $testCase; |
18
|
|
|
protected $navigator; |
19
|
|
|
protected $customerIdentity; |
20
|
|
|
|
21
|
|
|
public function __construct( |
22
|
|
|
WebDriver $webdriver, |
23
|
|
|
AbstractThemeConfiguration $theme, |
24
|
|
|
Customer $customerIdentity |
25
|
|
|
) { |
26
|
|
|
$this->webdriver = $webdriver; |
27
|
|
|
$this->theme = $theme; |
28
|
|
|
$this->customerIdentity = $customerIdentity; |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
public function execute($registerForNewsletter = false) |
32
|
|
|
{ |
33
|
|
|
$this->webdriver->wait(5)->until(ExpectedCondition::elementExists($this->theme->getRegisterFirstNameXpath(), WebDriver::BY_XPATH)); |
|
|
|
|
34
|
|
|
|
35
|
|
|
$firstnameElement = $this->webdriver->byXpath($this->theme->getRegisterFirstNameXpath()); |
36
|
|
|
$this->webdriver->wait(5)->until(ExpectedCondition::visibilityOf($firstnameElement)); |
|
|
|
|
37
|
|
|
$lastnameElement = $this->webdriver->byXpath($this->theme->getRegisterLastNameXpath()); |
38
|
|
|
$emailElement = $this->webdriver->byXpath($this->theme->getRegisterEmailXpath()); |
39
|
|
|
$passwordElement = $this->webdriver->byXpath($this->theme->getRegisterPasswordXpath()); |
40
|
|
|
$confirmElement = $this->webdriver->byXpath($this->theme->getRegisterConfirmPasswordXpath()); |
41
|
|
|
$registerElement = $this->webdriver->byXpath($this->theme->getRegisterNewsletterXpath()); |
42
|
|
|
|
43
|
|
|
$firstnameElement->sendKeys($this->customerIdentity->getFirstName()); |
44
|
|
|
$lastnameElement->sendKeys($this->customerIdentity->getLastName()); |
45
|
|
|
$emailElement->sendKeys($this->customerIdentity->getEmailAddress()); |
46
|
|
|
$passwordElement->sendKeys($this->customerIdentity->getPassword()); |
47
|
|
|
$confirmElement->sendKeys($this->customerIdentity->getPassword()); |
48
|
|
|
|
49
|
|
|
if ($registerForNewsletter) { |
50
|
|
|
$registerElement->click(); |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
} |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: