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 pathArticleManagerTest.php
More file actions
49 lines (38 loc) · 1.69 KB
/
ArticleManagerTest.php
File metadata and controls
49 lines (38 loc) · 1.69 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
<?php
require(__DIR__ . "/../../../class.BaseTest.php");
class ArticleManagerTest extends BaseTest {
private $title = 'unqTitle';
private $content = 'unqContent';
public static function setUpBeforeClass() {
BaseTest::login(TEST_USERNAME_ADMIN, TEST_PASSWORD_ADMIN);
}
public static function tearDownAfterClass() {
BaseTest::closeWebDriver();
}
private function delete_article() {
$this->visit_article_manager();
$this->get_element_by_linkText($this->title)->click();
$this->click('#input_form > form > table > tbody > tr:nth-child(3) > td:nth-child(2) > input[type="checkbox"]');
$this->click('#input_form > form > table > tbody > tr:nth-child(6) > td > p > input[type="submit"]');
}
private function visit_article_manager() {
BaseTest::visit(ADMIN_DASHBOARD_URL);
$this->get_element_by_linkText("Article Manager")->click();
}
public function test_createArticle() {
$this->visit_article_manager();
$this->get_element_by_linkText("Add New Articles")->click();
$this->write_to($this->title, '#input_form > form > table > tbody > tr:nth-child(1) > td:nth-child(2) > input[type="text"]');
self::$webDriver->executeScript("tinyMCE.activeEditor.setContent('" . $this->content . "')");
$this->click('#input_form > form > table > tbody > tr:nth-child(2) > td.radio > input[type="radio"]:nth-child(1)');
$this->click("#submit");
$this->visit_article_manager();
$this->get_element_by_linkText($this->title);
$this->delete_article();
}
/*TODO: Verify article published
Unpublish Article
* Edit Article
*/
}
?>