tests now we can use headless chrome. Squashed commit of the following: commit d32d6e9dca7eb26303435c738f7c547e5009b86b Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 6 14:43:52 2017 +0100 Add dusk tests, cleanup other parts of travis.yml commit 7633b407ee222a3f4a222f889f23acf4b5549c22 Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Wed Sep 6 14:38:39 2017 +0100 I think dusk works locally with headless chrome now, just struggling on my slow laptop commit fcbc83bb0a53ac046c1af09e8caf296799a940ef Author: Jonny Barnes <jonny@jonnybarnes.uk> Date: Tue Sep 5 15:47:39 2017 +0100 Get latest package versions and remove un-needed service provider entries
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Tests\Browser;
|
|
|
|
use Tests\DuskTestCase;
|
|
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
|
|
|
class MicropubClientTest extends DuskTestCase
|
|
{
|
|
/**
|
|
* Test the client is shown for an unauthorised request.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function test_client_page_see_authenticated()
|
|
{
|
|
$this->browse(function ($browser) {
|
|
$browser->visit(route('micropub-client'))
|
|
->assertSee('You are authenticated as');
|
|
});
|
|
}
|
|
|
|
public function test_client_page_creates_new_note()
|
|
{
|
|
\Artisan::call('token:generate');
|
|
$faker = \Faker\Factory::create();
|
|
$note = 'Fake note from #LaravelDusk: ' . $faker->text;
|
|
$this->browse(function ($browser) use ($note) {
|
|
$response = $browser->visit(route('micropub-client'))
|
|
->assertSeeLink('log out')
|
|
->type('content', $note);
|
|
$response->element('form')->submit();
|
|
});
|
|
sleep(2);
|
|
$this->assertDatabaseHas('notes', ['note' => $note]);
|
|
$newNote = \App\Note::where('note', $note)->first();
|
|
$newNote->forceDelete();
|
|
}
|
|
}
|