aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/selenium/catalog/CategoryTest.php
blob: 878ecc20e54a86bd5518b5b47152d7d79a224c95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php

class CatalogCategoryTest extends OpenCartSeleniumTest {
	
	
	/**
	 * @before
	 */
	protected function setupTest() {
		$this->setBrowser('firefox');
		$this->setBrowserUrl(HTTP_SERVER);
	}
	
	public function testAddToCartButton() {
		$this->url('http://opencart.welfordlocal.co.uk/index.php?route=product/category&path=20');
		
		$addToCartButton = $this->byCssSelector('button[onclick="cart.add(\'28\');"]');
		$addToCartButton->click();
		
		$this->url('index.php?route=checkout/cart');
		$element = $this->byCssSelector('#accordion + br + .row .table-bordered tr:last-child td:last-child');
		$this->assertEquals('$119.50', $element->text());
	}
	
	
	public function testRedirect() {
		$this->url('http://opencart.welfordlocal.co.uk/index.php?route=product/category&path=20');
		
		$addToCartButton = $this->byCssSelector('button[onclick="cart.add(\'42\');"]');
		$addToCartButton->click();
		
		$this->waitUntil(function(){
			if (strpos($this->url(), 'product/product') !== False) {
				return true;
			}
		}, 3000);
	}
	
}