dani94
6 months ago
279
3
Laravel

Issue DUSK terms checkbox

Posted 6 months ago by dani94

Hey guys, im trying to click typical terms of use checkbox.

But I cant do it because, the error is

"element click intercepted: Element is not clickable at point (1176, 709). Other element would receive the click: ..."

I found trick on stackoverflow to select instead of checkbox. So i tried and its works if my label has not a href.

My label is like

    <label class="custom-control-label" for="customCheck1">He leído y acepto la <a class="terminos"
        href="/legal">Política de Privacidad de datos</a>.</label>

The problem with this is that if I try to click into the label, it will redirect to /legal, so my test wont works. (I tried removing href and its works).

My code:

    public function elements()
    {
        return [
            '@register-name' => 'input[name=name]',
            '@register-email' => 'input[name=email]',
            '@register-password' => 'input[name=password]',
            '@register-password-confirmation' => 'input[name=password_confirmation]',
            '@register-code' => 'input[name=code]',
            '@register-button' => '.btn-login',
            '@register-terms' => '#customCheck1' //issue, i tried label and checkbox selector
        ];
    }

    public function SignUp(Browser $browser, $name, $email, $password, $code)
    {
        $browser->visit($this->registerUrl())
            ->type('@register-name', $name)
            ->type('@register-email', $email)
            ->type('@register-password', $password)
            ->type('@register-password-confirmation', $password)
            ->type('@register-code', $code)
            ->check('@register-terms')
            ->press('@register-button')
            ->assertPathIs($this->redirectUrl());
    }

do you have any idea how I can do it? Thanks you guys!!

Please sign in or create an account to participate in this conversation.