Laravel Dusk Test – Difficulty using select with dropdown

I’m having an issue with getting the test to select an item from the drop … Read more Laravel Dusk Test – Difficulty using select with dropdown

I’m having an issue with getting the test to select an item from the drop down. Help would be so much appreciated. The same select method works on other elements within the app but seems to randomly not work. I’ve compared them but can’t find any difference in how I’m using the statement.

Note: I’ve left out a bit of information from the code samples for privacy reasons, if it’s needed I can add it.

Test:

user = $this->testAccounts['account'];
        $this->browse(function ($browser) use ($user) {
            $browser->maximize()
                ->visit(new loginPage)
                ->loginUser($user['email'], $user['password'])
                ->pause(10000)
            // Select Bone
            ->click('@bone')
            ->pause(200)
            ->select('@bone', 'list-item-179-0')
            ->pause(1000)

            // Select Side
            ->click('@side')
            ->pause(200)
            ->select('@side', 'list-item-268-0')
            ->pause(1000)

Error (as you can see, it’s not erroring out at the select statement but at the next one which isn’t yet on the page until the first one is selected. The bone item 179 is never selected; however, the click(‘@bone’) works:

1) TestsBrowserVisualizationsmeasurementScatterplotTest::measurementScatterplotTest
FacebookWebDriverExceptionNoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"body [dusk="side"]"}
  (Session info: chrome=94.0.4606.61)

Vue:

<v-badge
            class="project-canvas" :content="listBones.length" :value="listBones.length" color="green" overlap >
           <v-autocomplete v-model="bones" label="Bone" dusk="bone" clearable
                           :items="listBones" item-text="name" item-value="id" @change="changeBone" placeholder="Select Bone">
           </v-autocomplete>

Here’s the generated HTML for the element on the page:
DropDown HTML Element

Source: Vue – Stack Overflow



Leave a Reply

Your email address will not be published. Required fields are marked *