Clean code to take advantage of new L5.5 features, bring back some dusk
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
This commit is contained in:
parent
7eff2075ac
commit
a3cce90c10
8 changed files with 85 additions and 150 deletions
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Browser;
|
||||
|
||||
use Tests\DuskTestCase;
|
||||
use Illuminate\Foundation\Testing\DatabaseMigrations;
|
||||
|
||||
class ArticlesTest extends DuskTestCase
|
||||
{
|
||||
/**
|
||||
* Test the `/blog` page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_articles_page()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->visit('/blog')
|
||||
->assertSee('My New Blog');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the `/blog` page with a year scoping results.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_articles_page_with_specified_year()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->visit('/blog/2016')
|
||||
->assertSee('My New Blog');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the `/blog` page with a year and month scoping results.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_articles_page_with_specified_year_and_month()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->visit('/blog/2016/01')
|
||||
->assertSee('My New Blog');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Test a single article page.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_single_article_page()
|
||||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->visit('/blog/2016/01/my-new-blog')
|
||||
->assertSee('My New Blog');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ class ExampleTest extends DuskTestCase
|
|||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testBasicExample()
|
||||
public function test_basic_example()
|
||||
{
|
||||
$this->browse(function (Browser $browser) {
|
||||
$browser->visit('/')
|
||||
|
|
|
@ -16,7 +16,7 @@ class MicropubClientTest extends DuskTestCase
|
|||
{
|
||||
$this->browse(function ($browser) {
|
||||
$browser->visit(route('micropub-client'))
|
||||
->assertSee('You are authenticated');
|
||||
->assertSee('You are authenticated as');
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,10 @@ class MicropubClientTest extends DuskTestCase
|
|||
$faker = \Faker\Factory::create();
|
||||
$note = 'Fake note from #LaravelDusk: ' . $faker->text;
|
||||
$this->browse(function ($browser) use ($note) {
|
||||
$browser->visit(route('micropub-client'))
|
||||
$response = $browser->visit(route('micropub-client'))
|
||||
->assertSeeLink('log out')
|
||||
->type('content', $note)
|
||||
->press('Submit');
|
||||
->type('content', $note);
|
||||
$response->element('form')->submit();
|
||||
});
|
||||
sleep(2);
|
||||
$this->assertDatabaseHas('notes', ['note' => $note]);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
namespace Tests;
|
||||
|
||||
use Laravel\Dusk\TestCase as BaseTestCase;
|
||||
use Facebook\WebDriver\Chrome\ChromeOptions;
|
||||
use Facebook\WebDriver\Remote\RemoteWebDriver;
|
||||
use Facebook\WebDriver\Remote\DesiredCapabilities;
|
||||
|
||||
|
@ -18,7 +19,7 @@ abstract class DuskTestCase extends BaseTestCase
|
|||
*/
|
||||
public static function prepare()
|
||||
{
|
||||
//static::startChromeDriver();
|
||||
static::startChromeDriver();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -28,8 +29,18 @@ abstract class DuskTestCase extends BaseTestCase
|
|||
*/
|
||||
protected function driver()
|
||||
{
|
||||
$desiredCapabilities = DesiredCapabilities::chrome();
|
||||
|
||||
$options = new ChromeOptions();
|
||||
$options->addArguments([
|
||||
'headless',
|
||||
'disable-gpu'
|
||||
]);
|
||||
|
||||
$desiredCapabilities->setCapability(ChromeOptions::CAPABILITY, $options);
|
||||
|
||||
return RemoteWebDriver::create(
|
||||
'http://localhost:9515', DesiredCapabilities::phantomjs()
|
||||
'http://localhost:9515', $desiredCapabilities
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue