| @@ 14-68 (lines=55) @@ | ||
| 11 | use Magium\Magento\Themes\Admin\ThemeConfiguration; |
|
| 12 | use Magium\WebDriver\WebDriver; |
|
| 13 | ||
| 14 | class Invoice implements SubActionSupported, StaticActionInterface |
|
| 15 | { |
|
| 16 | ||
| 17 | const ACTION = 'Admin\Orders\Invoice'; |
|
| 18 | ||
| 19 | protected $webDriver; |
|
| 20 | protected $themeConfiguration; |
|
| 21 | protected $actionButton; |
|
| 22 | protected $loaded; |
|
| 23 | protected $testCase; |
|
| 24 | ||
| 25 | protected $preExecuteActions = []; |
|
| 26 | ||
| 27 | public function __construct( |
|
| 28 | WebDriver $webDriver, |
|
| 29 | ThemeConfiguration $themeConfiguration, |
|
| 30 | ClickActionButton $actionButton, |
|
| 31 | WaitForPageLoaded $loaded, |
|
| 32 | AbstractTestCase $testCase |
|
| 33 | ) |
|
| 34 | { |
|
| 35 | $this->webDriver = $webDriver; |
|
| 36 | $this->themeConfiguration = $themeConfiguration; |
|
| 37 | $this->actionButton = $actionButton; |
|
| 38 | $this->loaded = $loaded; |
|
| 39 | $this->testCase = $testCase; |
|
| 40 | } |
|
| 41 | ||
| 42 | public function addSubAction(SubActionInterface $action) |
|
| 43 | { |
|
| 44 | $this->preExecuteActions[] = $action; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * This test presumes that you are on the order screen |
|
| 49 | */ |
|
| 50 | ||
| 51 | public function execute() |
|
| 52 | { |
|
| 53 | $body = $this->webDriver->byXpath('//body'); |
|
| 54 | $this->actionButton->click('Invoice'); |
|
| 55 | $this->loaded->execute($body); |
|
| 56 | ||
| 57 | foreach ($this->preExecuteActions as $action) { |
|
| 58 | if ($action instanceof SubActionInterface) { |
|
| 59 | $action->execute(); |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| 63 | $body = $this->webDriver->byXpath('//body'); |
|
| 64 | $this->testCase->byText('{{Submit Invoice}}')->click(); |
|
| 65 | $this->loaded->execute($body); |
|
| 66 | } |
|
| 67 | ||
| 68 | } |
|
| @@ 14-68 (lines=55) @@ | ||
| 11 | use Magium\Magento\Themes\Admin\ThemeConfiguration; |
|
| 12 | use Magium\WebDriver\WebDriver; |
|
| 13 | ||
| 14 | class Ship implements SubActionSupported, StaticActionInterface |
|
| 15 | { |
|
| 16 | ||
| 17 | const ACTION = 'Admin\Orders\Ship'; |
|
| 18 | ||
| 19 | protected $webDriver; |
|
| 20 | protected $themeConfiguration; |
|
| 21 | protected $actionButton; |
|
| 22 | protected $loaded; |
|
| 23 | protected $testCase; |
|
| 24 | ||
| 25 | protected $preExecuteActions = []; |
|
| 26 | ||
| 27 | public function __construct( |
|
| 28 | WebDriver $webDriver, |
|
| 29 | ThemeConfiguration $themeConfiguration, |
|
| 30 | ClickActionButton $actionButton, |
|
| 31 | WaitForPageLoaded $loaded, |
|
| 32 | AbstractTestCase $testCase |
|
| 33 | ) |
|
| 34 | { |
|
| 35 | $this->webDriver = $webDriver; |
|
| 36 | $this->themeConfiguration = $themeConfiguration; |
|
| 37 | $this->actionButton = $actionButton; |
|
| 38 | $this->loaded = $loaded; |
|
| 39 | $this->testCase = $testCase; |
|
| 40 | } |
|
| 41 | ||
| 42 | public function addSubAction(SubActionInterface $action) |
|
| 43 | { |
|
| 44 | $this->preExecuteActions[] = $action; |
|
| 45 | } |
|
| 46 | ||
| 47 | /** |
|
| 48 | * This test presumes that you are on the order screen |
|
| 49 | */ |
|
| 50 | ||
| 51 | public function execute() |
|
| 52 | { |
|
| 53 | $body = $this->webDriver->byXpath('//body'); |
|
| 54 | $this->actionButton->click('Ship'); |
|
| 55 | $this->loaded->execute($body); |
|
| 56 | ||
| 57 | foreach ($this->preExecuteActions as $action) { |
|
| 58 | if ($action instanceof SubActionInterface) { |
|
| 59 | $action->execute(); |
|
| 60 | } |
|
| 61 | } |
|
| 62 | ||
| 63 | $body = $this->webDriver->byXpath('//body'); |
|
| 64 | $this->testCase->byText('{{Submit Shipment}}')->click(); |
|
| 65 | $this->loaded->execute($body); |
|
| 66 | } |
|
| 67 | ||
| 68 | } |
|