首页 > 解决方案 > 如何修复 NetworkError:无法在“XMLHttpRequest”上执行“发送”:无法加载

问题描述

我想访问网站并单击一个元素,这是第一次测试,然后第二次测试将再次访问同一网站并单击一个元素。两个测试合而为一描述

NetworkError:无法在“XMLHttpRequest”上执行“发送”:无法加载“ https://gcpsmapi.example.com/sec/submit-events ”:页面关闭中的同步 XHR。

我试图在没有运气或解决方案的情况下搜索谷歌。我使用 beforeEach 并且我单独尝试了每个测试并且它有效。但在一起是行不通的。

describe('Checkout', () => {


  it('Checkout with empty cart', () => {
   cy.visit('https://www.example.com')
   cy.get('.lgi_btn_3').click()
   cy.get('.xo-header__cart > .xo-header__navigation-button > .xo-core-header-icon').click()
   cy.url().should('include', 'https://www.example.com/shop/winkelwagen/index.shtml')
   cy.contains('empty').should('be.visible')

  })

  it('2nd', () => {
   cy.visit('https://www.example.com')
   cy.get('.lgi_btn_3').click()
   cy.get('.xo-header__cart > .xo-header__navigation-button > .xo-core-header-icon').click()
   cy.url().should('include', 'https://www.example.com/shop/winkelwagen/index.shtml')
   cy.contains('empty').should('be.visible')


  })

})

标签: javascripttestingautomated-testscypressqa

解决方案


推荐阅读