Вчера я запускал свои тесты Laravel Dusk, и они работали нормально, сегодня я их выполняю и 8 из 13 не пройдены, большинство из них с "устаревшей ссылкой на элемент". Я внес некоторые изменения в приложение, но ничего, что требовало бы от меня изменения тестов.
Я обновил драйвер chrome, используя (спасибо staudenmeir/dusk-updater
):
php artisan dusk:update 81
но это принесло мне еще больше ошибок. До этого у меня было только 3 из моих тестов, и теперь у меня было 8.
Я пытался найти решение проблемы, но ничто не похоже на решение.
вот первые 3 я получаю ошибки:
1) Tests\Browser\ApartmentsTest::testApartments
Facebook\WebDriver\Exception\StaleElementReferenceException: stale element reference: element is not attached to the page document
(Session info: headless chrome=81.0.4044.122)
(Driver info: chromedriver=81.0.4044.69 (6813546031a4bc83f717a2ef7cd4ac6ec1199132-refs/branch-heads/4044@{#776}),platform=Linux 4.15.0-96-generic x86_64)
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:108
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:331
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:565
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteWebElement.php:332
/var/www/domovakniga.local/vendor/laravel/dusk/src/Concerns/InteractsWithElements.php:142
/var/www/domovakniga.local/tests/Browser/ApartmentsTest.php:25
/var/www/domovakniga.local/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:67
/var/www/domovakniga.local/tests/Browser/ApartmentsTest.php:67
2) Tests\Browser\BoardMembersTest::testExample
Facebook\WebDriver\Exception\StaleElementReferenceException: stale element reference: element is not attached to the page document
(Session info: headless chrome=81.0.4044.122)
(Driver info: chromedriver=81.0.4044.69 (6813546031a4bc83f717a2ef7cd4ac6ec1199132-refs/branch-heads/4044@{#776}),platform=Linux 4.15.0-96-generic x86_64)
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:108
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:331
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:565
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteWebElement.php:332
/var/www/domovakniga.local/vendor/laravel/dusk/src/Concerns/InteractsWithElements.php:142
/var/www/domovakniga.local/tests/Browser/BoardMembersTest.php:25
/var/www/domovakniga.local/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:67
/var/www/domovakniga.local/tests/Browser/BoardMembersTest.php:54
3) Tests\Browser\CashbookSettingsTest::testExample
Facebook\WebDriver\Exception\UnrecognizedExceptionException: element not interactable
(Session info: headless chrome=81.0.4044.122)
(Driver info: chromedriver=81.0.4044.69 (6813546031a4bc83f717a2ef7cd4ac6ec1199132-refs/branch-heads/4044@{#776}),platform=Linux 4.15.0-96-generic x86_64)
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Exception/WebDriverException.php:158
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:331
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:565
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteExecuteMethod.php:40
/var/www/domovakniga.local/vendor/facebook/webdriver/lib/Remote/RemoteWebElement.php:332
/var/www/domovakniga.local/vendor/laravel/dusk/src/Concerns/InteractsWithElements.php:142
/var/www/domovakniga.local/tests/Browser/CashbookSettingsTest.php:25
/var/www/domovakniga.local/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:67
/var/www/domovakniga.local/tests/Browser/CashbookSettingsTest.php:32
другие ошибки того же типа, что и "ссылка на устаревший элемент".
Здесь также мой ApartmentsTest
:
<?php
namespace Tests\Browser;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class ApartmentsTest extends DuskTestCase
{
/**
* Test if user can create and edit apartments
*
* @return void
*/
public function testApartments()
{
$this->browse(function (Browser $browser) {
$browser->visit('/login');
sleep(1);
$browser->click('#ok')
->waitForLocation('/login')
->type('email', 'peter.v.vasilev@gmail.com')
->type('password', 'password')
->press('Вход')
->visit('/apartments/create')
->waitForLocation('/apartments/create')
->assertSee('Нов апартамент')
// select obekt
->click('.form-group:nth-child(2) .selectize-input')
->click('.form-group:nth-child(2) .selectize-dropdown .option:nth-child(2)')
->click('.panel-heading');
sleep(1.5);
// select entrance
$browser->click('.form-group:nth-child(3) .selectize-input')
->click('.form-group:nth-child(3) .selectize-dropdown .option:nth-child(1)')
->click('.panel-heading')
->select('type', 1)
->type('floor', 10)
->type('apt_number', 1)
->type('percent_ideal_parts', 10.00)
->type('taksa_fro', 2.50)
->type('taksa_domoupravitel', 5.00)
->type('starting_balance', 14.00)
->press('Запиши')
->assertSee('Апартамента беше запазен успешно.')
->assertPathIs('/entrances/2/apartments')
->visit('/apartments/21/edit')
->type('percent_ideal_parts', 12.50)
->press('Запиши')
->assertSee('Успешно актуализирахте апартамента.')
->visit('/apartments')
->type('.form-control-sm', '#2020221101');
sleep(1);
$browser->press('Изтрий')
->acceptDialog()
->waitForLocation('/apartments')
->assertSee('Апартамента бе успешно изтрит.');
});
}
}
Любые идеи приветствуются.