【问题标题】:Lauching cypress test for the 2nd time, url lands on error page第二次启动cypress测试,url登陆错误页面
【发布时间】:2020-08-18 18:25:39
【问题描述】:

我正在尝试使用 cypress 运行测试,第一次运行测试时,它会转到指定的 URL,即http://demo.nopcommerce.com/, 但我第二次运行测试时,我被重定向到https://demo.nopcommerce.com/page-not-found#/tests/integration\examples\Locators.spec.js

这是我的脚本:

describe('Locating Elements', function() {
  it('Verify Types of locators', function() {
    cy.visit('http://demo.nopcommerce.com/')
    cy.get('#small-searchterms').type('Apple MacBook Pro 13-inch')
    cy.get('.button-1.search-box-button[value="Search"]').click()
    cy.get('.button-2.product-box-add-to-cart-button[value="Add to cart"]').click()
    cy.get('#product_enteredQuantity_4').clear().type('3')
    cy.get('input[type="button"][id="add-to-cart-button-4"]').click()
    cy.contains('The product has been added to your').should('be.visible')
    cy.get('.close').click()
    cy.contains('Shopping cart').click()
    cy.get('.estimate-shipping-button').click()
    cy.get('.estimate-shipping-popup').then(function() {
      cy.log('Hello.......')
      cy.get('#CountryId').select('India')
    })
  })
})

【问题讨论】:

    标签: cypress


    【解决方案1】:

    您能否在 cy.visit() 中尝试使用 https://demo.nopcommerce.com/ 而不是 http://,也请在 cypress.json 中添加 "chromeWebSecurity" : false。当我尝试使用 https:// 时,它在重新运行测试时工作正常。

    最好与开发团队核实 nopcommerce.com 域/子域是否已正确配置为接受 http:// 请求。

    【讨论】:

    • 谢谢。我想出了与建议相同的解决方案。
    猜你喜欢
    • 2015-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-04
    • 2017-03-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多