Completed
Push — master ( ce58c6...c67fb3 )
by Henry
09:17
created

CommentTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 47
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testComment() 0 26 1
1
<?php
2
namespace Redaxscript\Tests;
3
4
use Facebook\WebDriver\WebDriverBy;
5
6
/**
7
 * CommentTest
8
 *
9
 * @since 4.2.0
10
 *
11
 * @package Redaxscript
12
 * @category Tests
13
 * @author Henry Ruhs
14
 */
15
16
class CommentTest extends TestCaseAbstract
17
{
18
	/**
19
	 * setUp
20
	 *
21
	 * @since 4.2.0
22
	 */
23
24
	public function setUp() : void
25
	{
26
		parent::setUp();
27
		$this->_driver->get('http://localhost:8000/?p=home/welcome');
28
	}
29
30
	/**
31
	 * testComment
32
	 *
33
	 * @since 4.2.0
34
	 */
35
36
	public function testComment() : void
37
	{
38
		/* setup */
39
40
		$formElement = $this->_driver->findElement(WebDriverBy::tagName('form'));
41
		$authorElement = $formElement->findElement(WebDriverBy::id('author'));
42
		$emailElement = $formElement->findElement(WebDriverBy::id('email'));
43
		$urlElement = $formElement->findElement(WebDriverBy::id('url'));
44
		$textElement = $formElement->findElement(WebDriverBy::id('text'));
45
		$buttonElement = $formElement->findElement(WebDriverBy::tagName('button'));
46
47
		/* interact */
48
49
		$authorElement->sendKeys('test');
50
		$emailElement->sendKeys('[email protected]');
51
		$urlElement->sendKeys('https://test.com');
52
		$textElement->sendKeys('test');
53
		$buttonElement->click();
54
55
		/* compare */
56
57
		$commentOne = $this->_driver->findElement(WebDriverBy::id('comment-1'));
58
		$commentTwo = $this->_driver->findElement(WebDriverBy::id('comment-2'));
59
		$this->assertTrue($commentOne->isDisplayed());
60
		$this->assertTrue($commentTwo->isDisplayed());
61
	}
62
}
63