简体   繁体   中英

In Laravel Dusk, is there a way to test a link that contains tel: number?

I've been searching for a solution to this problem, but I had to ask for myself. If for example, I have this element:

<a id="telephone-link" href="tel:+8445291234"><i class="fas fa-phone pr5"></i> (844) 529-1234 </a>

So currently, this is how I test it:

    $this->browse(function (Browser $browser) {
        $browser->visit('/')
                ->click('#header-contacts a#telephone-link')
                ->assertPathIs('/');  //9

        $browser->pause(500);
    });

But I think this is wrong because there is not a correct test that occurs here. So what I wanted to do is either of the two:

  1. To assert if the link really redirects me to a Call application; or
  2. If above doesn't work, just check the href value of the link, which I can't find on the documentation.

I hope you can help me. Thank you!

PS, The same thing could apply on mail: links if I'm not wrong.

I think it's not possible to check if a phone application starts, because you don't have such a application in Dusk (which uses headless chrome).

In my opinion this should be tested by an Feature Test/Unit Test. Just assert that a method prints out the needed tel: string.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM