|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the Spryker Commerce OS. |
|
5
|
|
|
* For full license information, please view the LICENSE file that was distributed with this source code. |
|
6
|
|
|
*/ |
|
7
|
|
|
|
|
8
|
|
|
namespace PyzTest\Yves\Customer; |
|
9
|
|
|
|
|
10
|
|
|
use Codeception\Actor; |
|
11
|
|
|
use Codeception\Step\Assertion; |
|
12
|
|
|
use PyzTest\Yves\Customer\PageObject\CustomerLoginPage; |
|
13
|
|
|
use PyzTest\Yves\Customer\PageObject\CustomerRegistrationPage; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Inherited Methods |
|
17
|
|
|
* |
|
18
|
|
|
* @method void wantToTest($text) |
|
19
|
|
|
* @method void wantTo($text) |
|
20
|
|
|
* @method void execute($callable) |
|
21
|
|
|
* @method void expectTo($prediction) |
|
22
|
|
|
* @method void expect($prediction) |
|
23
|
|
|
* @method void amGoingTo($argumentation) |
|
24
|
|
|
* @method void am($role) |
|
25
|
|
|
* @method void lookForwardTo($achieveValue) |
|
26
|
|
|
* @method void comment($description) |
|
27
|
|
|
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) |
|
28
|
|
|
* |
|
29
|
|
|
* @SuppressWarnings(\PyzTest\Yves\Customer\PHPMD) |
|
30
|
|
|
*/ |
|
31
|
|
|
class CustomerPresentationTester extends Actor |
|
32
|
|
|
{ |
|
33
|
|
|
use _generated\CustomerPresentationTesterActions; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
protected const URL_STORE_PREFIX = '/DE'; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @param string $email |
|
42
|
|
|
* @param string $password |
|
43
|
|
|
* |
|
44
|
|
|
* @return void |
|
45
|
|
|
*/ |
|
46
|
|
|
public function submitLoginForm($email, $password): void |
|
47
|
|
|
{ |
|
48
|
|
|
$i = $this; |
|
49
|
|
|
$i->submitForm(['name' => 'loginForm'], [ |
|
50
|
|
|
CustomerLoginPage::FORM_FIELD_SELECTOR_EMAIL => $email, |
|
51
|
|
|
CustomerLoginPage::FORM_FIELD_SELECTOR_PASSWORD => $password, |
|
52
|
|
|
]); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
/** |
|
56
|
|
|
* @return void |
|
57
|
|
|
*/ |
|
58
|
|
|
public function fillOutRegistrationForm(): void |
|
59
|
|
|
{ |
|
60
|
|
|
$i = $this; |
|
61
|
|
|
$customerTransfer = CustomerRegistrationPage::getCustomerData(CustomerRegistrationPage::NEW_CUSTOMER_EMAIL); |
|
62
|
|
|
|
|
63
|
|
|
$i->selectOption(CustomerRegistrationPage::FORM_FIELD_SELECTOR_SALUTATION, $customerTransfer->getSalutation()); |
|
64
|
|
|
$i->fillField(CustomerRegistrationPage::FORM_FIELD_SELECTOR_FIRST_NAME, $customerTransfer->getFirstName()); |
|
65
|
|
|
$i->fillField(CustomerRegistrationPage::FORM_FIELD_SELECTOR_LAST_NAME, $customerTransfer->getLastName()); |
|
66
|
|
|
$i->fillField(CustomerRegistrationPage::FORM_FIELD_SELECTOR_EMAIL, $customerTransfer->getEmail()); |
|
67
|
|
|
$i->fillField(CustomerRegistrationPage::FORM_FIELD_SELECTOR_PASSWORD, $customerTransfer->getPassword()); |
|
68
|
|
|
$i->fillField(CustomerRegistrationPage::FORM_FIELD_SELECTOR_PASSWORD_CONFIRM, $customerTransfer->getPassword()); |
|
69
|
|
|
$i->click(CustomerRegistrationPage::FORM_FIELD_SELECTOR_ACCEPT_TERMS); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param string $uri |
|
74
|
|
|
* |
|
75
|
|
|
* @return void |
|
76
|
|
|
*/ |
|
77
|
|
|
public function seeCurrentUrlEquals(string $uri): void |
|
78
|
|
|
{ |
|
79
|
|
|
if ($this->getLocator()->store()->facade()->isDynamicStoreEnabled() === true) { |
|
80
|
|
|
$uri = sprintf('%s%s', static::URL_STORE_PREFIX, $uri); |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
|
|
$this->getScenario()->runStep(new Assertion('seeCurrentUrlEquals', func_get_args())); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|