Level 50
Having a similar issue at the moment too.
First test in each dusk file passes, but everything else does not.
Failed tests run if I use dusk --filter {testname}
I have a test file that is responsible for verifying a workflow that a user may take.
For some reason, it seems like that when i run the test, the database is destroyed before it finish to test it.
The test that fails is: the_campaign_mapping_page_should_list_all_campaigns_and_bucket_mappings, it only fails when running the full test suite, it passes when running it on it's own.
My test:
<?php
namespace Tests\Browser;
use App\Models\Ads\Campaign;
use App\Models\Users\Admin;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Tests\DuskTestCase;
use Laravel\Dusk\Browser;
class CampaignMappingsTest extends DuskTestCase
{
use DatabaseMigrations;
private $admin;
protected function setUp()
{
parent::setUp();
$this->admin = factory(Admin::class)->create();
}
/**
* @test
*
* @throws \Throwable
*/
public function as_an_administrator_i_should_see_a_notification_when_there_are_unmapped_campaigns(
)
{
$this->browse(function (Browser $browser) {
$campaign = factory(Campaign::class)->create();
$browser->loginAs($this->admin)
->visit('/')
->assertSee('Unmapped Campaigns');
});
}
/**
* @test
*
* @throws \Throwable
*/
public function when_i_click_on_the_unmapped_campaigns_notification_i_should_see_a_list_of_projects_with_unmapped_campaigns(
)
{
$this->browse(function (Browser $browser) {
$campaign = factory(Campaign::class)->create();
$adAccount = $campaign->adAccount;
$browser->loginAs($this->admin)
->visit('/')
->assertSee('Unmapped Campaigns')
->clickLink("Associate buckets.")
->waitFor('table#unmapped_campaigns_table')
->assertSee($adAccount->project->name);
$browser->assertSee("1 Unmapped Campaigns")
->clickLink('Manage Mapping')
->assertRouteIs('admin.project.campaign.ad_account.mapping',
[
'project' => $adAccount->project,
'adAccount' => $adAccount,
]);
});
}
/**
* @test
*
* @throws \Throwable
*/
public function the_campaign_mapping_page_should_list_all_campaigns_and_bucket_mappings(
)
{
$this->browse(function (Browser $browser) {
$campaign = factory(Campaign::class)->create();
$adAccount = $campaign->fresh()->adAccount;
$browser->loginAs($this->admin)
->visitRoute('admin.project.campaign.ad_account.mapping',
['project' => $adAccount->project, 'adAccount' => $adAccount]);
$browser->waitForText($campaign->campaign_name)
->assertSee($campaign->campaign_name);
});
}
}
The error:
1) Tests\Browser\CampaignMappingsTest::the_campaign_mapping_page_should_list_all_campaigns_and_bucket_mappings
Facebook\WebDriver\Exception\UnexpectedAlertOpenException: unexpected alert open: {Alert text : DataTables warning: table id=campaigns_table - Ajax error. For more information about this error, please see http://datatables.net/tn/7}
(Session info: headless chrome=67.0.3396.99)
(Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.4.0-128-generic x86_64)
when checking the logs for that ajax request, it seems like the table is no longer available
Please or to participate in this conversation.