laravel-dusk

Laravel Dusk screenshot

ぃ、小莉子 提交于 2019-12-21 19:38:09
问题 I'm using laravel 5.6 and Dusk for running some tests. I'm always taking my screenshot like this ... use Facebook\WebDriver\WebDriverDimension; ... class LoginTest extends DuskTestCase { public function testLogin() { $user = User::first(); $this->browse(function ($browser) use ( $user ) { $test = $browser->visit( new Login) ->resize(1920,1080) ... ->driver->takeScreenshot(base_path('tests/Browser/screenshots/testLogin.png')); }); } } But as my tests will be more and more used, I don't want to

Laravel Dusk screenshot

只谈情不闲聊 提交于 2019-12-21 19:36:40
问题 I'm using laravel 5.6 and Dusk for running some tests. I'm always taking my screenshot like this ... use Facebook\WebDriver\WebDriverDimension; ... class LoginTest extends DuskTestCase { public function testLogin() { $user = User::first(); $this->browse(function ($browser) use ( $user ) { $test = $browser->visit( new Login) ->resize(1920,1080) ... ->driver->takeScreenshot(base_path('tests/Browser/screenshots/testLogin.png')); }); } } But as my tests will be more and more used, I don't want to

Migrate only once with Laravel dusk

偶尔善良 提交于 2019-12-14 03:45:18
问题 According to the "Database Testing" documentation I can reset the database after each test (first option). Second option is to run test using Transactions. It seems a better approach to me, but if I want to run with transaction, the migration does not run. Is there any way to run the migration once for all the test process? In other words, I want to run the migration, run every tests with transaction, then rollback. I tried with what the documentation says, but I think something is missing.

Laravel Dusk test for remote site not work

旧巷老猫 提交于 2019-12-13 03:43:27
问题 ... $this->browse(function (Browser $browser) { $browser->visit(url()->route('login')) ->type('email', 'user.one@email.com') ->type('password', 'something') ->press('Login') ->pause(60*60*1000) ->assertRouteIs('dashboard') ... It works on local which is use APP_URL something like 'https://project.dev' but not work for remote 'https://project.com' and 'http://123.123.12.12'. Errors or Problems login test on remote site not work Different between local and remote dusk installed in local dusk

ChromeDriver Laravel Dusk Set Download File Path

蓝咒 提交于 2019-12-11 18:08:30
问题 Hi all wanted to ask how to set chromeDriver options default path to a specific directory so that if one downloads file using laravel dusk headless driver, files downloads to the directory. Thanks in advance. 回答1: Try this: $this->browse(function (Browser $browser) { $url = $browser->driver->getCommandExecutor()->getAddressOfRemoteServer(); $uri = '/session/' . $browser->driver->getSessionID() . '/chromium/send_command'; $body = [ 'cmd' => 'Page.setDownloadBehavior', 'params' => ['behavior' =

Laravel Dusk junit doesn't log to file

耗尽温柔 提交于 2019-12-11 16:38:14
问题 I've written some automated tests using Laravel Dusk and when I run them I get some errors, however I can't seem to scroll through the whole output. First I tried to pipe the output to less but less doesn't work properly for some reason. Then I tried doing: php artisan dusk --log-junit /path/to/log/file.log however the log file keeps empty for some reason. The teamcity version of the log works but there the errors are not described. Also, when I run only the basic test, which comes with Dusk,

Laravel Dusk: How to change config values before each test for the browser?

。_饼干妹妹 提交于 2019-12-11 04:14:05
问题 I'm trying to alter some config values before each test. However, the browser does not apply them. In my DuskTestCase file: abstract class DuskTestCase extends BaseTestCase { use CreatesApplication; protected function setUp() { parent::setUp(); config()->set('cookie-consent.enabled', false); config()->set('app.recaptcha', false); config()->set('localization.acceptLanguage', false); } /** * Prepare for Dusk test execution. * * @beforeClass * @return void */ public static function prepare() {

Laravel dusk: test file upload with Dropzone.js

不羁的心 提交于 2019-12-10 11:05:53
问题 I'm using laravel 5.6 and Dusk for this specific test. I'm trying to assert a file upload in my dropzone. But my Dropzone is created in a way that I don't have a file input element. So I can't use the attach() method. So I tried the following $file = new \Symfony\Component\HttpFoundation\File\UploadedFile(base_path() . '/tests/samples/Cylinder.stl', 'Cylinder.stl'); $response = $this->actingAs( $this->user ) ->from( 'my-url' ) ->post( route('attachments.store' ) , [ 'file' => $file ]); But

Running Laravel Dusk on Homestead

跟風遠走 提交于 2019-12-10 10:11:15
问题 I use Homestead Version 1.0.1 and Laravel version 5.4.16 . I setup the Laravel dusk by reading the documentation. But, when I run php artisan dusk by ssh to my homestead. I got an error like the following PHPUnit 5.7.17 by Sebastian Bergmann and contributors. E 1 / 1 (100%) Time: 2.52 minutes, Memory: 10.00MB There was 1 error: 1) Tests\Browser\ExampleTest::testBasicExample Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {

Laravel Dusk: how to use in-memory DB for testing

荒凉一梦 提交于 2019-12-09 19:12:20
问题 What I've been trying is to use in-memory database while testing with Laravel Dusk . Here we have a file, .env.dusk.local , with the following values. DB_CONNECTION=sqlite DB_DATABASE=:memory: Here is a snippet of a browser testing file. class ViewOrderTest extends DuskTestCase { use DatabaseMigrations; /** @test */ public function user_can_view_their_order() { $order = factory(Order::class)->create(); $this->browse(function (Browser $browser) use ($order) { $browser->visit('/orders/' .