This repository was archived by the owner on May 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathClassManagerTest.php
More file actions
66 lines (54 loc) · 2.4 KB
/
ClassManagerTest.php
File metadata and controls
66 lines (54 loc) · 2.4 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
//require_once 'Testing/Selenium.php';
require(__DIR__ . "/../../../class.BaseTest.php");
class ClassManagerTest extends BaseTest {
private $class_name = 'unqClass';
public static function setUpBeforeClass() {
BaseTest::login(TEST_USERNAME_ADMIN, TEST_PASSWORD_ADMIN);
}
public static function tearDownAfterClass() {
BaseTest::closeWebDriver();
}
private function visit_class_manager() {
BaseTest::visit(ADMIN_DASHBOARD_URL);
BaseTest::click("#dashboard_table > tbody > tr:nth-child(1) > td:nth-child(3) > p:nth-child(2) > a");
BaseTest::click("#content > div.main_content > div.header_bar > div.right.action_button > table > tbody > tr > td:nth-child(3) > div > a");
}
private function delete_class() {
$this->visit_class_manager();
$element = $this->get_element("#" . $this->class_name);
$el = $element->findElement(WebDriverBy::linkText("Click to delete class!"))->click();
}
private function create_class() {
$this->visit_class_manager();
$this->click("#content > div.main_content > div.header_bar > div.right.action_button > table > tbody > tr > td > div > a");
$this->type("#form > table > tbody > tr:nth-child(1) > td:nth-child(2) > input[type=\"text\"]", $this->class_name);
$this->click("#submit");
}
public function test_create_class() {
$this->create_class();
$this->delete_class();
}
private function archive_class(){
$this->visit_class_manager();
$element = $this->get_element("#" . $this->class_name);
$el = $element->findElement(WebDriverBy::linkText("Click to archive class!"))->click();
}
public function test_archive(){
$this->create_class();
$this->archive_class();
$element = $this->get_element("#" . $this->class_name);
$element->findElement(WebDriverBy::linkText("Click to unarchive class!"));
$this->delete_class();
}
public function test_unarchive() {
$this->create_class();
$this->archive_class();
$element = $this->get_element("#" . $this->class_name);
$element->findElement(WebDriverBy::linkText("Click to unarchive class!"))->click();
$archived = $this->get_element("#" . $this->class_name);
$archived->findElement(WebDriverBy::linkText("Click to archive class!"));
$this->delete_class();
}
}
?>