|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Magium\Magento\Actions\Admin\Orders; |
|
4
|
|
|
|
|
5
|
|
|
use Magium\AbstractTestCase; |
|
6
|
|
|
use Magium\Actions\StaticActionInterface; |
|
7
|
|
|
use Magium\Actions\SubAction\SubActionInterface; |
|
8
|
|
|
use Magium\Actions\SubAction\SubActionSupported; |
|
9
|
|
|
use Magium\Assertions\Xpath\Displayed; |
|
10
|
|
|
use Magium\Magento\Actions\Admin\WaitForPageLoaded; |
|
11
|
|
|
use Magium\Magento\Actions\Admin\Widget\ClickActionButton; |
|
12
|
|
|
use Magium\Magento\Themes\Admin\ThemeConfiguration; |
|
13
|
|
|
use Magium\WebDriver\WebDriver; |
|
14
|
|
|
|
|
15
|
|
|
class Cancel implements StaticActionInterface |
|
16
|
|
|
{ |
|
17
|
|
|
|
|
18
|
|
|
const ACTION = 'Admin\Orders\Cancel'; |
|
19
|
|
|
|
|
20
|
|
|
protected $webDriver; |
|
21
|
|
|
protected $themeConfiguration; |
|
22
|
|
|
protected $actionButton; |
|
23
|
|
|
protected $loaded; |
|
24
|
|
|
protected $testCase; |
|
25
|
|
|
protected $displayed; |
|
26
|
|
|
|
|
27
|
|
|
public function __construct( |
|
28
|
|
|
WebDriver $webDriver, |
|
29
|
|
|
ThemeConfiguration $themeConfiguration, |
|
30
|
|
|
ClickActionButton $actionButton, |
|
31
|
|
|
WaitForPageLoaded $loaded, |
|
32
|
|
|
AbstractTestCase $testCase, |
|
33
|
|
|
Displayed $displayed |
|
34
|
|
|
) |
|
35
|
|
|
{ |
|
36
|
|
|
$this->webDriver = $webDriver; |
|
37
|
|
|
$this->themeConfiguration = $themeConfiguration; |
|
38
|
|
|
$this->actionButton = $actionButton; |
|
39
|
|
|
$this->loaded = $loaded; |
|
40
|
|
|
$this->testCase = $testCase; |
|
41
|
|
|
$this->displayed = $displayed; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* This test presumes that you are on the order screen |
|
46
|
|
|
*/ |
|
47
|
|
|
|
|
48
|
|
|
public function execute() |
|
49
|
|
|
{ |
|
50
|
|
|
$body = $this->webDriver->byXpath('//body'); |
|
51
|
|
|
$this->actionButton->click('Cancel'); |
|
52
|
|
|
$this->webDriver->switchTo()->alert()->accept(); |
|
53
|
|
|
$this->loaded->execute($body); |
|
54
|
|
|
|
|
55
|
|
|
$xpath = $this->themeConfiguration->getOrderCancelledMessageXpath(); |
|
56
|
|
|
$this->displayed->assertSelector($xpath); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
} |
|
60
|
|
|
|