1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Magium\Magento\Themes\Admin; |
4
|
|
|
|
5
|
|
|
use Magium\AbstractConfigurableElement; |
6
|
|
|
use Magium\AbstractTestCase; |
7
|
|
|
use Magium\Magento\Themes\NavigableThemeInterface; |
8
|
|
|
|
9
|
|
|
class ThemeConfiguration extends AbstractConfigurableElement implements NavigableThemeInterface |
|
|
|
|
10
|
|
|
{ |
11
|
|
|
|
12
|
|
|
const THEME = 'Magium\Magento\Themes\Admin\ThemeConfiguration'; |
13
|
|
|
|
14
|
|
|
public $baseUrl = 'http://localhost/admin'; |
15
|
|
|
|
16
|
|
|
public $homeXpath = '//img[@class="logo"]'; |
17
|
|
|
|
18
|
|
|
public $loginUsernameField = '//input[@type="text" and @id="username"]'; |
19
|
|
|
public $loginPasswordField = '//input[@type="password" and @id="login"]'; |
20
|
|
|
public $loginSubmitButton = '//input[@type="submit" and @value="{{Login}}"]'; |
21
|
|
|
|
22
|
|
|
public $navigationBaseXPathSelector = '//ul[@id="nav"]'; |
23
|
|
|
// public $navigationChildXPathSelector1 = 'li/descendant::span[.="{{%s}}"]'; |
|
|
|
|
24
|
|
|
public $navigationChildXPathSelector = 'a[concat(" ",normalize-space(.)," ") = " {{%s}} "]/..'; |
25
|
|
|
|
26
|
|
|
public $adminPopupMessageContainerXpath = '//*[@id="message-popup-window"]'; |
27
|
|
|
public $adminPopupMessageCloseButtonXpath = '//*[@id="message-popup-window"]/descendant::*[@title="close"]'; |
28
|
|
|
|
29
|
|
|
public $systemConfigTabsXpath = '//ul[@id="system_config_tabs"]/descendant::a[concat(" ",normalize-space(.)," ") = " {{%s}} "]'; |
30
|
|
|
public $systemConfigSectionToggleXpath = '//form[@id="config_edit_form"]/descendant::div[contains(concat(" ",normalize-space(@class)," ")," section-config ")]/descendant::a[.="{{%s}}"]'; |
31
|
|
|
public $systemConfigSectionDisplayCheckXpath = '//legend[.="{{%s}}"]/ancestor::fieldset'; |
32
|
|
|
public $systemConfigToggleEnableXpath = '//legend[.="{{%s}}"]/../descendant::td[concat(" ",normalize-space(.)," ") = " {{Enabled}} "]/../td/descendant::select/option[@value="%d"]'; |
33
|
|
|
|
34
|
|
|
public $xTreeRootXpath = '//ul[contains(concat(" ",normalize-space(@class)," ")," x-tree-root-ct ")]/div/li[contains(concat(" ",normalize-space(@class)," ")," x-tree-node ")]/div/a'; |
35
|
|
|
public $xTreeNamedRootXpath = '//ul[contains(concat(" ",normalize-space(@class)," ")," x-tree-root-ct ")]/div/li[contains(concat(" ",normalize-space(@class)," ")," x-tree-node ")]/div/a[contains(concat("---",normalize-space(.)), "---{{%s}} (")]'; |
36
|
|
|
public $xTreeChildXpath = 'ul/li[contains(concat(" ",normalize-space(@class)," ")," x-tree-node ")]/div/a/span[contains(concat("---",normalize-space(.)), "---{{%s}} (")]/..'; |
37
|
|
|
public $xTreeChildNodePrefixXpath = '/../..'; |
38
|
|
|
public $xTreeChildNodeExpandPrefixXpath = '/../img[contains(concat(" ",normalize-space(@class)," ")," x-tree-ec-icon ")]'; |
39
|
|
|
|
40
|
|
|
public $systemConfigurationSaveButtonXpath = '//div[@class="main-col-inner"]/div[@class="content-header"]/descendant::button[@title="{{Save Config}}"]'; |
41
|
|
|
|
42
|
|
|
public $systemConfigSaveSuccessfulXpath = '//li[@class="success-msg"]/descendant::span[.="{{The configuration has been saved}}."]'; |
43
|
|
|
|
44
|
|
|
public $testLoggedInAtBaseUrl = '//a[@class="active"]/span[.="{{Dashboard}}"]'; |
45
|
|
|
|
46
|
|
|
public $tableButtonXpath = '//table[@class="actions"]/descendant::span[.="{{%s}}"]'; |
47
|
|
|
|
48
|
|
|
public $selectOrderXpath = '//table[@id="sales_order_grid_table"]/descendant::td[concat(" ",normalize-space(.)," ") = " %s "]/../td/a[.="{{View}}"]'; |
49
|
|
|
public $selectCustomerXpath = '//table[@id="customerGrid_table"]/descendant::td[concat(" ",normalize-space(.)," ") = " %s "]/../td/a[.="{{Edit}}"]'; |
50
|
|
|
|
51
|
|
|
public $systemConfigSettingLabelXpath = '//td[@class="label"]/label[.=" {{%s}}"]'; |
52
|
|
|
|
53
|
|
|
public $widgetTabXpath = '//a[contains(@class, "tab-item-link")]/span[.="{{%s}}"]'; |
54
|
|
|
public $widgetTabHeaderXpath = '//div[@class="entry-edit-head"]/h4[.="{{%s}}"]'; |
55
|
|
|
public $widgetAttributeByLabelXpath = '//table[@class="form-list"]/descendant::td[@class="label"]/label[.="{{%s}} *" or .="{{%s}}*" or .="{{%s}} " or .="{{%s}}"]/ancestor::tr/td[@class="value"]/*[@name]'; |
56
|
|
|
public $widgetActionButtonXpath = '//div[@class="content-header"]/descendant::button/descendant::span[.="{{%s}}"]'; |
57
|
|
|
|
58
|
|
|
public $guaranteedPageLoadedElementDisplayedXpath = '//div[@class="footer"]'; |
59
|
|
|
|
60
|
|
|
public $successfulActionXpath = '//li[@class="success-msg"]'; |
61
|
|
|
public $errorActionXpath = '//li[@class="error-msg"]'; |
62
|
|
|
|
63
|
|
|
public $shippingCarrierXpath = '//select[@name="tracking[%d][carrier_code]"]'; |
64
|
|
|
public $shippingTitleXpath = '//input[@name="tracking[%d][title]"]'; |
65
|
|
|
public $shippingTrackingNumberXpath = '//input[@name="tracking[%d][number]"]'; |
66
|
|
|
|
67
|
|
|
public $formButtonXpath = '//div[@class="content-header"]/p[@class="form-buttons"]/descendant::span[.="{{%s}}"]'; |
68
|
|
|
|
69
|
|
|
public $cacheNavigationPath = '{{System}}/{{Cache Management}}'; |
70
|
|
|
|
71
|
|
|
public $cacheTargetXpath = '//input[@name="types" and @value="{{%s}}"]'; |
72
|
|
|
|
73
|
|
|
public $cacheAllTargetsXpath = '//input[@name="types"]'; |
74
|
|
|
|
75
|
|
|
public $cacheMassActionOptionXpath = '//select[@id="cache_grid_massaction-select"]/option[@value="{{%s}}"]'; |
76
|
|
|
|
77
|
|
|
public $cacheSubmitXpath = '//button[@title="{{Submit}}"]'; |
78
|
|
|
|
79
|
|
|
public $firstTermsRowXpath = '//table[@id="agreementGrid_table"]/tbody/tr/td[not(contains(concat(" ",normalize-space(@class)," ")," empty-text "))]'; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
|
|
public function getFirstTermsRowXpath() |
85
|
|
|
{ |
86
|
|
|
return $this->firstTermsRowXpath; |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
/** |
90
|
|
|
* @return string |
91
|
|
|
*/ |
92
|
|
|
public function getCacheSubmitXpath() |
93
|
|
|
{ |
94
|
|
|
return $this->translatePlaceholders($this->cacheSubmitXpath); |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
|
98
|
|
|
|
99
|
|
|
/** |
100
|
|
|
* @return string |
101
|
|
|
*/ |
102
|
|
|
public function getCacheMassActionOptionXpath($option) |
103
|
|
|
{ |
104
|
|
|
$xpath = sprintf($this->cacheMassActionOptionXpath, $option); |
105
|
|
|
return $this->translatePlaceholders($xpath); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
|
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @return string |
112
|
|
|
*/ |
113
|
|
|
public function getCacheAllTargetsXpath() |
114
|
|
|
{ |
115
|
|
|
return $this->translatePlaceholders($this->cacheAllTargetsXpath); |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
|
119
|
|
|
|
120
|
|
|
/** |
121
|
|
|
* @return string |
122
|
|
|
*/ |
123
|
|
|
public function getCacheTargetXpath($type) |
124
|
|
|
{ |
125
|
|
|
$xpath = sprintf($this->cacheTargetXpath, $type); |
126
|
|
|
return $this->translatePlaceholders($xpath); |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
|
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* @return string |
133
|
|
|
*/ |
134
|
|
|
public function getCacheNavigationPath() |
135
|
|
|
{ |
136
|
|
|
return $this->translatePlaceholders($this->cacheNavigationPath); |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
|
140
|
|
|
public function getFormButtonXpath($button) |
141
|
|
|
{ |
142
|
|
|
$xpath = sprintf($this->formButtonXpath, $button); |
143
|
|
|
return $this->translatePlaceholders($xpath); |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return string |
148
|
|
|
*/ |
149
|
|
|
public function getShippingCarrierXpath($count) |
150
|
|
|
{ |
151
|
|
|
$xpath = sprintf($this->shippingCarrierXpath, $count); |
152
|
|
|
return $xpath; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* @return string |
157
|
|
|
*/ |
158
|
|
|
public function getShippingTitleXpath($count) |
159
|
|
|
{ |
160
|
|
|
$xpath = sprintf($this->shippingTitleXpath, $count); |
161
|
|
|
return $xpath; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @return string |
166
|
|
|
*/ |
167
|
|
|
public function getShippingTrackingNumberXpath($count) |
168
|
|
|
{ |
169
|
|
|
$xpath = sprintf($this->shippingTrackingNumberXpath, $count); |
170
|
|
|
return $xpath; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
|
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @return string |
177
|
|
|
*/ |
178
|
|
|
public function getXTreeChildNodeExpandPrefixXpath() |
179
|
|
|
{ |
180
|
|
|
return $this->translatePlaceholders($this->xTreeChildNodeExpandPrefixXpath); |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @return string |
185
|
|
|
*/ |
186
|
|
|
public function getXTreeNamedRootXpath($category) |
187
|
|
|
{ |
188
|
|
|
$xpath = sprintf($this->xTreeNamedRootXpath, $category); |
189
|
|
|
return $this->translatePlaceholders($xpath); |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
|
193
|
|
|
|
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @return string |
197
|
|
|
*/ |
198
|
|
|
public function getXTreeChildNodePrefixXpath() |
199
|
|
|
{ |
200
|
|
|
return $this->translatePlaceholders($this->xTreeChildNodePrefixXpath); |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return string |
205
|
|
|
*/ |
206
|
|
|
public function getXTreeChildXpath($name) |
207
|
|
|
{ |
208
|
|
|
$xpath = sprintf($this->xTreeChildXpath, $name); |
209
|
|
|
return $this->translatePlaceholders($xpath); |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* @return string |
214
|
|
|
*/ |
215
|
|
|
public function getXTreeRootXpath() |
216
|
|
|
{ |
217
|
|
|
return $this->translatePlaceholders($this->xTreeRootXpath); |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
|
221
|
|
|
|
222
|
|
|
public function set($name, $value) |
223
|
|
|
{ |
224
|
|
|
$this->$name = $value; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
/** |
228
|
|
|
* @return string |
229
|
|
|
*/ |
230
|
|
|
public function getSuccessfulActionXpath() |
231
|
|
|
{ |
232
|
|
|
return $this->successfulActionXpath; |
233
|
|
|
} |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* @return string |
237
|
|
|
*/ |
238
|
|
|
public function getErrorActionXpath() |
239
|
|
|
{ |
240
|
|
|
return $this->errorActionXpath; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
|
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @return string |
247
|
|
|
*/ |
248
|
|
|
public function getWidgetActionButtonXpath($label) |
249
|
|
|
{ |
250
|
|
|
return $this->translatePlaceholders(sprintf($this->widgetActionButtonXpath, $label)); |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @return string |
255
|
|
|
*/ |
256
|
|
|
public function getWidgetAttributeByLabelXpath($attribute) |
257
|
|
|
{ |
258
|
|
|
return $this->translatePlaceholders(sprintf($this->widgetAttributeByLabelXpath, $attribute, $attribute, $attribute, $attribute)); |
259
|
|
|
} |
260
|
|
|
|
261
|
|
|
|
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @return string |
265
|
|
|
*/ |
266
|
|
|
public function getWidgetTabHeaderXpath($name) |
267
|
|
|
{ |
268
|
|
|
return $this->translatePlaceholders(sprintf($this->widgetTabHeaderXpath, $name)); |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @return string |
273
|
|
|
*/ |
274
|
|
|
public function getWidgetTabXpath($name) |
275
|
|
|
{ |
276
|
|
|
return $this->translatePlaceholders(sprintf($this->widgetTabXpath, $name)); |
277
|
|
|
} |
278
|
|
|
|
279
|
|
|
|
280
|
|
|
|
281
|
|
|
public function getGuaranteedPageLoadedElementDisplayedXpath() |
282
|
|
|
{ |
283
|
|
|
return $this->translatePlaceholders($this->guaranteedPageLoadedElementDisplayedXpath); |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
/** |
287
|
|
|
* @param mixed $guaranteedPageLoadedElementDisplayedXpath |
288
|
|
|
*/ |
289
|
|
|
public function setGuaranteedPageLoadedElementDisplayedXpath($guaranteedPageLoadedElementDisplayedXpath) |
290
|
|
|
{ |
291
|
|
|
$this->guaranteedPageLoadedElementDisplayedXpath = $guaranteedPageLoadedElementDisplayedXpath; |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
/** |
295
|
|
|
* @return string |
296
|
|
|
*/ |
297
|
|
|
public function getHomeXpath() |
298
|
|
|
{ |
299
|
|
|
return $this->homeXpath; |
300
|
|
|
} |
301
|
|
|
|
302
|
|
|
/** |
303
|
|
|
* @return string |
304
|
|
|
*/ |
305
|
|
|
public function getSystemConfigSettingLabelXpath($label) |
306
|
|
|
{ |
307
|
|
|
$return = sprintf($this->systemConfigSettingLabelXpath, $label); |
308
|
|
|
return $this->translatePlaceholders($return); |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
/** |
312
|
|
|
* Why is this an option? So you can have a different theme setup for different languages and still use the same code. |
313
|
|
|
* |
314
|
|
|
* @var string |
315
|
|
|
*/ |
316
|
|
|
|
317
|
|
|
public $searchButtonText = '{{Search}}'; |
318
|
|
|
|
319
|
|
|
/** |
320
|
|
|
* @return Translator |
321
|
|
|
*/ |
322
|
|
|
public function getTranslator() |
323
|
|
|
{ |
324
|
|
|
return $this->translator; |
325
|
|
|
} |
326
|
|
|
|
327
|
|
|
/** |
328
|
|
|
* @return string |
329
|
|
|
*/ |
330
|
|
|
public function getLoginUsernameField() |
331
|
|
|
{ |
332
|
|
|
return $this->translatePlaceholders($this->loginUsernameField); |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* @return string |
337
|
|
|
*/ |
338
|
|
|
public function getLoginPasswordField() |
339
|
|
|
{ |
340
|
|
|
return $this->translatePlaceholders($this->loginPasswordField); |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* @return string |
345
|
|
|
*/ |
346
|
|
|
public function getLoginSubmitButton() |
347
|
|
|
{ |
348
|
|
|
return $this->translatePlaceholders($this->loginSubmitButton); |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* @return string |
353
|
|
|
*/ |
354
|
|
|
public function getNavigationBaseXPathSelector() |
355
|
|
|
{ |
356
|
|
|
return $this->translatePlaceholders($this->navigationBaseXPathSelector); |
357
|
|
|
} |
358
|
|
|
|
359
|
|
|
/** |
360
|
|
|
* @return string |
361
|
|
|
*/ |
362
|
|
|
public function getNavigationChildXPathSelector($text) |
363
|
|
|
{ |
364
|
|
|
$return = sprintf($this->navigationChildXPathSelector, $text); |
365
|
|
|
return $this->translatePlaceholders($return); |
366
|
|
|
} |
367
|
|
|
|
368
|
|
|
/** |
369
|
|
|
* @return mixed |
370
|
|
|
*/ |
371
|
|
|
public function getBaseUrl() |
372
|
|
|
{ |
373
|
|
|
return $this->baseUrl; |
374
|
|
|
} |
375
|
|
|
|
376
|
|
|
/** |
377
|
|
|
* @return string |
378
|
|
|
*/ |
379
|
|
|
public function getSearchButtonText() |
380
|
|
|
{ |
381
|
|
|
return $this->translatePlaceholders($this->searchButtonText); |
382
|
|
|
} |
383
|
|
|
|
384
|
|
|
|
385
|
|
|
|
386
|
|
|
/** |
387
|
|
|
* @return string |
388
|
|
|
*/ |
389
|
|
|
public function getSelectOrderXpath($order) |
390
|
|
|
{ |
391
|
|
|
$return = sprintf($this->selectOrderXpath, $order); |
392
|
|
|
return $this->translatePlaceholders($return); |
393
|
|
|
} |
394
|
|
|
/** |
395
|
|
|
* @return string |
396
|
|
|
*/ |
397
|
|
|
public function getSelectCustomerXpath($value) |
398
|
|
|
{ |
399
|
|
|
$xpath = sprintf($this->selectCustomerXpath, $value); |
400
|
|
|
return $this->translatePlaceholders($xpath); |
401
|
|
|
} |
402
|
|
|
|
403
|
|
|
/** |
404
|
|
|
* @return string |
405
|
|
|
*/ |
406
|
|
|
public function getTableButtonXpath($buttonValue) |
407
|
|
|
{ |
408
|
|
|
$return = sprintf($this->tableButtonXpath, $buttonValue); |
409
|
|
|
return $this->translatePlaceholders($return); |
410
|
|
|
} |
411
|
|
|
|
412
|
|
|
|
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* @return string |
416
|
|
|
*/ |
417
|
|
|
public function getTestLoggedInAtBaseUrl() |
418
|
|
|
{ |
419
|
|
|
return $this->translatePlaceholders($this->testLoggedInAtBaseUrl); |
420
|
|
|
} |
421
|
|
|
|
422
|
|
|
|
423
|
|
|
|
424
|
|
|
/** |
425
|
|
|
* @return string |
426
|
|
|
*/ |
427
|
|
|
public function getSystemConfigSaveSuccessfulXpath() |
428
|
|
|
{ |
429
|
|
|
return $this->translatePlaceholders($this->systemConfigSaveSuccessfulXpath); |
430
|
|
|
} |
431
|
|
|
|
432
|
|
|
/** |
433
|
|
|
* @return string |
434
|
|
|
*/ |
435
|
|
|
public function getSystemConfigurationSaveButtonXpath() |
436
|
|
|
{ |
437
|
|
|
return $this->translatePlaceholders($this->systemConfigurationSaveButtonXpath); |
438
|
|
|
} |
439
|
|
|
|
440
|
|
|
/** |
441
|
|
|
* @return string |
442
|
|
|
*/ |
443
|
|
|
public function getSystemConfigSectionToggleXpath($section) |
444
|
|
|
{ |
445
|
|
|
$return = sprintf($this->systemConfigSectionToggleXpath, $section); |
446
|
|
|
return $this->translatePlaceholders($return); |
447
|
|
|
} |
448
|
|
|
|
449
|
|
|
/** |
450
|
|
|
* @return string |
451
|
|
|
*/ |
452
|
|
|
public function getSystemConfigSectionDisplayCheckXpath($section) |
453
|
|
|
{ |
454
|
|
|
$return = sprintf($this->systemConfigSectionDisplayCheckXpath, $section); |
455
|
|
|
return $this->translatePlaceholders($return); |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
/** |
459
|
|
|
* @return string |
460
|
|
|
*/ |
461
|
|
|
public function getSystemConfigToggleEnableXpath($section, $option) |
462
|
|
|
{ |
463
|
|
|
$return = sprintf($this->systemConfigToggleEnableXpath, $section, $option); |
464
|
|
|
return $this->translatePlaceholders($return); |
465
|
|
|
} |
466
|
|
|
|
467
|
|
|
/** |
468
|
|
|
* @return string |
469
|
|
|
*/ |
470
|
|
|
public function getSystemConfigTabsXpath($tabName) |
471
|
|
|
{ |
472
|
|
|
$return = sprintf($this->systemConfigTabsXpath, $tabName); |
473
|
|
|
return $this->translatePlaceholders($return); |
474
|
|
|
} |
475
|
|
|
|
476
|
|
|
|
477
|
|
|
public function getAdminPopupMessageContainerXpath() |
478
|
|
|
{ |
479
|
|
|
return $this->translatePlaceholders($this->adminPopupMessageContainerXpath); |
480
|
|
|
} |
481
|
|
|
|
482
|
|
|
public function getAdminPopupMessageCloseButtonXpath() |
483
|
|
|
{ |
484
|
|
|
return $this->translatePlaceholders($this->adminPopupMessageCloseButtonXpath); |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
public function getUseClicksToNavigate() |
488
|
|
|
{ |
489
|
|
|
return false; |
490
|
|
|
} |
491
|
|
|
|
492
|
|
|
public function configure(AbstractTestCase $testCase) |
493
|
|
|
{ |
494
|
|
|
|
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
} |