Skip to content

Commit 2013cd2

Browse files
Ankit098francisf
authored andcommitted
add: bstackdemo sample test
1 parent 781170e commit 2013cd2

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

tests/SingleTest.php

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/Test.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
require_once('vendor/autoload.php');
3+
4+
use Facebook\WebDriver\WebDriverBy;
5+
6+
class Test extends BrowserStackTest {
7+
8+
public function testBrowserstackDemo() {
9+
self::$driver->get("https://bstackdemo.com");
10+
// store item to add to cart
11+
$item_to_add = self::$driver->findElement(WebDriverBy::xpath("//*[@id='1']/p"))->getDomProperty('innerText');
12+
// click on add to cart button
13+
self::$driver->findElement(WebDriverBy::xpath("//*[@id='1']/div[4]"))->click();
14+
// get the item from cart
15+
$item_in_cart = self::$driver->findElement(WebDriverBy::xpath("//*[@id='__next']/div/div/div[2]/div[2]/div[2]/div/div[3]/p[1]"))->getDomProperty('innerText');
16+
// assert item in cart is same as one that was added
17+
$this->assertEquals($item_to_add, $item_in_cart);
18+
}
19+
}
20+
?>

0 commit comments

Comments
 (0)