如何使用TestCafe自动化创建一个URL的书签并在Chrome中重新打开这个书签

huangapple go评论48阅读模式
英文:

How to create a bookmark for a url and reopen the bookmark in chrome using TestCafe automation

问题

我需要收藏我的报告网址,然后更改用户权限,不允许查看报告。如果同一用户尝试打开保存的书签网址,应禁止访问。我只需要在Angular 15中使用TestCafe自动化程序如何收藏网址并重新打开它的帮助。示例书签网址:

> https://localhost:4200/cc/dashboard/8155fc36-1111-4ad4-ab11-1331e756ef33/view

英文:

I have a scenario where I need to bookmark my report url and then changed the user permission to not to allow to view the report. If the same user try to open the saved bookmark url he should not be allowed. I just need help in how to bookmark a url and reopen it back using testcafe automation in Angular15. Example URL to bookMark.

> https://localhost:4200/cc/dashboard/8155fc36-1111-4ad4-ab11-1331e756ef33/view

答案1

得分: 0

TestCafe是用于网站的端到端测试解决方案。就我了解,您想要操作浏览器界面。在TestCafe中无法这样做。

据我所知,将任何URL添加到书签并从书签中打开此URL不会影响您网站的行为。如果您只想从测试中获取报告的URL,您可以使用eval方法:

const location = await t.eval(() => window.location);

然后,您可以在任何地方使用接收到的URL,包括在更改角色后导航到此URL。

英文:

TestCafe is an end-to-end testing solution for websites. As far as I understand, you want to manipulate the browser interface. It's not possible to do so in TestCafe.
As far as I know, adding any URL to bookmarks and opening this URL from bookmarks won't affect your site's behavior. If you just want to get the report URL from the test, you can use the eval method:

const location = await t.eval(() => window.location);

Then, you can use the received URL anywhere, including navigation to this URL after changing the role.

huangapple
  • 本文由 发表于 2023年6月12日 15:00:53
  • 转载请务必保留本文链接:https://go.coder-hub.com/76454252.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定