|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Magium\Magento\Themes\Magento18; |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
use Magium\Magento\Themes\AbstractThemeConfiguration; |
|
7
|
|
|
|
|
8
|
|
|
class ThemeConfiguration extends AbstractThemeConfiguration |
|
9
|
|
|
{ |
|
10
|
|
|
|
|
11
|
|
|
const THEME = 'Magium\Magento\Themes\Magento18\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, '//a[@class="top-link-cart"]'] |
|
97
|
|
|
]; |
|
98
|
|
|
|
|
99
|
|
|
/** |
|
100
|
|
|
* @var array Instructions in an Xpath array syntax to get to the login page. |
|
101
|
|
|
*/ |
|
102
|
|
|
|
|
103
|
|
|
public $navigateToCustomerPageInstructions = [ |
|
104
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//ul[@class="links"]/descendant::a[.="{{My Account}}"]'], |
|
105
|
|
|
//[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//div[@id="header-account"]/descendant::a[@title="My Account"]'] |
|
|
|
|
|
|
106
|
|
|
]; |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @var array Instructions in an Xpath array syntax to get to the start of the checkout page |
|
110
|
|
|
*/ |
|
111
|
|
|
|
|
112
|
|
|
public $checkoutNavigationInstructions = [ |
|
113
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//ul[@class="links"]/descendant::a[@title="{{Checkout}}"]'], |
|
114
|
|
|
// [\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//div[@class="minicart-actions"]/descendant::a[@title="Checkout"]'] |
|
|
|
|
|
|
115
|
|
|
]; |
|
116
|
|
|
|
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* @var array Instructions in an Xpath array syntax to get to the customer registration page |
|
120
|
|
|
*/ |
|
121
|
|
|
|
|
122
|
|
|
public $registrationNavigationInstructions = [ |
|
123
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//ul[@class="links"]/descendant::a[.="{{My Account}}"]'], |
|
124
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//button[@title="{{Create an Account}}"]'] |
|
125
|
|
|
]; |
|
126
|
|
|
|
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* This is a hard one. Each of the summary checkout products will be iterated over until they cannot be found. Having |
|
130
|
|
|
* this work in a manner that gets all of the products, in all languages, in all themes, is quite difficult and |
|
131
|
|
|
* so the Xpath selector needs to be one that can find each individual column with an incrementing iterator. |
|
132
|
|
|
* |
|
133
|
|
|
* @see Magium\Magento\Actions\Checkout\Extractors\CartSummary for an example on how this is done |
|
134
|
|
|
* |
|
135
|
|
|
* @var string |
|
136
|
|
|
*/ |
|
137
|
|
|
|
|
138
|
|
|
public $cartSummaryCheckoutProductLoopPriceXpath = '(//table[@id="checkout-review-table"]/tbody/descendant::td[@data-rwd-label="Price"])[%d]'; |
|
139
|
|
|
public $cartSummaryCheckoutProductLoopNameXpath = '(//table[@id="checkout-review-table"]/tbody/descendant::td/h3)[%d]'; |
|
140
|
|
|
public $cartSummaryCheckoutProductLoopQtyXpath = '(//table[@id="checkout-review-table"]/tbody/descendant::td[@data-rwd-label="Qty"])[%d]'; |
|
141
|
|
|
public $cartSummaryCheckoutProductLoopSubtotalXpath = '(//table[@id="checkout-review-table"]/tbody/descendant::td[@data-rwd-label="Subtotal"])[%d]'; |
|
142
|
|
|
|
|
143
|
|
|
public $cartSummaryCheckoutSubTotal = '//table[@id="checkout-review-table"]/tfoot/tr/td[concat(" ",normalize-space(.)," ") = " Subtotal "]/../td[2]'; |
|
144
|
|
|
public $cartSummaryCheckoutTax = '//table[@id="checkout-review-table"]/tfoot/tr/td[concat(" ",normalize-space(.)," ") = " Tax "]/../td[2]'; |
|
145
|
|
|
public $cartSummaryCheckoutGrandTotal = '//table[@id="checkout-review-table"]/tfoot/tr/td[concat(" ",normalize-space(.)," ") = " Grand Total "]/../td[2]'; |
|
146
|
|
|
public $cartSummaryCheckoutShippingTotal = '//table[@id="checkout-review-table"]/tfoot/tr/td[contains(concat(" ",normalize-space(.)," "), " Shipping & Handling (")]/../td[2]'; |
|
147
|
|
|
|
|
148
|
|
|
public $breadCrumbXpath = '//div[@class="breadcrumbs"]'; |
|
149
|
|
|
|
|
150
|
|
|
public $productListBaseXpath = '//ol[contains(concat(" ",normalize-space(@class)," ")," products-list ")]/li[%d]'; |
|
151
|
|
|
public $productListDescriptionXpath = '/descendant::div[contains(concat(" ",normalize-space(@class)," ")," desc ")]'; |
|
152
|
|
|
public $productListTitleXpath = '/descendant::h2[@class="product-name"]/a'; |
|
153
|
|
|
public $productListCompareLinkXpath = '/descendant::ul[@class="add-to-links"]/descendant::a[@class="link-compare"]'; |
|
154
|
|
|
public $productListImageXpath = '/descendant::a[@class="product-image"]/img'; |
|
155
|
|
|
public $productListLinkXpath = '/descendant::a[@class="product-image"]'; |
|
156
|
|
|
public $productListOriginalPriceXpath = '/descendant::div[@class="price-box"]/descendant::p[@class="old-price"]/descendant::*[@class="price"]'; |
|
157
|
|
|
public $productListPriceXpath = '/descendant::div[@class="price-box"]/descendant::*[@class="regular-price" or @class="special-price"]/descendant::span[@class="price"]'; |
|
158
|
|
|
public $productListWishlistLinkXpath = '/descendant::ul[@class="add-to-links"]/descendant::a[@class="link-wishlist"]'; |
|
159
|
|
|
public $productListAddToCartLinkXpath = '/descendant::div[@class="product-shop"]/descendant::button[contains(concat(" ",normalize-space(@class)," ")," btn-cart ")]'; |
|
160
|
|
|
|
|
161
|
|
|
public $productGridBaseXpath = '//ul[contains(concat(" ",normalize-space(@class)," ")," products-grid ")]/li[%d]'; |
|
162
|
|
|
public $productGridDescriptionXpath = '/*[.="no description in the grid view"]'; |
|
163
|
|
|
public $productGridTitleXpath = '/descendant::h2[@class="product-name"]/a'; |
|
164
|
|
|
public $productGridCompareLinkXpath = '/descendant::ul[@class="add-to-links"]/descendant::a[@class="link-compare"]'; |
|
165
|
|
|
public $productGridImageXpath = '/descendant::a[@class="product-image"]/img'; |
|
166
|
|
|
public $productGridLinkXpath = '/descendant::a[@class="product-image"]'; |
|
167
|
|
|
public $productGridOriginalPriceXpath = '/descendant::div[@class="price-box"]/descendant::p[@class="old-price"]/descendant::*[@class="price"]'; |
|
168
|
|
|
public $productGridPriceXpath = '/descendant::div[@class="price-box"]/descendant::*[@class="regular-price" or @class="special-price"]/descendant::span[@class="price"]'; |
|
169
|
|
|
public $productGridWishlistLinkXpath = '/descendant::ul[@class="add-to-links"]/descendant::a[@class="link-wishlist"]'; |
|
170
|
|
|
public $productGridAddToCartLinkXpath = '/descendant::div[@class="actions"]/descendant::button[contains(concat(" ",normalize-space(@class)," ")," btn-cart ")]'; |
|
171
|
|
|
|
|
172
|
|
|
public $productCollectionViewModeXpath = '//p[@class="view-mode"]/strong'; |
|
173
|
|
|
public $productCollectionSortByXpath = '//div[@class="sort-by"]/descendant::option[@selected]'; // We select using the div, not the title because the title may be translated |
|
174
|
|
|
public $productCollectionShowCountXpath = '//div[@class="limiter"]/descendant::option[@selected]'; // dittos |
|
175
|
|
|
public $productCollectionShowCountOptionsXpath = '//div[@class="limiter"]/descendant::option'; |
|
176
|
|
|
public $productCollectionProductCountXpath = '//div[contains(concat(" ",normalize-space(@class)," ")," pager ")]/descendant::p[contains(concat(" ",normalize-space(@class)," ")," amount ")]'; |
|
177
|
|
|
|
|
178
|
|
|
public $layeredNavigationBaseXpath = '//div[contains(concat(" ",normalize-space(@class)," ")," block-layered-nav ")]'; |
|
179
|
|
|
|
|
180
|
|
|
public $searchInputXpath = '//input[@id="search"]'; |
|
181
|
|
|
public $searchSubmitXpath = '//form[@id="search_mini_form"]/descendant::button[@title="Search"]'; |
|
182
|
|
|
|
|
183
|
|
|
public $searchSuggestionTextXpath = '//div[@id="search_autocomplete"]/descendant::li[@title][%d]'; |
|
184
|
|
|
public $searchSuggestionCountXpath = '//div[@id="search_autocomplete"]/descendant::li[@title][%d]/span[@class="amount"]'; |
|
185
|
|
|
|
|
186
|
|
|
public $simpleProductQtyXpath = '//input[@id="qty"]'; |
|
187
|
|
|
|
|
188
|
|
|
public $configurableProductLabelXpath = '//div[@id="product-options-wrapper"]/descendant::label'; |
|
189
|
|
|
|
|
190
|
|
|
public $configurableProductOptionXpath = '(%s)[%d]/ancestor::dt/following-sibling::dd[1]/descendant::option[starts-with(., "%s")]'; |
|
191
|
|
|
|
|
192
|
|
|
public $viewModeAttributeName = 'class'; |
|
193
|
|
|
|
|
194
|
|
|
public $breadCrumbMemberXpath = '/descendant::a[concat(" ",normalize-space(.)," ")=" {{%s}} "]'; |
|
195
|
|
|
public $breadCrumbSelectorXpath = '/descendant::a[%d]'; |
|
196
|
|
|
|
|
197
|
|
|
public $layeredNavigationFilterNameXpath = '//dl[@id="narrow-by-list"]/dt'; |
|
198
|
|
|
|
|
199
|
|
|
public $layeredNavigationFilterTypesXpath = '//dt[.="%s"]/following-sibling::dd[1]/descendant::li'; |
|
200
|
|
|
public $layeredNavigationFilterLinkXpath = '//dt[.="%s"]/following-sibling::dd[1]/descendant::li/descendant::a'; |
|
201
|
|
|
public $layeredNavigationFilterNameElementXpath = '//dl[@id="narrow-by-list"]/dt[normalize-space(.) = "%s"]'; |
|
202
|
|
|
|
|
203
|
|
|
public $storeSwitcherInstructionsXpath = [ |
|
204
|
|
|
[\Magium\WebDriver\WebDriver::INSTRUCTION_MOUSE_CLICK, '//select[@id="select-language"]/descendant::option[contains(@href,"___store=%s"]'], |
|
205
|
|
|
]; |
|
206
|
|
|
|
|
207
|
|
|
public function getCustomerThemeClass() |
|
208
|
|
|
{ |
|
209
|
|
|
return 'Magium\Magento\Themes\Magento18\Customer\ThemeConfiguration'; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
public function getCheckoutThemeClass() |
|
213
|
|
|
{ |
|
214
|
|
|
return 'Magium\Magento\Themes\Magento18\OnePageCheckout\ThemeConfiguration'; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
} |
|
218
|
|
|
|
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.