简体   繁体   English

在Laravel Dusk中,有没有一种方法可以测试包含tel:number的链接?

[英]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; 断言链接是否确实将我重定向到Call应用程序; or 要么
  2. If above doesn't work, just check the href value of the link, which I can't find on the documentation. 如果上述方法不起作用,只需检查链接的href值,该值在文档中找不到。

I hope you can help me. 我希望你能帮助我。 Thank you! 谢谢!

PS, The same thing could apply on mail: links if I'm not wrong. PS,同样的事情也可以应用于邮件:如果我没记错的话,可以链接。

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). 我认为无法检查电话应用程序是否启动,因为Dusk(使用无头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. 只要断言一个方法会打印出所需的tel:字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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