skoobi's avatar
Level 13

Dusk not typing or check

Hi. I'm struggling to get the dusk testing working correctly. I've tried multiple ways to check the checkboxes, via check, click and adding value etc. but none of the methods have worked.

The first few tests are working fine with exactly the same code, but as soon as i try this code it fails. Ive taken screenshots and they show that its all in the correct place. I've rejigged the css to make sure no elements are obstucting it, and I've removed all js and other scripts to test to make sure that isnt causing an issue and I still get the same.

I have this dusk test:

The blade view (there is components, and if I inspect the inputs, the dusk attribute is there and correct):

<form action="{{ route('customer.save-junk-filter') }}" id="junk-filter" class="scroll-m-36 " role="form" method="POST"
    dusk="junkMailSection">

    @csrf

    <div class="mt-10">
        <h1 class="text-3xl font-light text-red-800">
            Junk mail filters
        </h1>
    </div>

    <div class="mt-5">
        <x-forms.checkbox label="Filter magazines to treat magazines as junk mail" name="filter_magazines"
            :value="Auth::user()->settings->filter_magazines" dusk="filterMagazines" />
    </div>

    <div class="">
        <x-forms.checkbox label="Filter catalogues to treat catalogues as junk mail" name="filter_catalogues"
            :value="Auth::user()->settings->filter_catalogues" dusk="filterCatalogues" />
    </div>

    <x-forms.form-button label="Save changes" dusk="saveJunkMail" />

</form>

When I run the test, i get:

Any ideas?

Many thanks

0 likes
2 replies
skoobi's avatar
Level 13

Ok so the solution for me was to add ->pause(3000) to each stage of selecting or typing, but also when navigating to give it some time.

skoobi's avatar
skoobi
OP
Best Answer
Level 13

Sorry I spoke to soon, but I did figure out what was going on...

When running the test with the --browse flag it was popping up with the "Change password" message in the browser which then stopped any input. It didn't show up on any screenshots when debugging when not using the --browser flag...

For anyone else hitting this issue. Heres what i done in the DuskTestCase.php file. It only needs the --incognito mode i think, but i threw the kitchen sink at it just in case :

Please or to participate in this conversation.