1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Magium\Magento\Themes\MagentoEE113; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use Magium\Magento\Themes\AbstractThemeConfiguration; |
7
|
|
|
|
8
|
|
View Code Duplication |
class ThemeConfiguration extends AbstractThemeConfiguration |
|
|
|
|
9
|
|
|
{ |
10
|
|
|
|
11
|
|
|
const THEME = 'Magium\Magento\Themes\MagentoEE113\ThemeConfiguration'; |
12
|
|
|
|
13
|
|
|
public $homeXpath = '//a[@class="logo"]'; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @var string The Xpath string that finds the base of the navigation menu |
17
|
|
|
*/ |
18
|
|
|
public $navigationBaseXPathSelector = '//ul[@id="nav"]'; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @var string The Xpath string that can be used iteratively to find child navigation nodes |
22
|
|
|
*/ |
23
|
|
|
|
24
|
|
|
public $navigationChildXPathSelector = 'a[concat(" ",normalize-space(.)," ") = " %s "]/..'; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @var string A simple, default path to use for categories. |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
public $navigationPathToSimpleProductCategory = '{{Electronics}}/{{Cell Phones}}'; |
31
|
|
|
|
32
|
|
|
public $defaultSimpleProductName = '{{Nokia 2610 Phone}}'; |
33
|
|
|
|
34
|
|
|
public $productPagePriceXpath = '(//form[@id="product_addtocart_form"]/descendant::span[contains(concat(" ",normalize-space(@class)," ")," regular-price ")]/span[contains(concat(" ",normalize-space(@class)," ")," price ")])[1]'; |
35
|
|
|
|
36
|
|
|
public $navigationPathToConfigurableProductCategory = '{{Apparel}}/{{Shirts}}'; |
37
|
|
|
|
38
|
|
|
public $defaultConfigurableProductName = '{{Zolof The Rock And Roll Destroyer: LOL Cat T-shirt}}'; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var string Xpath to add a Simple product to the cart from the product's page |
42
|
|
|
*/ |
43
|
|
|
|
44
|
|
|
public $addToCartXpath = '//button[@title="{{Add to Cart}}" and contains(concat(" ",normalize-space(@class)," ")," btn-cart ")]'; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @var string Xpath to add a Simple product to the cart from the category page |
48
|
|
|
*/ |
49
|
|
|
|
50
|
|
|
public $categoryAddToCartButtonXPathSelector = '//button[@title="{{Add to Cart}}" and contains(concat(" ",normalize-space(@class)," ")," btn-cart ")]'; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string Xpath to find a product's link on a category page. Used to navigate to the product from the category |
54
|
|
|
*/ |
55
|
|
|
|
56
|
|
|
public $categoryProductPageXpath = '//h2[@class="product-name"]/descendant::a'; |
57
|
|
|
|
58
|
|
|
public $categorySpecificProductPageXpath = '//h2[@class="product-name"]/descendant::a[.="%s"]'; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var string Xpath used after a product has been added to the cart to verify that the product has been added to the cart |
62
|
|
|
*/ |
63
|
|
|
|
64
|
|
|
public $addToCartSuccessXpath = '//li[@class="success-msg" and contains(., "{{was added to your shopping cart}}")]'; |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @var string The base URL of the installation |
68
|
|
|
*/ |
69
|
|
|
|
70
|
|
|
public $baseUrl = 'http://localhost/'; |
71
|
|
|
|
72
|
|
|
public $myAccountTitle = '{{My Account}}'; |
73
|
|
|
|
74
|
|
|
public $registerFirstNameXpath = '//input[@id="firstname"]'; |
75
|
|
|
public $registerLastNameXpath = '//input[@id="lastname"]'; |
76
|
|
|
public $registerEmailXpath = '//input[@id="email_address"]'; |
77
|
|
|
public $registerPasswordXpath = '//input[@id="password"]'; |
78
|
|
|
public $registerConfirmPasswordXpath = '//input[@id="confirmation"]'; |
79
|
|
|
public $registerNewsletterXpath = '//input[@id="is_subscribed"]'; |
80
|
|
|
public $registerSubmitXpath = '//button[@type="submit" and @title="{{Submit}}"]'; |
81
|
|
|
|
82
|
|
|
public $logoutSuccessXpath = '//div[contains(concat(" ",normalize-space(@class)," ")," page-title ")]/descendant::h1[.="{{You are now logged out}}"]'; |
83
|
|
|
|
84
|
|
|
public $layeredNavigationTestXpath = '//dl[@id="narrow-by-list"]'; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var array Instructions in an Xpath array syntax to get to the customer registration page |
88
|
|
|
*/ |
89
|
|
|
|
90
|
|
|
public $logoutNavigationInstructions = [ |
91
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//ul[@class="links"]/descendant::a[.="{{Log Out}}"]'], |
92
|
|
|
// [\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//div[@id="header-account"]/descendant::a[@title="{{Log Out}}"]'] |
|
|
|
|
93
|
|
|
]; |
94
|
|
|
|
95
|
|
|
public $cartNavigationInstructions = [ |
96
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//string[@id="cartHeader"]'], |
97
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//div[@id="topCartContent"]/descendant::a/span[.="{{Go to Shopping Cart}}"]'] |
98
|
|
|
]; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @var array Instructions in an Xpath array syntax to get to the login page. |
102
|
|
|
*/ |
103
|
|
|
|
104
|
|
|
public $navigateToCustomerPageInstructions = [ |
105
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//ul[@class="links"]/descendant::a[.="{{My Account}}"]'], |
106
|
|
|
//[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//div[@id="header-account"]/descendant::a[@title="My Account"]'] |
|
|
|
|
107
|
|
|
]; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @var array Instructions in an Xpath array syntax to get to the start of the checkout page |
111
|
|
|
*/ |
112
|
|
|
|
113
|
|
|
public $checkoutNavigationInstructions = [ |
114
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//ul[@class="links"]/descendant::a[@title="{{Checkout}}"]'], |
115
|
|
|
// [\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//div[@class="minicart-actions"]/descendant::a[@title="Checkout"]'] |
|
|
|
|
116
|
|
|
]; |
117
|
|
|
|
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @var array Instructions in an Xpath array syntax to get to the customer registration page |
121
|
|
|
*/ |
122
|
|
|
|
123
|
|
|
public $registrationNavigationInstructions = [ |
124
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//ul[@class="links"]/descendant::a[.="{{My Account}}"]'], |
125
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//button/span/span[.="{{Register}}"]/../..'] |
126
|
|
|
]; |
127
|
|
|
|
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* This is a hard one. Each of the summary checkout products will be iterated over until they cannot be found. Having |
131
|
|
|
* this work in a manner that gets all of the products, in all languages, in all themes, is quite difficult and |
132
|
|
|
* so the Xpath selector needs to be one that can find each individual column with an incrementing iterator. |
133
|
|
|
* |
134
|
|
|
* @see Magium\Magento\Actions\Checkout\Extractors\CartSummary for an example on how this is done |
135
|
|
|
* |
136
|
|
|
* @var string |
137
|
|
|
*/ |
138
|
|
|
|
139
|
|
|
public $cartSummaryCheckoutProductLoopPriceXpath = '(//table[@id="checkout-review-table"]/tbody/descendant::td[@data-rwd-label="Price"])[%d]'; |
140
|
|
|
public $cartSummaryCheckoutProductLoopNameXpath = '(//table[@id="checkout-review-table"]/tbody/descendant::td/h3)[%d]'; |
141
|
|
|
public $cartSummaryCheckoutProductLoopQtyXpath = '(//table[@id="checkout-review-table"]/tbody/descendant::td[@data-rwd-label="Qty"])[%d]'; |
142
|
|
|
public $cartSummaryCheckoutProductLoopSubtotalXpath = '(//table[@id="checkout-review-table"]/tbody/descendant::td[@data-rwd-label="Subtotal"])[%d]'; |
143
|
|
|
|
144
|
|
|
public $cartSummaryCheckoutSubTotal = '//table[@id="checkout-review-table"]/tfoot/tr/td[concat(" ",normalize-space(.)," ") = " Subtotal "]/../td[2]'; |
145
|
|
|
public $cartSummaryCheckoutTax = '//table[@id="checkout-review-table"]/tfoot/tr/td[concat(" ",normalize-space(.)," ") = " Tax "]/../td[2]'; |
146
|
|
|
public $cartSummaryCheckoutGrandTotal = '//table[@id="checkout-review-table"]/tfoot/tr/td[concat(" ",normalize-space(.)," ") = " Grand Total "]/../td[2]'; |
147
|
|
|
public $cartSummaryCheckoutShippingTotal = '//table[@id="checkout-review-table"]/tfoot/tr/td[contains(concat(" ",normalize-space(.)," "), " Shipping & Handling (")]/../td[2]'; |
148
|
|
|
|
149
|
|
|
public $breadCrumbXpath = '//div[@class="breadcrumbs"]'; |
150
|
|
|
|
151
|
|
|
public $productListBaseXpath = '//ol[contains(concat(" ",normalize-space(@class)," ")," products-list ")]/li[%d]'; |
152
|
|
|
public $productListDescriptionXpath = '/descendant::div[contains(concat(" ",normalize-space(@class)," ")," desc ")]'; |
153
|
|
|
public $productListTitleXpath = '/descendant::h2[@class="product-name"]/a'; |
154
|
|
|
public $productListCompareLinkXpath = '/descendant::ul[@class="add-to-links"]/descendant::a[@class="link-compare"]'; |
155
|
|
|
public $productListImageXpath = '/descendant::a[@class="product-image"]/img'; |
156
|
|
|
public $productListLinkXpath = '/descendant::a[@class="product-image"]'; |
157
|
|
|
public $productListOriginalPriceXpath = '/descendant::div[@class="price-box"]/descendant::p[@class="old-price"]/descendant::*[@class="price"]'; |
158
|
|
|
public $productListPriceXpath = '/descendant::div[@class="price-box"]/descendant::*[@class="regular-price" or @class="special-price"]/descendant::span[@class="price"]'; |
159
|
|
|
public $productListWishlistLinkXpath = '/descendant::ul[@class="add-to-links"]/descendant::a[@class="link-wishlist"]'; |
160
|
|
|
public $productListAddToCartLinkXpath = '/descendant::div[@class="product-shop"]/descendant::button[contains(concat(" ",normalize-space(@class)," ")," btn-cart ")]'; |
161
|
|
|
|
162
|
|
|
public $productGridBaseXpath = '//ul[contains(concat(" ",normalize-space(@class)," ")," products-grid ")]/li[%d]'; |
163
|
|
|
public $productGridDescriptionXpath = '/*[.="no description in the grid view"]'; |
164
|
|
|
public $productGridTitleXpath = '/descendant::h2[@class="product-name"]/a'; |
165
|
|
|
public $productGridCompareLinkXpath = '/descendant::ul[@class="add-to-links"]/descendant::a[@class="link-compare"]'; |
166
|
|
|
public $productGridImageXpath = '/descendant::a[@class="product-image"]/img'; |
167
|
|
|
public $productGridLinkXpath = '/descendant::a[@class="product-image"]'; |
168
|
|
|
public $productGridOriginalPriceXpath = '/descendant::div[@class="price-box"]/descendant::p[@class="old-price"]/descendant::*[@class="price"]'; |
169
|
|
|
public $productGridPriceXpath = '/descendant::div[@class="price-box"]/descendant::*[@class="regular-price" or @class="special-price"]/descendant::span[@class="price"]'; |
170
|
|
|
public $productGridWishlistLinkXpath = '/descendant::ul[@class="add-to-links"]/descendant::a[@class="link-wishlist"]'; |
171
|
|
|
public $productGridAddToCartLinkXpath = '/descendant::div[@class="actions"]/descendant::button[contains(concat(" ",normalize-space(@class)," ")," btn-cart ")]'; |
172
|
|
|
|
173
|
|
|
public $productCollectionViewModeXpath = '//p[@class="view-mode"]/strong'; |
174
|
|
|
public $productCollectionSortByXpath = '//div[@class="sort-by"]/descendant::option[@selected]'; // We select using the div, not the title because the title may be translated |
175
|
|
|
public $productCollectionShowCountXpath = '//div[@class="limiter"]/descendant::option[@selected]'; // dittos |
176
|
|
|
public $productCollectionShowCountOptionsXpath = '//div[@class="limiter"]/descendant::option'; |
177
|
|
|
public $productCollectionProductCountXpath = '//div[contains(concat(" ",normalize-space(@class)," ")," pager ")]/descendant::p[contains(concat(" ",normalize-space(@class)," ")," amount ")]'; |
178
|
|
|
|
179
|
|
|
public $layeredNavigationBaseXpath = '//div[contains(concat(" ",normalize-space(@class)," ")," block-layered-nav ")]'; |
180
|
|
|
|
181
|
|
|
public $searchInputXpath = '//input[@id="search"]'; |
182
|
|
|
public $searchSubmitXpath = '//form[@id="search_mini_form"]/descendant::button[@type="submit"]'; |
183
|
|
|
|
184
|
|
|
public $searchSuggestionTextXpath = '//div[@id="search_autocomplete"]/descendant::li[@title][%d]'; |
185
|
|
|
public $searchSuggestionCountXpath = '//div[@id="search_autocomplete"]/descendant::li[@title][%d]/span[@class="amount"]'; |
186
|
|
|
|
187
|
|
|
public $simpleProductQtyXpath = '//input[@id="qty"]'; |
188
|
|
|
|
189
|
|
|
public $configurableProductLabelXpath = '//fieldset[@id="product-options-wrapper"]/descendant::label'; |
190
|
|
|
|
191
|
|
|
public $configurableProductOptionXpath = '(%s)[%d]/ancestor::dt/following-sibling::dd[1]/descendant::option[starts-with(., "%s")]'; |
192
|
|
|
|
193
|
|
|
public $viewModeAttributeName = 'class'; |
194
|
|
|
|
195
|
|
|
public $breadCrumbMemberXpath = '/descendant::a[concat(" ",normalize-space(.)," ")=" {{%s}} "]'; |
196
|
|
|
public $breadCrumbSelectorXpath = '/descendant::a[%d]'; |
197
|
|
|
|
198
|
|
|
public $layeredNavigationFilterNameXpath = '//dl[@id="narrow-by-list"]/dt'; |
199
|
|
|
|
200
|
|
|
public $layeredNavigationFilterTypesXpath = '//dt[.="%s"]/following-sibling::dd[1]/descendant::li'; |
201
|
|
|
public $layeredNavigationFilterLinkXpath = '//dt[.="%s"]/following-sibling::dd[1]/descendant::li/descendant::a'; |
202
|
|
|
public $layeredNavigationFilterNameElementXpath = '//dl[@id="narrow-by-list"]/dt[normalize-space(.) = "%s"]'; |
203
|
|
|
|
204
|
|
|
public $storeSwitcherInstructionsXpath = [ |
205
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//select[@id="select-language"]/descendant::option[contains(@href,"___store=%s"]'], |
206
|
|
|
]; |
207
|
|
|
|
208
|
|
|
public function getCustomerThemeClass() |
209
|
|
|
{ |
210
|
|
|
return 'Magium\Magento\Themes\MagentoEE113\Customer\ThemeConfiguration'; |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
public function getCheckoutThemeClass() |
214
|
|
|
{ |
215
|
|
|
return 'Magium\Magento\Themes\MagentoEE113\OnePageCheckout\ThemeConfiguration'; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
} |
219
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.