diff --git a/dev/tests/behavioral/behat.yml b/dev/tests/behavioral/behat.yml new file mode 100644 index 0000000000000..8d7ba43a66351 --- /dev/null +++ b/dev/tests/behavioral/behat.yml @@ -0,0 +1,18 @@ +# behat.yml +default: + paths: + features: features + bootstrap: %behat.paths.base%/bootstrap + extensions: + Behat\MinkExtension\Extension: + base_url: http://magento.vm + goutte: ~ + # To run locally: + browser_name: chrome + selenium2: + capabilities: + "platform": "ANY" + "version": "" + filters: + tags: "~@skip" + diff --git a/dev/tests/behavioral/bootstrap/FeatureContext.php b/dev/tests/behavioral/bootstrap/FeatureContext.php new file mode 100644 index 0000000000000..eb7abbf59eaa2 --- /dev/null +++ b/dev/tests/behavioral/bootstrap/FeatureContext.php @@ -0,0 +1,325 @@ +getSession()->getDriver()->resizeWindow(1280, 768); + $this->getSession()->maximizeWindow(); + } + + /** + * @Then /^I wait for the suggestion box to appear$/ + */ + public function iWaitForTheSuggestionBoxToAppear() + { + $this->getSession()->wait(5000, + "$('.suggestions-results').children().length > 0" + ); + } + + /** Click on the element with the provided xpath query + * + * @When /^I click on the element with xpath "([^"]*)"$/ + */ + public function iClickOnTheElementWithXPath($xpath) + { + $session = $this->getSession(); // get the mink session + $element = $session->getPage()->find( + 'xpath', + $session->getSelectorsHandler()->selectorToXpath('xpath', $xpath) + ); // runs the actual query and returns the element + + // errors must not pass silently + if (null === $element) { + throw new \InvalidArgumentException(sprintf('Could not evaluate XPath: "%s"', $xpath)); + } + + // ok, let's click on it + $element->click(); + + } + + /** Wait for page to load + * + * @When /^I wait for page to load "([^"]*)"$/ + */ + public function iWaitForPageToLoad($pageName) + { + $timeOut = self::TIMEOUT_PAGE_LOAD; + $timeEnd = time() + $timeOut; + while (0 !== stripos($this->getSession()->getCurrentUrl(), sprintf('%s%s', $this->getMinkParameter('base_url'), $pageName))) { + usleep(100); + if (time() >= $timeEnd) { + throw new \Exception(sprintf('Load page timeout (%d seconds) exceeded', $timeOut)); + } + } + } + + /** + * @Given /^I wait for element "([^"]*)" to appear$/ + */ + public function iWaitForElementToAppear($selector) + { + $this->waitForElementToAppear('css', $selector); + } + + /** + * @Given /^I wait for element with xpath "([^"]*)" to appear$/ + */ + public function iWaitForElementWithXpathToAppear($selector) + { + $this->waitForElementToAppear('xpath', $selector); + } + + /** + * @Then /^the element with xpath "([^"]*)" should contain "([^"]*)"$/ + */ + public function theElementWithXpathShouldContain($xpath, $string) + { + $this->assertSession()->elementTextContains('xpath', $xpath, $this->fixStepArgument($string)); + } + + + /** + * @Given /^I click on the element with xpath "\/\/\*\[@id="(\d+)"\]"$/ + */ + public function iClickOnTheElementWithXpathId($selector) + { + $this->waitForElementToAppear('xpath', $selector); + $this->getSession()->getPage()->find('xpath', $selector)->click(); + } + + /** + * @Given /^I click on the element "([^"]*)"$/ + */ + public function iClickOnTheElement($selector) + { + if( ! $this->getSession()->getPage()->find('css', $selector)) + throw new \Exception(sprintf('Element with css "%s" not found', $selector)); + + $this->getSession()->getPage()->find('css', $selector)->click(); + } + + + /** + * @When /^I hover over element "([^"]*)"$/ + */ + public function iHoverOverTheElement($locator) + { + $session = $this->getSession(); // get the mink session + $element = $session->getPage()->find('xpath', $locator); // runs the actual query and returns the element + + // errors must not pass silently + if (null === $element) { + throw new \Exception(sprintf('Could not evaluate XPath selector: "%s"', $locator)); + } + + // ok, let's hover it + $element->mouseOver(); + } + + /************* protected ************/ + + protected function waitForElementToAppear($method, $selector){ + $timeOut = self::TIMEOUT_ELEMENT_TO_APPEAR; + $timeEnd = time() + $timeOut; + while ( ! ( + $this->getSession()->getPage()->find($method, $selector) + && $this->getSession()->getPage()->find($method, $selector)->isVisible() + ) ) { + usleep(10); + if ( time() >= $timeEnd ) { + throw new \Exception(sprintf('Element with xpath "%s" didn\'t appear', $selector)); + } + } + } + + /** + * @Given /^I wait for "([^"]*)" seconds$/ + */ + public function iWaitForSeconds($seconds) + { + sleep($seconds); + } + + + #=========== experimental ======# + + /** + * @Given /^my main site is "([^"]*)"$/ + */ + public function myBaseUrlIs($url) + { + $this->setMinkParameters(array('base_url', $url)); + } + + /** + * @Given /^I wait for element containing unique text "([^"]*)" to appear$/ + */ + public function iWaitForElementContainingUniqueTextToAppear($text) + { + $this->waitForElementContainingUniqueText($text); + } + + /** + * @Given /^I wait for element containing unique text "([^"]*)" to click$/ + */ + public function iWaitForElementContainingUniqueTextToClick($text) + { + $this->waitForElementContainingUniqueText($text)->click(); + } + + /** + * @Given /^I click on element containing unique text "([^"]*)"$/ + */ + public function iClickOnElementContainingUniqueText($text){ + $element = $this->waitForElementContainingUniqueText($text); + $element->click(); + } + + /** + * @Given /^I should see element containing unique text "([^"]*)"$/ + */ + public function iShouldSeeElementContainingUniqueText($text) + { + $element = $this->waitForElementContainingUniqueText($text); + if(!$element){ + throw new \Exception(sprintf('Element containing unique text "%s" was not found', $text)); + } + } + + /** + * @Given /^I scroll "([^"]*)" into view$/ + */ + public function iScrollIntoView($elementId) + { + $function = <<getSession()->executeScript($function); + } + catch(Exception $e) { + throw new \Exception("ScrollIntoView failed"); + } + } + + /** + * @Given /^I switch to "([^"]*)" iframe$/ + */ + public function iSwitchToIframe($name) + { + $this->getSession()->switchToIFrame($name); + } + + /** + * @Given /^I switch to the main frame$/ + */ + public function iSwitchToTheMainFrame() + { + $this->getSession()->switchToIFrame(); + } + + /** + * @When I scroll :elementId into view + */ + public function scrollIntoView($elementId) { + $function = <<getSession()->executeScript($function); + } + catch(Exception $e) { + throw new \Exception("ScrollIntoView failed"); + } + } + + private function findElementContainingText($text){ + #$xpath = sprintf('//*[contains(text(),"%s")]', $text); + $xpath = sprintf('//*[contains(translate(text(), "ABCDEFGHJIKLMNOPQRSTUVWXYZ", "abcdefghjiklmnopqrstuvwxyz"), "%s")]', strtolower($text)); + $elementList = $this->getSession()->getPage()->findAll('xpath', $xpath); + foreach($elementList as $element){ + if($element->isVisible()) + return $element; + } + + return null; + } + + /** + * @param $text + * @throws Exception + */ + protected function waitForElementContainingUniqueText($text) + { + $timeOut = self::TIMEOUT_ELEMENT_TO_APPEAR; + $timeEnd = time() + $timeOut; + while ( ! $this->findElementContainingText($text)) { + usleep(10); + if ( time() >= $timeEnd ) { + throw new \Exception(sprintf('Element containing unique text "%s" did not appear within %d seconds', $text, $timeOut)); + } + } + + $element = $this->findElementContainingText($text); + + return $element; + } + + +} diff --git a/dev/tests/behavioral/features/admin/create-customer.feature b/dev/tests/behavioral/features/admin/create-customer.feature new file mode 100644 index 0000000000000..0185851f11b04 --- /dev/null +++ b/dev/tests/behavioral/features/admin/create-customer.feature @@ -0,0 +1,39 @@ +@javascript +Feature: Create customer + + Scenario: Magento admin creates customer's account + + Given I am on "http://magento.vm/index.php/admin/admin/index/index/key/509d07fe462fb9526fa8419f968a4373fdb9e162fb47fd7845b3de2f8d550be4/" + + Then I wait for element with xpath "//*[@id='html-body']/section" to appear + And I fill in the following: + | login[username] | demo | + | login[password] | demoPwd0 | + + And I click on the element with xpath "//form[@id='login-form']//span[contains(text(),'Sign in')]" + + #Customers + And I click on the element with xpath "//li[@data-ui-id='menu-magento-customer-customer']/a/span[contains(text(), 'Customers')]" + And I click on the element with xpath "//li[@data-ui-id='menu-magento-customer-customer-manage']/a/span[contains(text(), 'All Customers')]" + + #Add New Customer + And I click on the element with xpath "//button[@id='add']/span[contains(text(), 'Add New Customer')]" + + #Fill up customer info + And I wait for element with xpath "//input[@name='customer[prefix]']" to appear + And I fill in the following: + | customer[prefix] | Mrs | + | customer[firstname] | Anabella | + | customer[lastname] | Smith | + | customer[email] | ab@gmail.com | + | customer[taxvat] | 1234567 | + And I select "Female" from "customer[gender]" + + #Save New Customer + And I click on the element with xpath "//button[@id='save']//span[contains(text(), 'Save Customer')]" + + And I wait for element with xpath "//*[@id='messages']/div/div/div" to appear + + # Final assertion + And I wait for element containing unique text "You saved the customer" to appear + And I wait for element with xpath "//table[@class='data-grid data-grid-draggable']//div[contains(text(), 'Mrs Anabella Smith')]" to appear \ No newline at end of file diff --git a/dev/tests/behavioral/features/admin/shipments.feature b/dev/tests/behavioral/features/admin/shipments.feature new file mode 100644 index 0000000000000..e6a294c581149 --- /dev/null +++ b/dev/tests/behavioral/features/admin/shipments.feature @@ -0,0 +1,55 @@ +@javascript +Feature: Shipment functionality + + Scenario: Magento admin updates customer's billing information + + Given I am on "http://magento.vm/index.php/admin/admin/index/index/key/509d07fe462fb9526fa8419f968a4373fdb9e162fb47fd7845b3de2f8d550be4/" + + Then I wait for element with xpath "//*[@id='html-body']/section" to appear + And I fill in the following: + | login[username] | demo | + | login[password] | demoPwd0 | + + And I click on the element with xpath "//form[@id='login-form']//span[contains(text(),'Sign in')]" + + #Sales > Shipments + And I click on the element with xpath "//li[@data-ui-id='menu-magento-sales-sales']//span[contains(text(),'Sales')]" + And I click on the element with xpath "//li[@data-ui-id='menu-magento-sales-sales-shipment']//span[contains(text(),'Shipments')]" + + #Shipments + And I wait for element with xpath "//table[@class='data-grid data-grid-draggable']//tr[td/div/text()[contains(.,'000000001')]]//a[contains(text(), 'View')]" to appear + And I click on the element with xpath "//table[@class='data-grid data-grid-draggable']//tr[td/div/text()[contains(.,'000000001')]]//a[contains(text(), 'View')]" + And I click on the element with xpath "//div[span/text()[contains(.,'Billing Address')]]//a[contains(text(),'Edit')]" + + #Change address + And I wait for element with xpath "//*[@id='container']/fieldset/legend/span" to appear + And I fill in the following: + | prefix | Mrs | + | company | The ADT Corporation | + | street[0] | 1501 Yamato Rd | + And I select "Florida" from "region_id" + And I fill in the following: + | postcode | 33431 | + | telephone | (561) 402-0338 | + | fax | (561) 404-0372 | + + And I click on the element with xpath "//div[@class='page-actions-buttons']//span[contains(text(),'Save Order Address')]" + + #Assertion + And I wait for element with xpath "//div[@class='messages']//div[contains(text(),'You updated the order address.')]" to appear + + #Invoices + And I click on the element with xpath "//ul[@role='tablist']//span[contains(text(),'Invoices')]" + + And I wait for element with xpath "//*[@id='sales_order_view_tabs_order_invoices_content']/div/div[3]/table/tbody/tr/td[9]/a" to appear + And I click on the element with xpath "//*[@id='sales_order_view_tabs_order_invoices_content']/div/div[3]/table/tbody/tr/td[9]/a" + + And I wait for element with xpath "//textarea[@name='comment[comment]']" to appear + And I fill in the following: + | comment[comment] | Customer requested billing info change. Result: Updated. | + And I check "comment[is_customer_notified]" + + And I click on the element with xpath "//button[@id='submit_comment_button']/span" + + #Assertion + And I wait for element with xpath "//div[@class='note-list-comment'][contains(text(),'Customer requested billing info change. Result: Updated.')]" to appear diff --git a/dev/tests/behavioral/features/admin/update-product.feature b/dev/tests/behavioral/features/admin/update-product.feature new file mode 100644 index 0000000000000..d63e8a2b41747 --- /dev/null +++ b/dev/tests/behavioral/features/admin/update-product.feature @@ -0,0 +1,55 @@ +@javascript @skip +Feature: Update product feature + + Scenario: Update product (admin side) + + Given I am on "http://magento.vm/index.php/admin/admin/index/index/key/509d07fe462fb9526fa8419f968a4373fdb9e162fb47fd7845b3de2f8d550be4/" + + Then I wait for element with xpath "//*[@id='html-body']/section" to appear + And I fill in the following: + | login[username] | demo | + | login[password] | demoPwd0 | + + And I wait for element with xpath "//*[@id='login-form']/fieldset/div[3]/div[1]/button/span" to appear + And I click on the element with xpath "//*[@id='login-form']/fieldset/div[3]/div[1]/button/span" + + And I wait for element with xpath "//*[@id='menu-magento-catalog-catalog']/a" to appear + And I click on the element with xpath "//*[@id='menu-magento-catalog-catalog']/a" + + And I wait for element with xpath "//*[@id='menu-magento-catalog-catalog']/div/ul/li/div/ul/li[1]/a" to appear + And I click on the element with xpath "//*[@id='menu-magento-catalog-catalog']/div/ul/li/div/ul/li[1]/a" + + #Catalog + And I wait for element with xpath "//*[@id='container']/div/div[4]/table/tbody/tr[3]/td[13]/a" to appear + And I click on the element with xpath "//*[@id='container']/div/div[4]/table/tbody/tr[3]/td[13]/a" + + #Edit Item (Crown Summit Backpack) + And I wait for element with xpath "//*[@id='container']/div/div[2]/div[1]/div/fieldset/div[1]/label/span" to appear + And I fill in the following: + | product[name] | Crown Summit Backpack Black | + | product[price] | 60.00 | + | product[quantity_and_stock_status][qty] | 135 | + And I select "Out of Stock" from "product[quantity_and_stock_status][is_in_stock]" + And I fill in the following: + | product[weight] | 0.005 | + + And I select "China" from "product[country_of_manufacture]" + And I select "Climbing" from "product[activity]" + And I select "Microfiber" from "product[material]" + And I select "Orange" from "product[color]" + And I select "Shoulder" from "product[strap_bags]" + And I select "Laptop Sleeve" from "product[features_bags]" + + And I wait for element with xpath "//*[@id='container']/div/div[2]/div[1]/div/fieldset/div[15]/div/div/label" to appear + And I click on the element with xpath "//*[@id='container']/div/div[2]/div[1]/div/fieldset/div[15]/div/div/label" + + And I click on the element with xpath "//*[@id='container']/div/div[2]/div[1]/div/fieldset/div[16]/div/div/label" + And I click on the element with xpath "//*[@id='container']/div/div[2]/div[1]/div/fieldset/div[17]/div/div/label" + And I click on the element with xpath "//*[@id='container']/div/div[2]/div[1]/div/fieldset/div[18]/div/div/label" + And I click on the element with xpath "//*[@id='container']/div/div[2]/div[1]/div/fieldset/div[19]/div/div/label" + And I click on the element with xpath "//*[@id='container']/div/div[2]/div[1]/div/fieldset/div[16]/div/div/label" + + And I wait for element with xpath "//*[@id='save-button']/span" to appear + And I click on the element with xpath "//*[@id='save-button']/span" + + And I wait for element with xpath "//*[@id='messages']/div/div/div" to appear diff --git a/dev/tests/behavioral/features/front/catalog-compare.feature b/dev/tests/behavioral/features/front/catalog-compare.feature new file mode 100644 index 0000000000000..2d837e1685c8d --- /dev/null +++ b/dev/tests/behavioral/features/front/catalog-compare.feature @@ -0,0 +1,40 @@ +@javascript @skip +Feature: Catalog category compare + + Scenario: Compare products + + Given I am on "/index.php/men.html" + And I wait for element with xpath "//*[@id='maincontent']/div[4]/div[2]/div/div/ul[1]/li[2]/a" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[4]/div[2]/div/div/ul[1]/li[2]/a" + + #1 item to compare + And I wait for element with xpath "//*[@id='maincontent']/div[3]/div[1]/div[3]/ol/li[1]/div/a/span/span/img" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[3]/div[1]/div[3]/ol/li[1]/div/a/span/span/img" + Then I wait for page to load "/index.php/beaumont-summit-kit.html" + And I wait for element with xpath "//*[@id='maincontent']/div[2]/div/div[1]/div[6]/div/a[2]/span" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[2]/div/div[1]/div[6]/div/a[2]/span" + + And I wait for element with xpath "//*[@id='maincontent']/div[1]/div[2]/div/div/div" to appear + + And I am on "/index.php/men.html" + And I wait for element with xpath "//*[@id='maincontent']/div[4]/div[2]/div/div/ul[1]/li[2]/a" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[4]/div[2]/div/div/ul[1]/li[2]/a" + + #2 item to compare + And I wait for element with xpath "//*[@id='maincontent']/div[3]/div[1]/div[3]/ol/li[4]/div/a/span/span/img" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[3]/div[1]/div[3]/ol/li[4]/div/a/span/span/img" + Then I wait for page to load "/index.php/orion-two-tone-fitted-jacket.html" + And I wait for element with xpath "//*[@id='maincontent']/div[2]/div/div[1]/div[6]/div/a[2]/span" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[2]/div/div[1]/div[6]/div/a[2]/span" + + And I wait for element with xpath "//*[@id='maincontent']/div[2]/div/div[1]/div[1]/h1/span" to appear + And I am on "/index.php/men.html" + + #Compare + And I wait for element with xpath "//*[@id='maincontent']/div[4]/div[3]/div[1]/div[2]/div/div[1]/a/span" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[4]/div[3]/div[1]/div[2]/div/div[1]/a/span" + + And I wait for page to load "/index.php/catalog/product_compare/index/" + And I wait for element with xpath "//*[@id='product-comparison']/tbody[1]/tr/td[1]/div[3]/div[1]/form/button/span" to appear + And I click on the element with xpath "//*[@id='product-comparison']/tbody[1]/tr/td[1]/div[3]/div[1]/form/button/span" + And I wait for page to load "/index.php/beaumont-summit-kit.html" diff --git a/dev/tests/behavioral/features/front/catalog-filters.feature b/dev/tests/behavioral/features/front/catalog-filters.feature new file mode 100644 index 0000000000000..a91cc74853828 --- /dev/null +++ b/dev/tests/behavioral/features/front/catalog-filters.feature @@ -0,0 +1,25 @@ +@javascript +Feature: Catalog category filters + + Scenario: User filters products + + Given I am on "/index.php/women/tops-women/jackets-women.html" + And I wait for element with xpath "//div[@class='filter-options-title'][contains(text(), 'Style')]" to appear + And I click on the element with xpath "//div[@class='filter-options-title'][contains(text(), 'Style')]" + And I wait for element with xpath "//div[@class='filter-options-content']//a[contains(text(), 'Soft Shell')]" to appear + And I click on the element with xpath "//div[@class='filter-options-content']//a[contains(text(), 'Soft Shell')]" + Then I wait for page to load "/index.php/women/tops-women/jackets-women.html?style_general=125" + + #Material + And I wait for element with xpath "//div[@class='filter-options-title'][contains(text(), 'Material')]" to appear + And I click on the element with xpath "//div[@class='filter-options-title'][contains(text(), 'Material')]" + And I wait for element with xpath "//div[@class='filter-options-content']//a[contains(text(), 'Fleece')]" to appear + And I click on the element with xpath "//div[@class='filter-options-content']//a[contains(text(), 'Fleece')]" + + #Price + And I wait for element with xpath "//div[@class='filter-options-title'][contains(text(), 'Price')]" to appear + And I click on the element with xpath "//div[@class='filter-options-title'][contains(text(), 'Price')]" + And I wait for element with xpath "//div[@class='filter-options-content']//a[contains(span/text(), '$50.00')]" to appear + And I click on the element with xpath "//div[@class='filter-options-content']//a[contains(span/text(), '$50.00')]" + + And I wait for element with xpath "//div[@class='product details product-item-details']//a[contains(text(),'Augusta Pullover Jacket')]" to appear \ No newline at end of file diff --git a/dev/tests/behavioral/features/front/create-account.feature b/dev/tests/behavioral/features/front/create-account.feature new file mode 100644 index 0000000000000..d676766e2415c --- /dev/null +++ b/dev/tests/behavioral/features/front/create-account.feature @@ -0,0 +1,30 @@ +@javascript +Feature: Customer accounts functionality + + Scenario: User registers as a customer + + Given I am on "/" + + Then I wait for element with xpath "//div[@class='panel header']//a[contains(text(),'Create an Account')]" to appear + And I click on the element with xpath "//div[@class='panel header']//a[contains(text(),'Create an Account')]" + + + Then I wait for page to load "/index.php/customer/account/create/" + + #Personal information + And I wait for element with xpath "//input[@id='firstname']" to appear + And I fill in the following: + | firstname | Anne | + | lastname | Liz | + And I check "is_subscribed" + And I fill in the following: + | email | newtest@gmail.com | + | password | Anne1234$ | + | password_confirmation | Anne1234$ | + + And I wait for element with xpath "//form[@class='form create account form-create-account']//span[contains(text(),'Create an Account')]" to appear + And I click on the element with xpath "//form[@class='form create account form-create-account']//span[contains(text(),'Create an Account')]" + + #Success + Then I wait for page to load "/index.php/customer/account/" + And I wait for element containing unique text "Thank you for registering with Main Website Store." to appear \ No newline at end of file diff --git a/dev/tests/behavioral/features/front/product-purchase.feature b/dev/tests/behavioral/features/front/product-purchase.feature new file mode 100644 index 0000000000000..0666f7b06853b --- /dev/null +++ b/dev/tests/behavioral/features/front/product-purchase.feature @@ -0,0 +1,62 @@ +@javascript @skip +Feature: Product purchase + + Scenario: Purchase products + + Given I am on "/index.php/women.html" + + And I wait for element with xpath "//*[@id='maincontent']/div[4]/div[2]/div/div/ul[1]/li[1]/a" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[4]/div[2]/div/div/ul[1]/li[1]/a" + + #Choosing 1 item + And I wait for element with xpath "//*[@id='maincontent']/div[3]/div[1]/div[3]/ol/li[3]/div/a/span/span/img" to appear + And I click on the element with xpath "//*[@id='maincontent']/div[3]/div[1]/div[3]/ol/li[3]/div/a/span/span/img" + And I wait for page to load "/index.php/autumn-pullie.html" + + And I wait for element with xpath "//*[@id='product-options-wrapper']/div/div/div[1]/div/div[3]" to appear + And I click on the element with xpath "//*[@id='product-options-wrapper']/div/div/div[1]/div/div[3]" + + And I wait for element with xpath "//*[@id='product-options-wrapper']/div/div/div[2]/div/div[1]" to appear + And I click on the element with xpath "//*[@id='product-options-wrapper']/div/div/div[2]/div/div[1]" + + #Add to card + And I wait for element with xpath "//*[@id='product-addtocart-button']/span" to appear + And I click on the element with xpath "//*[@id='product-addtocart-button']/span" + + #Check the card + And I wait for element with xpath "//div[1]/header/div[2]/div[1]/a/span[2]" to appear + And I click on the element with xpath "//div[1]/header/div[2]/div[1]/a/span[2]" + + And I wait for element with xpath "//*[@id='top-cart-btn-checkout']" to appear + And I click on the element with xpath "//*[@id='top-cart-btn-checkout']" + + #Checkout + Then I wait for page to load "/index.php/checkout/" + And I wait for element with xpath "//*[@id='customer-email']" to appear + + And I fill in the following: + | customer-email | test@test.com | + | firstname | Peter | + | lastname | Smith | + | company | AAA | + | street[0] | 5 Main street | + | city | King | + + And I select "Florida" from "region_id" + And I fill in the following: + | postcode | 12345 | + And I select "United States" from "country_id" + And I fill in the following: + | telephone | 4166666666 | + And I click on the element with xpath "//*[@id='checkout-shipping-method-load']/table/tbody/tr[1]/td[1]/input" + And I wait for element with xpath "//*[@id='shipping-method-buttons-container']/div/button" to appear + And I click on the element with xpath "//*[@id='shipping-method-buttons-container']/div/button" + + #Payment + Then I wait for page to load "/index.php/checkout/#payment" + And I wait for element with xpath "//*[@id='checkout-payment-method-load']/div/div/div[2]/div[2]/div[4]/div/button/span" to appear + And I click on the element with xpath "//*[@id='checkout-payment-method-load']/div/div/div[2]/div[2]/div[4]/div/button/span" + + #Success + Then I wait for page to load "/index.php/checkout/onepage/success/" + And I wait for element containing unique text "Your order # is" to appear