Commit 7750e17b authored by Ranie Santos's avatar Ranie Santos

created test for chat using laravel dusk

parent bb4684cf
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="bootstrap/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Browser Test Suite">
<directory suffix="Test.php">./tests/Browser</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./app</directory>
</whitelist>
</filter>
</phpunit>
<template>
<div class="chat-composer">
<input type="text" placeholder="Start typing your message..." v-model="messageText" @keydown.enter="sendMessage">
<input type="text" id="message" placeholder="Start typing your message..." v-model="messageText" @keydown.enter="sendMessage">
<button class="btn btn-primary" @click="sendMessage" :disabled="this.messageText.trim() === ''">Send</button>
</div>
</template>
......
......@@ -2,22 +2,38 @@
namespace Tests\Browser;
use App\User;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Laravel\Dusk\Chrome;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class ExampleTest extends DuskTestCase
{
/**
* A basic browser test example.
*
* @return void
*/
use DatabaseMigrations;
public function testBasicExample()
{
$this->browse(function (Browser $browser) {
$browser->visit('/')
->assertSee('Laravel');
$user1 = factory(User::class)->create([
'name' => 'John Doe'
]);
$user2 = factory(User::class)->create([
'name' => 'Jane Doe'
]);
$this->browse(function ($first, $second) use ($user1, $user2) {
$first->loginAs($user1)
->visit('/chat')
->waitFor('.chat-composer');
$second->loginAs($user2)
->visit('/chat')
->waitFor('.chat-composer')
->type('#message', 'Hey John')
->press('Send');
$first->waitForText('Hey John')
->assertSee('Jane Doe');
});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment