forked from teebbstudios/teebblog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98e88e9
commit f056a70
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace App\Tests\FunctionalTest; | ||
|
||
use Symfony\Component\Panther\PantherTestCase; | ||
|
||
class CommentTest extends PantherTestCase | ||
{ | ||
public function testReplyComment(): void | ||
{ | ||
$client = static::createPantherClient(); | ||
$crawler = $client->request('GET', '/'); | ||
|
||
$link = $crawler->selectLink('Read More →')->link(); | ||
$pageDetailCrawler = $client->click($link); | ||
|
||
$form = $pageDetailCrawler->selectButton('Submit')->form(); | ||
$form['comment[author]'] = 'Teebblog'; | ||
$form['comment[email]'] = '[email protected]'; | ||
$form['comment[message]'] = '你好,世界!'; | ||
$client->submit($form); | ||
|
||
// $this->assertResponseIsSuccessful(); | ||
$this->assertSelectorTextContains('.media-body', 'Teebblog'); | ||
$this->assertSelectorTextContains('.media-body', '你好,世界!'); | ||
|
||
$client->executeScript('document.querySelector(".js-reply-comment-btn").click()'); | ||
$newPageDetailCrawler = $client->waitFor('div.reply-comment-card'); | ||
|
||
$this->assertSelectorTextContains('div.reply-comment-card', '回复评论'); | ||
|
||
$replyCommentDivCrawler = $newPageDetailCrawler->filter('div.reply-comment-card'); | ||
$replyform = $replyCommentDivCrawler->selectButton('Submit')->form(); | ||
$replyform['comment[author]'] = 'Teebblog2'; | ||
$replyform['comment[email]'] = '[email protected]'; | ||
$replyform['comment[message]'] = '测试回复评论'; | ||
$client->submit($replyform); | ||
|
||
$this->assertSelectorTextContains('.media-body', 'Teebblog2'); | ||
$this->assertSelectorTextContains('.media-body', '测试回复评论'); | ||
|
||
$client->takeScreenshot('screen.png'); | ||
|
||
} | ||
} |