-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathLambdaTest.php
executable file
·45 lines (32 loc) · 1.3 KB
/
LambdaTest.php
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
40
41
42
43
44
<?php
require_once('vendor/autoload.php');
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\WebDriverBy;
use PHPUnit\Framework\Assert;
class LambdaTest extends LambdaTestSetup {
public function testAdd() {
try{
$itemName = 'Yey, Lets add it to list';
self::$driver->get("https://lambdatest.github.io/sample-todo-app/");
$element1 = self::$driver->findElement(WebDriverBy::name("li1"));
$element1->click();
$element2 = self::$driver->findElement(WebDriverBy::name("li2"));
$element2->click();
$element3 = self::$driver->findElement(WebDriverBy::id("sampletodotext"));
$element3->sendKeys($itemName);
$element4 = self::$driver->findElement(WebDriverBy::id("addbutton"));
$element4->click();
self::$driver->wait(10, 500)->until(function($driver) {
$elements = $driver->findElements(WebDriverBy::cssSelector("[class='list-unstyled'] li:nth-child(6) span"));
return count($elements) > 0;
});
$element5 = self::$driver->findElement(WebDriverBy::cssSelector("[class='list-unstyled'] li:nth-child(6) span"));
$this->assertEquals($itemName, $element5->getText());
self::$driver->executeScript("lambda-status=passed");
}
catch (Exception $e){
self::$driver->executeScript("lambda-status=failed");
}
}
}
?>