[英]How to handle if we are using two different urls in one cypress test
I have a requirement where I need to visit the first URL(ex-www.example.com) and do some AWS operations like verifying the file in AWS S3.我有一个要求,我需要访问第一个 URL(ex-www.example.com)并执行一些 AWS 操作,例如在 AWS S3 中验证文件。 After completing all the operations, it should go to the second URL(ex-www.example1.com) in the same test.完成所有操作后,它应该 go 到同一个测试中的第二个 URL(ex-www.example1.com)。 Need a solution for this?需要解决方案吗?
You will have to run them separately for this to work.您必须单独运行它们才能正常工作。
it("Test", function () {
cy.visit('ex-www.example.com');
aws operations here
});
it("Test", function () {
cy.visit('ex-www.example1.com');
});
If you try this:如果你试试这个:
it("Full Happy Test", function () {
cy.visit('ex-www.example.com');
aws operations here
cy.visit('ex-www.example1.com');
});
You will get this error:你会得到这个错误:
"cy.visit() failed because you are attempting to visit a URL that is of a
different origin."
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.