简体   繁体   English

如果我们在一个柏树测试中使用两个不同的 url,如何处理

[英]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.

相关问题 如何在赛普拉斯中为不同的 URL 运行相同的测试 - How to run same test for different URLs in Cypress 如何使用赛普拉斯在测试自动化中处理 Windows 提示? - How to handle a windows prompt in a test automation using Cypress? 我们如何从一个目录中读取多个测试文件并在 cypress 中一个一个运行? - How can we read multiple test files from a directory and run one by one in cypress? 如何在 cypress cucumber 测试中处理“未捕获:异常” - How to handle 'Uncaught:exception' in cypress cucumber test 如何从赛普拉斯测试运行程序和控制台日志中禁用阻塞主机 URL? - How to disable blockedHosts urls from Cypress test runner and console logs? 我们如何使用 Cypress.io Js 自动化框架测试警报及其显示的文本? - How can we test the alert and the text it is displaying using Cypress.io Js automation framework? 我们如何使用 Cypress.io 测试标记/标记在 Google 地图上的显示? - How can we test the display of marker/ markers on Google map using Cypress.io? 向两个不同的URL提交一种表单 - Submiting one form to two different URLs 我们将如何从 Cypress 测试调用在单独文件中编写的函数? - How will we call a function written in a separate file from a Cypress test? 如何在 CYPRESS 中使用不同的测试数据集运行单个测试 - How to run a single test with a different set of test data in CYPRESS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM