diff options
author | Jesús <heckyel@hyperbola.info> | 2019-08-18 21:14:58 -0500 |
---|---|---|
committer | Jesús <heckyel@hyperbola.info> | 2019-08-18 21:14:58 -0500 |
commit | 2eed7b082f83630301e51f57ca8394de228a8605 (patch) | |
tree | 1d19962d22d30f99317d9276e4bae7744fc93fc2 /tests/phpunit/selenium/catalog/CheckoutTest.php | |
download | librecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.lz librecart-2eed7b082f83630301e51f57ca8394de228a8605.tar.xz librecart-2eed7b082f83630301e51f57ca8394de228a8605.zip |
first commit
Diffstat (limited to 'tests/phpunit/selenium/catalog/CheckoutTest.php')
-rw-r--r-- | tests/phpunit/selenium/catalog/CheckoutTest.php | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/phpunit/selenium/catalog/CheckoutTest.php b/tests/phpunit/selenium/catalog/CheckoutTest.php new file mode 100644 index 0000000..8d5583d --- /dev/null +++ b/tests/phpunit/selenium/catalog/CheckoutTest.php @@ -0,0 +1,64 @@ +<?php + +class CatalogCheckoutTest extends OpenCartSeleniumTest { + + + /** + * @before + */ + protected function setupTest() { + $this->setBrowser('firefox'); + $this->setBrowserUrl(HTTP_SERVER); + } + + public function testUpdateQuantity() { + $this->addProductsToCart(); + + $element = $this->byCssSelector('.table-bordered tbody tr:last-child input'); + $this->assertEquals('3', $element->value()); + + $element = $this->byCssSelector('.table-bordered tbody tr:first-child input'); + $this->assertEquals('1', $element->value()); + + $element->clear(); + $element->click(); + $this->keys('2'); + + $this->byCssSelector('.table-bordered tbody tr:first-child button.btn-primary')->click(); + + sleep(3); + + $element = $this->byCssSelector('.table-bordered tbody tr:first-child input'); + $this->assertEquals('2', $element->value()); + + $element = $this->byCssSelector('.table-bordered tbody tr:last-child input'); + $this->assertEquals('3', $element->value()); + } + + public function testRemoveProduct() { + $this->addProductsToCart(); + + $element = $this->byCssSelector('form .table-bordered tbody tr:first-child td:nth-child(2)'); + $this->assertStringStartsWith('MacBook', $element->text()); + + $this->byCssSelector('.table-bordered tbody tr:first-child button.btn-danger')->click(); + + sleep(3); + + $element = $this->byCssSelector('form .table-bordered tbody tr:first-child td:nth-child(2)'); + $this->assertStringStartsWith('Sony VAIO', $element->text()); + } + + private function addProductsToCart() { + $this->url('index.php?route=product/product&product_id=43'); + $this->byId('button-cart')->click(); + + $this->url('index.php?route=product/product&product_id=46'); + $this->byId('input-quantity')->clear(); + $this->clickOnElement('input-quantity'); + $this->keys('3'); + $this->byId('button-cart')->click(); + + $this->url('index.php?route=checkout/cart'); + } +} |