laravel-dusk

How to handle multiple elements with the same class in laravel dusk

冷暖自知 提交于 2021-02-07 20:33:56
问题 In my dusk test I want to firstly add and then delete news. Each news has .delete-news class but on the screen I have multiple elements. Each .delete-news class has in it's path data attribute with it's id data-newsid="id" . Now the browser does not know which delete-news class it should to click. How should I manage that? Probably I should take delete-news class with the biggest data-newsid attribute. But I don't know how I should check it. Currently I'm deleting it like this: public

How to handle multiple elements with the same class in laravel dusk

安稳与你 提交于 2021-02-07 20:32:44
问题 In my dusk test I want to firstly add and then delete news. Each news has .delete-news class but on the screen I have multiple elements. Each .delete-news class has in it's path data attribute with it's id data-newsid="id" . Now the browser does not know which delete-news class it should to click. How should I manage that? Probably I should take delete-news class with the biggest data-newsid attribute. But I don't know how I should check it. Currently I'm deleting it like this: public

How to handle multiple elements with the same class in laravel dusk

拜拜、爱过 提交于 2021-02-07 20:31:42
问题 In my dusk test I want to firstly add and then delete news. Each news has .delete-news class but on the screen I have multiple elements. Each .delete-news class has in it's path data attribute with it's id data-newsid="id" . Now the browser does not know which delete-news class it should to click. How should I manage that? Probably I should take delete-news class with the biggest data-newsid attribute. But I don't know how I should check it. Currently I'm deleting it like this: public

Forcing locale in Laravel Dusk

橙三吉。 提交于 2021-01-28 08:04:42
问题 How can we force the locale used by Dusk within our tests? The browser is launched with FR locale set and thus my application is outputting French. I would need to make all tests consistently, regardless of the locale set by the developer on his system when running tests. In the middleware stack, I have a LocaleMiddleware responsible for picking a locale based on the request headers (sent automatically by the browser). If possible, I would like to avoid having test-specific code within the

press enter keyboard in laravel dusk

半城伤御伤魂 提交于 2020-06-17 04:23:30
问题 In laravel dusk, how do I type text and press enter keyboard in it? enter image description here my input field need to press enter keyboard to be able add more than 1 item at there 回答1: $browser->keys('selector', 'element1',{enter}, 'otwell',{enter}); Hope this will help you 来源: https://stackoverflow.com/questions/47405477/press-enter-keyboard-in-laravel-dusk

laravel dusk tearDown() must be compatible with Illuminate\Foundation\Testing\TestCase::tearDown()

喜你入骨 提交于 2020-04-14 07:26:46
问题 public function tearDown() { $this->browse(function (Browser $browser) { $browser->click('#navbarDropdown') ->click('.dropdown-item'); }); parent::tearDown(); } When I apply the tearDown() method to my test class I get an error telling me the tearDown() must be compatible with Illuminate\Foundation\Testing\TestCase::tearDown() What am I doing wrong? Every time I run a test I need to login. I want to login in the setUp() method and the log out again in the tearDown, so I can execute my tests

laravel dusk tearDown() must be compatible with Illuminate\Foundation\Testing\TestCase::tearDown()

随声附和 提交于 2020-04-14 07:23:08
问题 public function tearDown() { $this->browse(function (Browser $browser) { $browser->click('#navbarDropdown') ->click('.dropdown-item'); }); parent::tearDown(); } When I apply the tearDown() method to my test class I get an error telling me the tearDown() must be compatible with Illuminate\Foundation\Testing\TestCase::tearDown() What am I doing wrong? Every time I run a test I need to login. I want to login in the setUp() method and the log out again in the tearDown, so I can execute my tests

Laravel Dusk, DatabaseTransactions not doing the RollBack

我是研究僧i 提交于 2020-01-25 03:49:12
问题 I'm using Laravel Dusk, the following Register test works fine, except that it doesn't rollBack the transaction (i.e. the user record created on 'Register' always stays in the DB). My tables are all set to use InnoDB engine. Any ideas of what is going on? I have put Logs in many places and nothing looks particularly wrong. I don't get any errors at all in laravel.log file either. use DatabaseTransactions; protected $connectionsToTransact = [ 'mysql' ]; /** * A basic browser test example. * *

How to solve Exception It is unsafe to run Dusk in production in laravel 5.5?

南笙酒味 提交于 2020-01-22 14:38:26
问题 I upgrated my project from laravel 5.4 to laravel 5.5 , I dont have any problem in local env but in server i get this exception , I searched a lot and i know this issue may be duplicated but no solutions solved my problem! How can i not registering dusk when environment is production? i wrote this code in AppServiceProvider.php : public function register() { // Dusk, if env is appropriate if ($this->app->environment('local', 'testing')) { $this->app->register(DuskServiceProvider::class); } }

Class 'Tests\DuskTestCase' not found in ExampleTest.php

牧云@^-^@ 提交于 2020-01-06 02:45:35
问题 I am trying to run Laravel Dusk tests, but when I run the test, a new Chrome tab pops up with this message. Fatal error: Class 'Tests\DuskTestCase' not found in path-to-project\tests\Browser\ExampleTest.php on line 9 All I have done so far is run composer require --dev laravel/dusk:^1.0 and php artisan dusk:install . This is my ExampleTest.php (exactly how Laravel set it up) <?php namespace Tests\Browser; use Laravel\Dusk\Chrome; use Tests\DuskTestCase; use Laravel\Dusk\DuskServiceProvider;