From 5b283f4f7712855e731f3a7b665e23c473c935db Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Sun, 19 Feb 2017 00:50:27 +0000 Subject: [PATCH] Add Dusk test for the micropub client --- tests/Browser/MicropubClientTest.php | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/Browser/MicropubClientTest.php diff --git a/tests/Browser/MicropubClientTest.php b/tests/Browser/MicropubClientTest.php new file mode 100644 index 00000000..4b20b03d --- /dev/null +++ b/tests/Browser/MicropubClientTest.php @@ -0,0 +1,37 @@ +browse(function ($browser) { + $browser->visit('/micropub/create') + ->assertSee(config('app.url')); + }); + } + + public function test_client_page_creates_new_note() + { + $faker = \Faker\Factory::create(); + $note = $faker->text; + $this->browse(function ($browser) use ($note) { + $browser->visit('/micropub/create') + ->type('content', $note) + ->press('submit'); + $this->assertDatabaseHas('notes', ['note' => $note]); + }); + //reset database + $newNote = \App\Note::where('note', $note)->first(); + $newNote->forceDelete(); + } +}