| @@ 11-47 (lines=37) @@ | ||
| 8 | use Magium\WebDriver\ExpectedCondition; |
|
| 9 | use Magium\WebDriver\WebDriver; |
|
| 10 | ||
| 11 | class SelectGuestCheckout implements StepInterface |
|
| 12 | { |
|
| 13 | const ACTION = 'Checkout\Steps\SelectGuestCheckout'; |
|
| 14 | protected $webdriver; |
|
| 15 | protected $theme; |
|
| 16 | protected $testCase; |
|
| 17 | ||
| 18 | public function __construct( |
|
| 19 | WebDriver $webdriver, |
|
| 20 | AbstractThemeConfiguration $theme, |
|
| 21 | AbstractMagentoTestCase $testCase |
|
| 22 | ) { |
|
| 23 | $this->webdriver = $webdriver; |
|
| 24 | $this->theme = $theme; |
|
| 25 | $this->testCase = $testCase; |
|
| 26 | } |
|
| 27 | ||
| 28 | public function execute() |
|
| 29 | { |
|
| 30 | $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getGuestCheckoutButtonXpath(), AbstractTestCase::BY_XPATH)); |
|
| 31 | $this->testCase->assertElementDisplayed($this->theme->getGuestCheckoutButtonXpath(), AbstractTestCase::BY_XPATH); |
|
| 32 | $element = $this->webdriver->byXpath($this->theme->getGuestCheckoutButtonXpath()); |
|
| 33 | $this->testCase->assertWebDriverElement($element); |
|
| 34 | $element->click(); |
|
| 35 | ||
| 36 | return true; |
|
| 37 | } |
|
| 38 | ||
| 39 | public function nextAction() |
|
| 40 | { |
|
| 41 | $this->testCase->assertElementExists($this->theme->getContinueButtonXpath(), AbstractTestCase::BY_XPATH); |
|
| 42 | $element = $this->webdriver->byXpath($this->theme->getContinueButtonXpath()); |
|
| 43 | $this->testCase->assertWebDriverElement($element); |
|
| 44 | $element->click(); |
|
| 45 | return true; |
|
| 46 | } |
|
| 47 | } |
|
| @@ 12-56 (lines=45) @@ | ||
| 9 | use Magium\WebDriver\ExpectedCondition; |
|
| 10 | use Magium\WebDriver\WebDriver; |
|
| 11 | ||
| 12 | class SelectRegisterNewCustomerCheckout implements StepInterface |
|
| 13 | { |
|
| 14 | const ACTION = 'Checkout\Steps\SelectRegisterNewCustomerCheckout'; |
|
| 15 | protected $webdriver; |
|
| 16 | protected $theme; |
|
| 17 | protected $testCase; |
|
| 18 | protected $customer; |
|
| 19 | ||
| 20 | public function __construct( |
|
| 21 | WebDriver $webdriver, |
|
| 22 | AbstractThemeConfiguration $theme, |
|
| 23 | AbstractMagentoTestCase $testCase, |
|
| 24 | Customer $customer |
|
| 25 | ) { |
|
| 26 | $this->webdriver = $webdriver; |
|
| 27 | $this->theme = $theme; |
|
| 28 | $this->testCase = $testCase; |
|
| 29 | $this->customer = $customer; |
|
| 30 | } |
|
| 31 | ||
| 32 | public function execute() |
|
| 33 | { |
|
| 34 | ||
| 35 | if (!$this->customer->isUniqueEmailAddressGenerated()) { |
|
| 36 | $this->customer->generateUniqueEmailAddress(); |
|
| 37 | } |
|
| 38 | ||
| 39 | ||
| 40 | $this->webdriver->wait()->until(ExpectedCondition::elementExists($this->theme->getRegisterNewCustomerCheckoutButtonXpath(), AbstractTestCase::BY_XPATH)); |
|
| 41 | $element = $this->webdriver->byXpath($this->theme->getRegisterNewCustomerCheckoutButtonXpath()); |
|
| 42 | $this->testCase->assertWebDriverElement($element); |
|
| 43 | $element->click(); |
|
| 44 | ||
| 45 | return true; |
|
| 46 | } |
|
| 47 | ||
| 48 | public function nextAction() |
|
| 49 | { |
|
| 50 | $this->testCase->assertElementExists($this->theme->getContinueButtonXpath(), AbstractTestCase::BY_XPATH); |
|
| 51 | $element = $this->webdriver->byXpath($this->theme->getContinueButtonXpath()); |
|
| 52 | $this->testCase->assertWebDriverElement($element); |
|
| 53 | $element->click(); |
|
| 54 | return true; |
|
| 55 | } |
|
| 56 | } |
|