|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Sylius package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Paweł Jędrzejewski |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
declare(strict_types=1); |
|
13
|
|
|
|
|
14
|
|
|
namespace Sylius\Behat\Page\Shop\Order; |
|
15
|
|
|
|
|
16
|
|
|
use FriendsOfBehat\PageObjectExtension\Page\SymfonyPage; |
|
17
|
|
|
|
|
18
|
|
|
class ThankYouPage extends SymfonyPage implements ThankYouPageInterface |
|
19
|
|
|
{ |
|
20
|
|
|
/** |
|
21
|
|
|
* {@inheritdoc} |
|
22
|
|
|
*/ |
|
23
|
|
|
public function goToTheChangePaymentMethodPage(): void |
|
24
|
|
|
{ |
|
25
|
|
|
$this->getElement('payment_method_page')->click(); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function goToOrderDetailsInAccount(): void |
|
29
|
|
|
{ |
|
30
|
|
|
$this->getElement('order_details_in_account')->click(); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* {@inheritdoc} |
|
35
|
|
|
*/ |
|
36
|
|
|
public function hasThankYouMessage() |
|
37
|
|
|
{ |
|
38
|
|
|
$thankYouMessage = $this->getElement('thank_you')->getText(); |
|
39
|
|
|
|
|
40
|
|
|
return false !== strpos($thankYouMessage, 'Thank you!'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* {@inheritdoc} |
|
45
|
|
|
*/ |
|
46
|
|
|
public function getInstructions() |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->getElement('instructions')->getText(); |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* {@inheritdoc} |
|
53
|
|
|
*/ |
|
54
|
|
|
public function hasInstructions() |
|
55
|
|
|
{ |
|
56
|
|
|
return null !== $this->getDocument()->find('css', '#sylius-payment-method-instructions'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* {@inheritdoc} |
|
61
|
|
|
*/ |
|
62
|
|
|
public function hasChangePaymentMethodButton() |
|
63
|
|
|
{ |
|
64
|
|
|
return null !== $this->getDocument()->find('css', '#payment-method-page'); |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
|
|
public function hasRegistrationButton(): bool |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->getDocument()->hasLink('Create an account'); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
public function createAccount(): void |
|
73
|
|
|
{ |
|
74
|
|
|
$this->getDocument()->clickLink('Create an account'); |
|
75
|
|
|
} |
|
76
|
|
|
|
|
77
|
|
|
public function getRouteName(): string |
|
78
|
|
|
{ |
|
79
|
|
|
return 'sylius_shop_thank_you'; |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
protected function getDefinedElements(): array |
|
83
|
|
|
{ |
|
84
|
|
|
return array_merge(parent::getDefinedElements(), [ |
|
85
|
|
|
'instructions' => '#sylius-payment-method-instructions', |
|
86
|
|
|
'order_details_in_account' => '#sylius-show-order-in-account', |
|
87
|
|
|
'payment_method_page' => '#payment-method-page', |
|
88
|
|
|
'thank_you' => '#sylius-thank-you', |
|
89
|
|
|
]); |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
|